Error while creating django virtual environment - python

When I was trying to create a virtual django env. with "virtualenv --no-site-packages django", I was getting error as follows,
New python executable in django/bin/python
Installing setuptools, pip...
Complete output from command /home/krishna/KRISHN...on/django/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 "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/log.py", line 8, in <module>
ImportError: No module named pkg_resources
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==1.11', 'console_scripts', 'virtualenv')()
File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 820, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 988, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 956, in install_wheel
'PIP_NO_INDEX': '1'
File "/usr/local/lib/python2.7/dist-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 898, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/krishna/KRISHN...on/django/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1***

Related

Error while creating the virtual environment [duplicate]

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

Using virtualenvwrapper with non-system version of python

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?

Error when using the command "virtualenv venv" to create Python 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

Cannot create virtualenv instance in python 2.7.5 because of pip installation error

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

virtualenv: could not create '/lib/python2.7': Permission denied

What could be wrong here?
user#linux> virtualenv foobar
....
error: could not create '/lib/python2.7': Permission denied
----------------------------------------
...Installing Setuptools...done.
Traceback (most recent call last):
File "/usr/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==1.10.1', 'console_scripts', 'virtualenv')()
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 821, in main
symlink=options.symlink)
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 961, in create_environment
install_sdist('Setuptools', 'setuptools-*.tar.gz', py_executable, search_dirs)
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 932, in install_sdist
filter_stdout=filter_install_output)
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 899, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/modwork_guf_dfj/foobar/bin/python setup.py install --single-version-externally-managed --record record failed with error code 1
virtualenv --version
1.10.1
Answering my own question.
in ~/.pydistutils.cfg an empty prefix was set. After commenting this prefix, creating the virtualenv worked.
#http://stackoverflow.com/questions/4495120/combine-user-with-prefix-error-with-setup-py-install
#[install]
#prefix=

Categories

Resources