Search code examples
enthoughtcanopy

How to get Enthought Canopy virtual environment to look like an independent Python installation to binary installers on Windows?


I've created a new test virtual environment in Enthought Canopy 1.1.1 (64-bit) using canopy_cli venv NEW_PATH as per the documentation, however when I run a binary installer such as the latest numpy, it doesn't find the venv as a place where the package can be installed.

What is a minimal set of changes I need to make to the registry for my venv to be recognized by a binary like the latest numpy? It would be nice if in a future update this was done automatically, or via a switch.

Finally, I had to run canopy_cli venv from the App environment, as when I run it from the default User environment I get the following error. Is this a bug?

C:\Users\Tim\AppData\Local\Enthought\Canopy\User\Scripts>canopy_cli venv
Traceback (most recent call last):
  File "C:\Users\Tim\AppData\Local\Enthought\Canopy\User\Scripts\canopy_cli-scri
pt.py", line 7, in <module>
    execfile(r"C:\Users\Tim\AppData\Local\Enthought\Canopy\App\Canopy-script.pyw
", ns)
  File "C:\Users\Tim\AppData\Local\Enthought\Canopy\App\Canopy-script.pyw", line
 757, in <module>
    bootstrap()
  File "C:\Users\Tim\AppData\Local\Enthought\Canopy\App\Canopy-script.pyw", line
 335, in bootstrap
    raise RuntimeError("no usable frozen versions were found")
RuntimeError: no usable frozen versions were found

Solution

  • 1) If, in Canopy Preferences, you make Canopy your default Python, then Gohlke's binary installers, at least, do work without any manual registry edits. This "default" setting is not very robust at present, so if you have a PATH with other Pythons, it may not be able to handle this.

    2) This may not be a complete answer, but

    HKEY_CURRENT_USER\Software\Python\PythonCore\2.7\InstallPath
    

    should be set to

    "C:\Users\Tim\AppData\Local\Enthought\Canopy\User
    

    3) Thanks for the report. There was such a bug, but it was (we think!) fixed in 1.1.0. If you have been doing updates in place since before then, the fix might not have propagated to the User environment. Are you willing to blow away your User Python (and all your package updates) to try to recreate it cleanly? If so, just delete that User directory. It will be recreated on next startup.