Search code examples
pythonpython-2.7virtualenventhought

virtualenv -p dropping last part of sys.prefix filepath when creating a new virtual environment


When I try to create a new virtual environment using The Enthought Canopy distribution of python I keep experiencing the below issue

localhost:workspace brendan$ virtualenv -p /Users/brendan/Library/Enthought/Canopy_64bit/User/bin/python test
Running virtualenv with interpreter /Users/brendan/Library/Enthought/Canopy_64bit/User/bin/python
Using base prefix '/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents'
New python executable in test/bin/python
dyld: Library not loaded: @rpath/Python
  Referenced from: /Users/brendan/Dropbox/workspace/test/bin/python
  Reason: image not found
ERROR: The executable test/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/Users/brendan/Dropbox/workspace' (should be u'/Users/brendan/Dropbox/workspace/test')
ERROR: virtualenv is not compatible with this system or executable
localhost:workspace brendan$ 

I am not sure why it is always dropping the last part of sys.prefix or how I should go about fixing this.

This is related to a previous question I posted in which this was the suggested work around.

Any help is much appreciated

Thanks


Solution

  • Canopy is built on a backport of Python 3's venv. Therefore virtualenv cannot be used in Canopy Python. Most virtualenv users should be able to use venv in its place, without difficulty. However we recognize that this does pose problems for some users. Therefore the next major release of Canopy (no ETA -- not in the next few months) will support either option.