Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/bin/python: No module named virtualenvwrapper #80

Open
jiahui-z opened this issue Mar 6, 2018 · 6 comments
Open

/usr/bin/python: No module named virtualenvwrapper #80

jiahui-z opened this issue Mar 6, 2018 · 6 comments
Labels

Comments

@jiahui-z
Copy link

jiahui-z commented Mar 6, 2018

When I open the terminal, it will always show the following error message:

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.
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
-bash: complete: -D: invalid option
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]
-bash: /Users/zjh/.venvburrito/bin/virtualenvwrapper.sh: No such file or directory
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.

The post on StackOverflow doesn't help. Could you please help me solve this problem? Thanks!

@polyglotdev
Copy link

polyglotdev commented Apr 5, 2018

I was running into the same issues and so I just installed anaconda and used conda's virtual environment to compensate. I had spent 3 hours on both virtualenv and virtualwrapper to no avail. Something is happening with PATH and even after I change it in my .zshrc and source the window, I still get the same problem(on mac). My suggestion until its addressed is conda just so you aren't messing with your system python. I know there are alot of people that feel that it's a "noob" move to use conda, but I am not too proud to admit I don't know how to fix something.

@baccione
Copy link

baccione commented Oct 19, 2018

This editing of my .bashrc solved this issue to me (note, I am using python3 (which is a symbolic link to python3.6 in my system) in VIRTUALENVWRAPPER_PYTHON - with /usr/bin/python (earlier python version) throws the error above also for me).

if [ -f ~/.local/bin/virtualenvwrapper.sh ] ; then
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=~ /.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh
fi

@swankalot
Copy link

baccione, thank you.
My error was similar to Jiahui-z (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.)
baccione's fix follows the instructions given here:
https://virtualenvwrapper.readthedocs.io/en/latest/install.html#python-interpreter-virtualenv-and-path
but changes this:
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
to this:
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

@skiwheelr
Copy link

This editing of my .bashrc solved this issue to me (note, I am using python3 (which is a symbolic link to python3.6 in my system) in VIRTUALENVWRAPPER_PYTHON - with /usr/bin/python (earlier python version) throws the error above also for me).

if [ -f /.local/bin/virtualenvwrapper.sh ] ; then
export WORKON_HOME=
/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=~ /.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh
fi

this did not work

@carlasplund
Copy link

Remove the space in "export VIRTUALENVWRAPPER_VIRTUALENV=~ /.local/bin/virtualenv".

@xrybrsx
Copy link

xrybrsx commented Jun 9, 2020

I had the same issue. The following worked for me:
I tried "$ which python3" and "$ which virtualenvwrapper.sh" and just modified the bash source file accordingly.
This is my ~./bash_profile file:

export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=' -p /Library/Frameworks/Pyhton.framework/Versions/3.8/bin/python3 '
export VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
export PROJECT_HOME=$HOME/blog
source /Library/Frameworks/Python.framework/Versions/3.8/bin/virtualenvwrapper.sh
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH

Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants