I'm trying to start up a virtual env using virtualenv, am getting this error:
Already using interpreter /Users/pkilcrease/anaconda/bin/python3
Using base prefix '/Users/pkilcrease/anaconda'
New python executable in /Users/pkilcrease/.virtualenvs/bodega/bin/python3
Also creating executable in /Users/pkilcrease/.virtualenvs/bodega/bin/python
ERROR: The executable /Users/pkilcrease/.virtualenvs/bodega/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/Users/pkilcrease/.virtualenvs' (should be '/Users/pkilcrease/.virtualenvs/bodega')
ERROR: virtualenv is not compatible with this system or executable
The command I am running is mkvirtualenv -a . --no-site-packages --python='which python3' -r requirements.txt bodega
My .bashrc
file currently looks like this:
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_SCRIPT=/Users/pkilcrease/anaconda/bin/virtualenvwrapper.sh
source /Users/pkilcrease/anaconda/bin/virtualenvwrapper_lazy.sh
I have the feeling that there is some issue with anaconda and virtualenv which is causing the problem here, but not sure how to remedy that or if it's just a red herring.
Using the anaconda conda environment, we can create environments in the same way we created a virtual environment using the python virtualenv. The functionality is the same, but the commands will change a bit. Let's have a look at these.
If using a conda python executable, use conda create --name {your_venv} python=3
(note there is a virtualenv
utility that comes with conda, but still use conda create...
to make new virtual env's).
Otherwise, when using a version of python installed by the system package manager, create a virtual env using virtualenv
, or preferably using the virtualenvwrapper
utility mkvirtualenv
. For example on Linux, the "system python" is /usr/bin/python3
, /usr/bin/python
, /usr/bin/python2
, etc. Or, as it's clear you're on MacOS, that would likely be a python installed by brew
(homebrew) or port
(macports) in /opt
or /usr/local
. You may have to install virtualenvwrapper
in order to get mkvirtualenv
(and lsvirtualenv
, etc).
In short, if you're using anaconda python, stick with conda
utils. Else, if you're keeping your python free & open (as many of your corp IT data centers do), then use any of the various open utils like mkvirtualenv
, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With