1

I upgraded brew and now I'm getting this message every time I open the terminal:

/usr/bin/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/bin/python and that PATH is
set properly.

I tried the suggested solutions posted by Railslide and Sudipta Basak from the following post, but neither are fixing this issue for me: problems with python and virtualenvwrapper after updating: No module named virtualenvwrapper

Executing "/usr/local/bin/pip3 install virtualenv virtualenvwrapper" gives me the "Requirement already satisfied" message.

I'm on Mac, and this is breaking a few things for me, like Juypter Notebook that I had installed with Anaconda, so any help would be appreciated!

8
  • What version of Python are you actually running in your default shell? Commented Jan 6, 2020 at 17:49
  • @Makoto Version 2.7.10 Commented Jan 6, 2020 at 17:53
  • What does echo $PATH give you and what order is your Python executables (e.g. does Python 2 come before Python 3)? Commented Jan 6, 2020 at 17:56
  • Running echo $PATH is giving me usr/bin/sudo:/Users/_myName_/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin. This may be a silly question, but how do I check the order of my Python executables? Looking in /usr/bin/, I am seeing python. Looking in /usr/local/bin/, I see python3 as Alias. Commented Jan 6, 2020 at 18:03
  • If Python 2 is in /usr/bin and Python 3 is in /usr/local/bin, then /usr/local/bin needs to come before /usr/bin in your PATH. Seeing Python 3 as an alias (and aliases have very explicit meanings in *nix) could be problematic. Commented Jan 6, 2020 at 18:19

1 Answer 1

1

You have to install virtualenvwrapper for the instance of pip that goes along with the instance of python that you are using.

For example, my ~/.zprofile contains these setup commands:

export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/opt/homebrew/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/opt/homebrew/bin/virtualenv
source /opt/homebrew/bin/virtualenvwrapper.sh

Because I am using /opt/homebrew/bin/python3, I need to use the corresponding version of pip:

/opt/homebrew/bin/pip3 install virtualenvwrapper
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.