Virtualenv OSError - setuptools pip wheel failed w

2019-01-25 13:52发布

I get the following error message when trying to set up a virtual environment with virtualenv 15.0.2 but receive OSError setuptools pip wheel failed with error code 1.

New python executable in /Users/nathmorissette/projects/tutorial/venv/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /Users/nathmorissett...rial/venv/bin/python - setuptools pip wheel:
  Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "/Users/nathmorissette/miniconda2/lib/python2.7/tempfile.py", line 32, in <module>
    import io as _io
  File "/Users/nathmorissette/miniconda2/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: dlopen(/Users/nathmorissette/projects/tutorial/venv/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
  Referenced from: /Users/nathmorissette/projects/tutorial/venv/lib/python2.7/lib-dynload/_io.so
  Expected in: dynamic lookup

----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Users/nathmorissette/miniconda2/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==15.0.2', 'console_scripts', 'virtualenv')()
  File "/Users/nathmorissette/miniconda2/lib/python2.7/site-packages/virtualenv-15.0.2-py2.7.egg/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/Users/nathmorissette/miniconda2/lib/python2.7/site-packages/virtualenv-15.0.2-py2.7.egg/virtualenv.py", line 944, in create_environment
    download=download,
  File "/Users/nathmorissette/miniconda2/lib/python2.7/site-packages/virtualenv-15.0.2-py2.7.egg/virtualenv.py", line 900, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/Users/nathmorissette/miniconda2/lib/python2.7/site-packages/virtualenv-15.0.2-py2.7.egg/virtualenv.py", line 795, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/nathmorissett...rial/venv/bin/python - setuptools pip wheel failed with error code 1

Any ideas how to resolve this issue?

10条回答
Animai°情兽
2楼-- · 2019-01-25 14:19

I had the same error even with no anaconda installed. After a few minutes i realized that i was trying to create a virtualenv folder (C:/myname/virtual_folder) at the same directory level as was my Python installation folder (C:/myname/python27) .

So I just created a folder and then inside of it (C:/myname/prefolder/..) i run ("virtualenv virtual_folder") with no issues .

查看更多
聊天终结者
3楼-- · 2019-01-25 14:23

You can save yourself from all this hustle by just downloading latest version of python, install it before you begin openstack or devstack installation. Go to https://www.python.org/downloads/. Installing latest version of python will replace the older version and install all the libraries you need. This saved me four days of trying to install devstack

查看更多
贪生不怕死
4楼-- · 2019-01-25 14:27

I finally resorted to using conda to set up an environment rather than virtualenv. Apparently virtualenv is not compatible with anaconda.

Info in this link helped me set it up:

https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/

查看更多
Viruses.
5楼-- · 2019-01-25 14:30

Running

conda install -c anaconda virtualenv=15.1.0 

worked for me.

This is because virtualenv doesnt work with pip while conda exists on your system.

查看更多
登录 后发表回答