2

I have 2 versions of python - osx's version and the anaconda version.

I am trying to use my system python and the virtualenv pip package to do this.

first:

Alexs-MacBook-Pro-6:kartograph-test alex$ which python
/usr/local/bin/python
Alexs-MacBook-Pro-6:kartograph-test alex$ which virtualenv
/usr/local/bin/virtualenv
Alexs-MacBook-Pro-6:kartograph-test alex$ which pip
/usr/local/bin/pip

So these guys are all in the same place. Additionally, here is my PATH

Alexs-MacBook-Pro-6:kartograph-test alex$ echo $PATH
/usr/local/bin:/Users/alex/anaconda2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Now I here is the command I run as well as the output:

Alexs-MacBook-Pro-6:kartograph-test alex$ virtualenv -p /usr/bin/python2.7 venv
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in venv/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /Users/alex/kartograph-test/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-7.1.0-py2.py3-none-any.whl/pip/__init__.py", line 13, in <module>
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-7.1.0-py2.py3-none-any.whl/pip/utils/__init__.py", line 15, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 6, in <module>
    import io
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: dlopen(/Users/alex/kartograph-test/venv/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
  Referenced from: /Users/alex/kartograph-test/venv/lib/python2.7/lib-dynload/_io.so
  Expected in: dynamic lookup

----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 2363, in <module>
    main()
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1004, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 969, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 910, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/alex/kartograph-test/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1

now when I try and create it with /usr/local/bin/python2.7 I get

Alexs-MacBook-Pro-6:kartograph-test alex$ virtualenv -p /usr/local/bin/python2.7 venv
Running virtualenv with interpreter /usr/local/bin/python2.7
Overwriting venv/lib/python2.7/orig-prefix.txt with new content
New python executable in venv/bin/python2.7
Not overwriting existing python script venv/bin/python (you must use venv/bin/python2.7)
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 2363, in <module>
    main()
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 994, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1427, in install_python
    os.symlink(py_executable_base, full_pth)
OSError: [Errno 17] File exists

Im not sure which one I should be using or which error is more avoidable. All I want is 1 virtualenv that uses python 2.7. Can anyone help me make one?

3
  • you can simply use virtualenv venv Commented Apr 22, 2016 at 20:05
  • delete venv folder before re-creating an env? Commented Apr 22, 2016 at 20:05
  • Maybe this helps? stackoverflow.com/questions/34864038/… Commented Apr 22, 2016 at 20:20

1 Answer 1

2
rm -rf venv
virtualenv venv

You broke the venv folder during your first try, and the second try cannot create because the folder exists. Since the proper python version is in the path, you don't need to specify it.

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

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.