When I used the command virtualenv venv to create the Python virtual environment, the following error occurred:
D:\Flask>virtualenv venv
Using base prefix 'd:\\APP\\python'
New python executable in D:\Flask\venv\Scripts\python.exe
Installing setuptools, pip, wheel...
Complete output from command D:\Flask\venv\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ImportError: No module named 'pkgutil'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "d:\APP\python\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "d:\APP\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\APP\python\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "d:\APP\python\lib\site-packages\virtualenv.py", line 713, in main
symlink=options.symlink)
File "d:\APP\python\lib\site-packages\virtualenv.py", line 945, in create_environment
download=download,
File "d:\APP\python\lib\site-packages\virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "d:\APP\python\lib\site-packages\virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command D:\Flask\venv\Scripts\python.exe - setuptools pip wheel failed with error code 1
I googled it but didn't find a solution. Does anyone know how to deal with it?
use python -m venv path/to/your/venv to create a virtual environment and then activate it with path/to/your/venv/Scripts/activate.bat (deactivate for quitting the venv)
example:
python -m venv test
test\Scripts\activate.bat
(test) deactivate
Related
I have an Error while creating virtual environmenr on Python 3.73 in Windows 7.
During creation of new virtual environment I am getting error like below.
Can somebody help me with this. I have already searched tonns of info and nothing helps me out.
Thanks in advance
Using base prefix 'C:\\Users\\Саша\\AppData\\Local\\Programs\\Python\\Python37-32'
New python executable in C:\Users\Саша\myenv\Scripts\python.exe
Command C:\Users\Саша\myenv\Scripts\python.exe -m pip config list had error code 1
Installing setuptools, pip, wheel...
Complete output from command C:\Users\Саша\myenv\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ModuleNotFoundError: No module named 'pkgutil'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "C:\Users\Саша\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as
"__main__", mod_spec)
File "C:\Users\Саша\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 2635, in <module>
main()
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 870, in main
symlink=options.symlink,
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 1173, in create_e
install_wheel(to_install, py_executable, search_dirs, download=download)
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 1019, in install_
_install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 1110, in _install
arch_dir
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 963, in call_subp
raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command C:\Users\Саша\myenv\Scripts\python.exe - setuptools pip wheel failed with error code 1
Try it with removing python to 'c:\python37' from appdata. It cuz you have unicode chars in the path name.
I am attempting to use virtualenvwrapper to create a virtual environment using a specific local python interpreter:
mkvirtualenv -p /home/nelse003/software/ccp4-linux64-2016-10-22-0115/libexec/python2.7 ccp4-python-env`
But it fails to create the virtual environment:
Running virtualenv with interpreter /home/nelse003/software/ccp4-linux64-2016-10-22-0115/libexec/python2.7
New python executable in /home/nelse003/.virtualenvs/ccp4-python-env/bin/python2.7
Not overwriting existing python script /home/nelse003/.virtualenvs/ccp4-python-env/bin/python (you must use /home/nelse003/.virtualenvs/ccp4-python-env/bin/python2.7)`
Installing setuptools, pip, wheel...`
Complete output from command /home/nelse003/.virt...on-env/bin/python2.7 - setuptools pip wheel:`
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 28, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 36, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/utils/glibc.py", line 4, in <module>
File "/home/nelse003/software/ccp4-linux64-2016-10-22-0115/lib/python2.7/ctypes/__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
ImportError: /home/nelse003/.virtualenvs/ccp4-python-env/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: PyUnicodeUCS2_FromUnicode`
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2328, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 713, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 945, in create_environment
download=download,
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/nelse003/.virt...on-env/bin/python2.7 - setuptools pip wheel failed with error code 1
Is this error related to the version of python I an trying to use for the virtual environment?
When I used the command virtualenv venv to create the Python virtual environment, the following error occurred:
D:\Flask>virtualenv venv
Using base prefix 'd:\\APP\\python'
New python executable in D:\Flask\venv\Scripts\python.exe
Installing setuptools, pip, wheel...
Complete output from command D:\Flask\venv\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ImportError: No module named 'pkgutil'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "d:\APP\python\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "d:\APP\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\APP\python\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "d:\APP\python\lib\site-packages\virtualenv.py", line 713, in main
symlink=options.symlink)
File "d:\APP\python\lib\site-packages\virtualenv.py", line 945, in create_environment
download=download,
File "d:\APP\python\lib\site-packages\virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "d:\APP\python\lib\site-packages\virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command D:\Flask\venv\Scripts\python.exe - setuptools pip wheel failed with error code 1
I googled it but didn't find a solution. Does anyone know how to deal with it?
use python -m venv path/to/your/venv to create a virtual environment and then activate it with path/to/your/venv/Scripts/activate.bat (deactivate for quitting the venv)
example:
python -m venv test
test\Scripts\activate.bat
(test) deactivate
I'm trying to follow the directions on the Flask installation website but I encountered an error after I used "sudo easy_install virtualenv" to install virtual environment. Not sure
Opals-MacBook-Pro:~ opalkale$ mkdir myproject
Opals-MacBook-Pro:~ opalkale$ cd myproject
Opals-MacBook-Pro:myproject opalkale$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools, pip...
Complete output from command /Users/opalkale/myproject/venv/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/__init__.py", line 9, in <module>
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/log.py", line 8, in <module>
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 2696, in <module>
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 429, in __init__
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 443, in add_entry
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1722, in find_in_zip
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1298, in has_metadata
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1614, in _has
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1488, in _zipinfo_name
AssertionError: /Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/EGG-INFO/PKG-INFO is not a subpath of /Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.11', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 820, in main
symlink=options.symlink)
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 988, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 956, in install_wheel
'PIP_NO_INDEX': '1'
File "/Library/Python/2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 898, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/opalkale/myproject/venv/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1
This is logged as an issue with the recently released virtualenv 1.11. I had similar issues on Windows with this release.
I believe installing virtualenv 1.10.1 will let you continue working until this issue is addressed.
As timborden said in a comment: version 1.11.2 (of 2014-01-26) fixes this.
"Fixed easy_install installed virtualenvs by updated pip to 1.5.2"
See changelog at: https://pypi.python.org/pypi/virtualenv
$ sudo virtualenv test
Password:
Sorry, try again.
Password:
New python executable in test/bin/python
Installing setuptools.............done.
Installing pip....
Complete output from command /Users/hhimanshu/test/bin/python -x /Users/hhimanshu/test/bin/easy_install /Library/Python/2.7/...ort/pip-1.2.1.tar.gz:
/Users/hhimanshu/test/bin/python: can't open file '/Users/hhimanshu/test/bin/easy_install': [Errno 2] No such file or directory
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.8.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 942, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1054, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 655, in install_pip
filter_stdout=_filter_setup)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1020, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/hhimanshu/test/bin/python -x /Users/hhimanshu/test/bin/easy_install /Library/Python/2.7/...ort/pip-1.2.1.tar.gz failed with error code 2
How did you install virtualenv? This works for me using explicit paths:
sudo /usr/bin/easy_install-2.7 virtualenv
/usr/local/bin/virtualenv-2.7 test