13

Simply trying to create a virtual environment on my mac OSX 10.10.05

Running from the Terminal, already successfully made VirtualEnv on linux and windows OS on other computers.

Tried troubleshooting this by adding a WORK_ON path to my bash profile, did not resolve. Online forums doesn't seem to address this, suggestions are to use mkvirtualenv which does not seem to be a downloadable package per pip, conda and easy_install...

Anyways, if you're able to help that would be super appreciated.

here's the terminal output:

joshua ~ $ pip install --upgrade virtualenv
Requirement already up-to-date: virtualenv in ./anaconda/lib/python3.5/site-packages
joshua ~ $ virtualenv -p python3 test
Running virtualenv with interpreter /Users/joshua/anaconda/bin/python3
Using base prefix '/Users/joshua/anaconda'
New python executable in /Users/joshua/test/bin/python3
Also creating executable in /Users/joshua/test/bin/python
ERROR: The executable /Users/joshua/test/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/Users/joshua' (should be '/Users/joshua/test')
ERROR: virtualenv is not compatible with this system or executable

...tried uninstalling virtualenv

  Successfully uninstalled virtualenv-15.1.0
joshua ~ $ pip install virtualenv
Collecting virtualenv
  Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
Successfully installed virtualenv-15.1.0
joshua ~ $ virtualenv test -v
Using base prefix '/Users/joshua/anaconda'
Creating /Users/joshua/test/lib/python3.5
Symlinking Python bootstrap modules
  Symlinking /Users/joshua/test/lib/python3.5/config-3.5m
  Symlinking /Users/joshua/test/lib/python3.5/lib-dynload
  Symlinking /Users/joshua/test/lib/python3.5/plat-darwin
  Symlinking /Users/joshua/test/lib/python3.5/os.py
  Ignoring built-in bootstrap module: posix
  Symlinking /Users/joshua/test/lib/python3.5/posixpath.py
  Cannot import bootstrap module: nt
  Symlinking /Users/joshua/test/lib/python3.5/ntpath.py
  Symlinking /Users/joshua/test/lib/python3.5/genericpath.py
  Symlinking /Users/joshua/test/lib/python3.5/fnmatch.py
  Symlinking /Users/joshua/test/lib/python3.5/locale.py
  Symlinking /Users/joshua/test/lib/python3.5/encodings
  Symlinking /Users/joshua/test/lib/python3.5/codecs.py
  Symlinking /Users/joshua/test/lib/python3.5/stat.py
  Cannot import bootstrap module: UserDict
  Cannot import bootstrap module: copy_reg
  Symlinking /Users/joshua/test/lib/python3.5/types.py
  Symlinking /Users/joshua/test/lib/python3.5/re.py
  Cannot import bootstrap module: sre
  Symlinking /Users/joshua/test/lib/python3.5/sre_parse.py
  Symlinking /Users/joshua/test/lib/python3.5/sre_constants.py
  Symlinking /Users/joshua/test/lib/python3.5/sre_compile.py
  Cannot import bootstrap module: _abcoll
  Symlinking /Users/joshua/test/lib/python3.5/warnings.py
  Symlinking /Users/joshua/test/lib/python3.5/linecache.py
  Symlinking /Users/joshua/test/lib/python3.5/abc.py
  Symlinking /Users/joshua/test/lib/python3.5/io.py
  Symlinking /Users/joshua/test/lib/python3.5/_weakrefset.py
  Symlinking /Users/joshua/test/lib/python3.5/copyreg.py
  Symlinking /Users/joshua/test/lib/python3.5/tempfile.py
  Symlinking /Users/joshua/test/lib/python3.5/random.py
  Symlinking /Users/joshua/test/lib/python3.5/__future__.py
  Symlinking /Users/joshua/test/lib/python3.5/collections
  Symlinking /Users/joshua/test/lib/python3.5/keyword.py
  Symlinking /Users/joshua/test/lib/python3.5/tarfile.py
  Symlinking /Users/joshua/test/lib/python3.5/shutil.py
  Symlinking /Users/joshua/test/lib/python3.5/struct.py
  Symlinking /Users/joshua/test/lib/python3.5/copy.py
  Symlinking /Users/joshua/test/lib/python3.5/tokenize.py
  Symlinking /Users/joshua/test/lib/python3.5/token.py
  Symlinking /Users/joshua/test/lib/python3.5/functools.py
  Symlinking /Users/joshua/test/lib/python3.5/heapq.py
  Symlinking /Users/joshua/test/lib/python3.5/bisect.py
  Symlinking /Users/joshua/test/lib/python3.5/weakref.py
  Symlinking /Users/joshua/test/lib/python3.5/reprlib.py
  Symlinking /Users/joshua/test/lib/python3.5/base64.py
  Symlinking /Users/joshua/test/lib/python3.5/_dummy_thread.py
  Symlinking /Users/joshua/test/lib/python3.5/hashlib.py
  Symlinking /Users/joshua/test/lib/python3.5/hmac.py
  Symlinking /Users/joshua/test/lib/python3.5/imp.py
  Symlinking /Users/joshua/test/lib/python3.5/importlib
  Symlinking /Users/joshua/test/lib/python3.5/rlcompleter.py
  Symlinking /Users/joshua/test/lib/python3.5/operator.py
  Symlinking /Users/joshua/test/lib/python3.5/_collections_abc.py
  Symlinking /Users/joshua/test/lib/python3.5/_bootlocale.py
