0

I tried to follow this tutorial and I got stuck. These are the steps I followed:

  1. I installed Anaconda 32 bit

  2. I executed conda create -n test py2exe -c sasview, which installed Python 3.4.5-0, py2exe 0.9.2.2-py34_1 and other packages

  3. I created the hello.py file containing print("Hello World!")

  4. I created the setup.py file containing:

    from distutils.core import setup import py2exe setup(console=['hello.py'])

  5. I executed

    activate test python setup.py py2exe

The result was:

running py2exe

  1 missing Modules
  ------------------
? readline                            imported from cmd, code, pdb
Building 'dist\hello.exe'.
error: [Errno 2] No such file or directory: 'C:\\Anaconda3\\envs\\test\\lib\\site-packages\\py2exe\\run-py3.4-win32.exe'

The missing module is just a warning and can be ignored (see here).

Py2exe is not available for Python 3.5 yet, and it looks like conda knows about it and installs python 3.4.

What am I missing?

Community
  • 1
  • 1
stenci
  • 8,290
  • 14
  • 64
  • 104
  • Well, that file doesn't exist in the tarball for the package. From searching on Anaconda.org, it seems like the version of py2exe in that channel (`sasview`) is somewhat out of date. Maybe try using the `silg2` channel? – darthbith Aug 11 '16 at 16:35
  • I tried them both with the same result – stenci Aug 11 '16 at 16:50

1 Answers1

0

Executing conda create -n test py2exe -c silg2 installs pytnon 3.4.5 instead of the most recent 3.5.2, which makes me think that conda knows which version works with py2exe. Apparently this is not true.

This works:

conda create -n test python=3.4
activate test
pip install py2exe
python setup.py py2exe

Using conda list shows the same packages with the same versions in both environments, but py2exe only works when installed by pip, not when installed by conda.

stenci
  • 8,290
  • 14
  • 64
  • 104
  • I think conda is well aware of which version of Python works properly (hence why it installs 3.4). I would guess the error is probably because the conda packages don't include the .exe file that's expected, and the pip package does. Check the actual files that get installed when you install with conda vs pip, and see if there's a difference. Glad you got it working :-) – darthbith Aug 11 '16 at 18:51
  • @darthbith The .py files are identical in both the installations, but pip installed also a bunch of .dll and .exe that are missing in the environment created by conda... I thought that one big difference between pip and conda was that conda is better at managing binary files :) – stenci Aug 11 '16 at 19:04
  • I think conda is better at that (although pip wheels are pretty good), but the recipe has to be packaged properly. It looks like the maintainers of those packages fell down on the job, so to speak :-) – darthbith Aug 11 '16 at 19:18
  • @darthbith I wasn't able to leave a message to the anaconda.org user silg2. Do you know if it is possible to contact other users, like I would in github? – stenci Aug 11 '16 at 22:22
  • I don't know. You can make your own package though, since the source is available on PyPI. Type `conda skeleton pypi py2exe` and it should generate the recipe for a conda package. Then type `conda build --python=3.4 C:\Path\to\recipe` and it should build a package. – darthbith Aug 12 '16 at 01:30