Question

Why after installing virtualenv and virtualenvwrapper and adding

    export WORKON_HOME=$HOME/.virtualenvs
    export PROJECT_HOME=$HOME/Devel
    source /Users/<user>/Library/Enthought/Canopy_64bit/User/bin/virtualenvwrapper.sh

to my .bash_profile and running $ source ~/.bash_profile, I encounter:

    /Library/Frameworks/Python.framework/Versions/7.3/Resources/Python.app/Contents/MacOS/Python: No module named virtualenvwrapper
    virtualenvwrapper.sh: There was a problem running the initialization hooks. 

    If Python could not import the module virtualenvwrapper.hook_loader,
    check that virtualenv has been installed for
    VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/Current/bin/python and that PATH is set properly.

?

My .bash_profile looks like:

    # Setting PATH for EPD_free-7.3-2
    # The orginal version is saved in .bash_profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
    export PATH

    ##
    # Your previous /Users/<user>/.bash_profile file was backed up as /Users/<user>/.bash_profile.macports-saved_2012-11-06_at_11:39:22
    ##

    # MacPorts Installer addition on 2012-11-06_at_11:39:22: adding an appropriate PATH variable for use with MacPorts.
    export PATH=/opt/local/bin:/opt/local/sbin:$PATH
    # Finished adapting your PATH environment variable for use with MacPorts.

    # virtualenvwrapper
    export WORKON_HOME=$HOME/.virtualenvs
    export PROJECT_HOME=$HOME/Devel
    source /Users/<user>/Library/Enthought/Canopy_64bit/User/bin/virtualenvwrapper.sh

    # Added by Canopy installer on 2014-01-26
    # VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make bashprompt show that Canopy is active, otherwise 1
    VIRTUAL_ENV_DISABLE_PROMPT=1 source /Users/<user>/Library/Enthought/Canopy_64bit/User/bin/activate
Was it helpful?

Solution

So figured it out. It turns out that when I installed EPD for python a while back, it added the first few lines:

    # Setting PATH for EPD_free-7.3-2
    # The orginal version is saved in .bash_profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
    export PATH

in my .bash_profile. Having updated my python to Enthought Canopy, I needed to change these lines to this:

   # set path for current python
   PATH="/Users/<user>/Library/Enthought/Canopy_64bit/User/bin:${PATH}"
   export PATH

and everything works now. However as it turns out that won't work at the end of the day because with Enthought, it backports venv, which is a python 3 standard as talked about here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top