error while sourcing ~/.bash_profile by installing virtualenvwrapper

1,130 views
Skip to first unread message

Ivan Bratchikov

unread,
Aug 4, 2016, 11:53:36 AM8/4/16
to virtualenvwrapper


I'm using OS X El Capitan (10.11.16) and I installed python using brew and then installed virtualenvwrapper and virtualenv and got the following output (previously I have already installed virtualenvwrapper and virtualenv):
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /usr/local/lib/python2.7/site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): pbr>=1.6 in /usr/local/lib/python2.7/site-packages (from stevedore->virtualenvwrapper)
The problem comes while sourcing ~/.bash_profile (I appended "source /usr/local/bin/virtualenvwrapper.sh") I get this output:
/Library/Frameworks/Python.framework/Versions/2.7/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 virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is
set properly.
I enter which virtualenvwrapper.sh in the Terminal and get:
/usr/local/bin/virtualenvwrapper.sh
Here's what I have inside .bash_profile  :
# Setting PATH for MacPython 2.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH

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

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

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

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

# Homebrew
export PATH=/usr/local/bin:$PATH

export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv

# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh
I need pip to install virtualenv and virtualenvwrapper into the site-packages directory of the Homebrew Python.
Any tips, hints, … would be very much appreciated.

Mick T.

unread,
Aug 5, 2016, 12:53:38 PM8/5/16
to virtualenvwrapper
Try setting VIRTUALENVWRAPPER_SCRIPT. I'm using Virtualenv with Python from MacPorts and I have it set to:

VIRTUALENVWRAPPER_SCRIPT=/opt/local/bin/virtualenvwrapper.sh-2.7

It'll be different with homebrew.

Jason Myers

unread,
Aug 19, 2016, 8:54:29 AM8/19/16
to virtualenvwrapper
Looks like virtualenvwrapper is setup/pointing to system python, and not your homebrew python version.  You'll want to make sure that a which python is pointing to your python in homebrew (should start with /usr/local/bin/...). Then make sure a which pip shows that same directory. 

Cheers,
Jason
Reply all
Reply to author
Forward
0 new messages