"virtualenv is not compatible with this system or executable" using virtual env and anaconda

I try to run virtual env using virtualenv, I get 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 run is mkvirtualenv -a . --no-site-packages --python='which python3' -r requirements.txt bodega mkvirtualenv -a . --no-site-packages --python='which python3' -r requirements.txt bodega

Currently, my .bashrc as follows:

 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 a problem with the anaconda and virtualenv that causes the problem here, but I'm not sure how to fix it, or if it's just a red herring.

+5
source share
2 answers

If you are using the conda python executable, use conda create --name {your_venv} python=3 (note that there is a virtualenv utility that comes with conda, but use conda create... to create new virtual conda create... anyway).

Otherwise, if you are using the python version installed by the system package manager, create a virtual env using virtualenv or, preferably, using the virtualenvwrapper mkvirtualenv . For example, on Linux, “system python” has the value /usr/bin/python3 , /usr/bin/python , /usr/bin/python2 , etc. Or, as it became clear, you are on MacOS, it will probably be python installed by brew (homebrew) or port (macports) in /opt or /usr/local . You may need to install virtualenvwrapper to get mkvirtualenv (and lsvirtualenv , etc.).

In short, if you are using python anaconda, stick with conda utils. Also, if you keep your python free and open (as many IT centers in your enclosure do), use any of various open utils like mkvirtualenv , etc.

+1
source

Hope this can help people still look at this question, but it's easy to fix:

 conda install -y virtualenv 
0
source

All Articles