I'm new to Python virtual environments, so after reading this tutorial I tried to create my first environment using virtualenvwrapper
. My python3 installation is at the bare bones now:
$ pip3 list
argparse (1.2.1)
pip (1.5.6)
setuptools (2.1)
stevedore (0.15)
virtualenv (1.11.6)
virtualenv-clone (0.2.5)
virtualenvwrapper (4.3.1)
As suggested by the tutorial, I added the following lines to my .bashrc file:
export WORKON_HOME=$HOME/.virtualenvs
source /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper_lazy.sh
which results in the following message when I open a new Terminal:
Last login: Wed Sep 10 22:33:17 on ttys006
-bash: _VIRTUALENVWRAPPER_API: unbound variable
-bash: VIRTUALENVWRAPPER_SCRIPT: unbound variable
-bash: VIRTUALENVWRAPPER_SCRIPT: unbound variable
-bash: _VIRTUALENVWRAPPER_API: unbound variable
-bash: _VIRTUALENVWRAPPER_API: unbound variable
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]
I don't understand what the problem is, but clearly the source /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper_lazy.sh
line fails because then I can't even find the mkvirtualenv
command:
$ mkvirtualenv test1 -p /usr/bin/python3.3
-bash: mkvirtualenv: command not found
I found this post and this one, with similar problems, but none of them gave me a solution.
.bashrc
file? – Carberry.bashrc
file, the result of many years of work of adding different commands and functions from here and there. – Certesset -u
in there? – Carberryset -o notify
,set -o noclobber
,set -o ignoreeof
,set -o nounset
. – Certesset -o nounset
that'sset -u
. That's going to be the issue here. The preponderance of scripts out there aren't expecting to be run with that set as it makes many idiomatic actions fail. Disable that and see if it starts to work. – CarberryERROR: virtualenvwrapper_lazy.sh: Could not find virtualenvwrapper.sh
, and I guess it's because thevirtualenvwrapper.sh
script is not on a default path? – Certesmkvirtualenv
command now, but it doesn't seem to work:$ mkvirtualenv test1 -bash: : No such file or directory [Process completed]
. After I see that message[Process completed]
I can't do anything with the Terminal. – Certesmkvirtualenv
did (probably wrongly). ThePATH
idea looks like it might be right (if the file I'm looking at is the one you have). I don't know what might be going wrong withmkvirtualenv
specifically though. – Carberryerrexit
on do you? – Carberryerrexit
in my.bashrc
file, just that when I open a new Terminal window I get the messageLast login: Wed Sep 10 23:25:04 on ttys000 ERROR: virtualenvwrapper_lazy.sh: Could not find virtualenvwrapper.sh
. – Certeswhich
can find that script and see if that fixes everything? – Carberry.bashrc
file.$ echo $PATH /Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/aaragon/Local/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/texbin
. So I can dowhich virtualenvwrapper.sh
and it finds it. – Certesvirtualenvwrapper_lazy.sh
? – Carberry$ mkvirtualenv --python=/usr/local/bin/python3 pydev Running virtualenv with interpreter /usr/local/bin/python3 Using base prefix '/Library/Frameworks/Python.framework/Versions/3.4' New python executable in pydev/bin/python3 Also creating executable in pydev/bin/python Installing setuptools, pip...done. /usr/bin/python: No module named virtualenvwrapper
– Certesworkon
the environment:$ workon pydev /usr/bin/python: No module named virtualenvwrapper /usr/bin/python: No module named virtualenvwrapper
. Well, I haven't installedvirtualenvwrapper
withpython
but only inpython3
. – CertesVIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
fix that problem? I should point out that I am gathering all of this from looking at the scripts in question. I should also say that clearly something is wrong with either your setup orvirtualenv
itself if this much fiddling is required. It might make sense to find people who actually know/work withvirtualenv
to see what they make of all this. – Carberryworkon pydev
I get again a[Process completed]
message and the Terminal doesn't work anymore. – Certes[Process completed]
means the shell that was being run in that window exited (in some way that didn't trigger the window to close, so perhaps an unclean exit). Also like I said, I think something is not quite right either with your system or withvirtualenv
itself but I'm not able to assess thevirtualenv
side of things and digging deeper into your system setup is an involved process. Sorry. – Carberry.bashrc
file and I cleaned, removed everything I didn't need. Now it works fine, but I still think the process of makingvirtualenvwrapper
work is painful, as you have to add stuff to your profile file. – Certes.bashrc
. I spent the entire morning doing that, in the end, I triedvirtualenvwrapper
and it was working already, but I really don't know what fixed it. I could send you both versions of the.bashrc
file if you want. – Certescd
function andwhich
alias could certainly cause some things problems. – Carberrywhich
function being called within thevirtualenvwrapper_lazy.sh
. But I don't think this was the problem because I still have that alias, and it now works. – Certes