Creating /Users/joshua/test/lib/python3.5/site-packages
Writing /Users/joshua/test/lib/python3.5/site.py
Writing /Users/joshua/test/lib/python3.5/orig-prefix.txt
Writing /Users/joshua/test/lib/python3.5/no-global-site-packages.txt
Creating parent directories for /Users/joshua/test/include
Symlinking /Users/joshua/test/include/python3.5m
Creating /Users/joshua/test/bin
New python executable in /Users/joshua/test/bin/python
Changed mode of /Users/joshua/test/bin/python to 0o755
Testing executable with /Users/joshua/test/bin/python -c "import sys;out=sys.stdout;getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))"
ERROR: The executable /Users/joshua/test/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Users/joshua' (should be '/Users/joshua/test')
ERROR: virtualenv is not compatible with this system or executable

here's current bash_profile:

# Enable tab completion
source ~/git-completion.bash

# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"

# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"

alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"

# Add Path
export PATH="$HOME/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH"
# export PATH=$PATH:/users/Joshua/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

# Locale 
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
5
  • 4
    there is an answer to similar question: stackoverflow.com/questions/23842713/… the bottom line, upgrade virtualenv: pip install --upgrade virtualenv Commented Jun 15, 2017 at 20:10
  • Requirement already up-to-date: virtualenv in ./anaconda/lib/python3.5/site-packages :/ Commented Jun 15, 2017 at 20:16
  • what do which pip and which virtualenv say? It looks like you're invoking two different Python interpreters. Commented Jun 15, 2017 at 21:06
  • @9000 joshua ~ $ which python /Users/joshua/anaconda/bin/python joshua ~ $ which python3 /Users/joshua/anaconda/bin/python3 joshua ~ $ which pip /Users/joshua/anaconda/bin/pip joshua ~ $ which virtualenv /Users/joshua/anaconda/bin/virtualenv Commented Jun 16, 2017 at 16:17
  • 2
    @9000, I got it to work... had to uninstall virtualenv with pip, and reinstall virtualenv with conda. I don't know why this resolved the issue, but as a learning exercise (for me + others maybe), do you guys have any idea why? Commented Jun 18, 2017 at 21:16

2 Answers 2

33

My limited undestanding is that my python interpreter and packages are managed under Anaconda using Conda package manager, and my virtualenv was originally installed using pip..

uninstalling virtualenv with pip and re-installing with conda fixed the issue

pip uninstall virtualenv

conda install virtualenv
Sign up to request clarification or add additional context in comments.

Comments

1

I had this same issue when trying to install py2.7 on a newer system. The root issue was that virtualenv was part of py3.7 and thus was not compatible:

$  virtualenv -p python2.7 env
Running virtualenv with interpreter /usr/local/bin/python2.7
New python executable in /Users/blah/env/bin/python
ERROR: The executable /Users/blah/env/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/Library/Frameworks/Python.framework/Versions/2.7' (should be u'/Users/blah/env')
ERROR: virtualenv is not compatible with this system or executable

$ which virtualenv
/Library/Frameworks/Python.framework/Versions/3.7/bin/virtualenv

# install proper version of virtualenv 
$ pip2.7 install virtualenv

$ /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv -p python2.7 env

$ . ./env/bin/activate
(env) $ 

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.