I'm trying to set-up a virtualenv with Python 2.6.6 on CentOS 5. I've already Python 2.6.6 installed in my home directory, working well.
However, when I try to set-up a virtualenv, I got the following error (cf. end for full log):
ImportError: No module named _md5
By looking at other threads, this errors occurs when changing python version on existing virtual env, which is not my case: I trying to create a new one.
Because this error occurs when installing setuptools, I juste commented few lines in virtualenv.py source (around l.907), so it's just installing Python. Then, creation of virtualenv is fine, however, many core Python libraries are missing.
# Creating virtualenv
$ pwd
/home/myhome/tmp/virtualenv-1.6.4
$ python virtualenv.py --no-site-packages myenv
New python executable in myenv/bin/python
# Loading module outside virtualenv
$ python -c 'import time'
# Loading module inside virtualenv
$ source ve/bin/activate
$ python -c 'import time'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named time
I really don't get the point! Python libraries are just files to copy, right?
Full log:
$ virtualenv --no-site-packages myenv
New python executable in myenv/bin/python2.6
Also creating executable in myenv/bin/python
Installing setuptools.............
Complete output from command /home/myhome/myenv/bin/python2.6 -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" --always-copy -U setuptools:
-c:67: DeprecationWarning: the md5 module is deprecated; use hashlib instead
Traceback (most recent call last):
File "<string>", line 67, in <module>
File "/home/myhome/lib/python2.6/md5.py", line 10, in <module>
from hashlib import md5
File "/home/myhome/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/home/myhome/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
File "/home/myhome/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.6.4', 'console_scripts', 'virtualenv')()
File "/home/myhome/lib/python2.6/site-packages/virtualenv-1.6.4-py2.6.egg /virtualenv.py", line 810, in main
never_download=options.never_download)
File "/home/myhome/lib/python2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 910, in create_environment
search_dirs=search_dirs, never_download=never_download)
File "/home/myhome/lib/python2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 603, in install_setuptools
search_dirs=search_dirs, never_download=never_download)
File "/home/myhome/lib/python2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 577, in _install_req
cwd=cwd)
File "/home/myhome/lib/python2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 878, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/myhome/myenv/bin/python2.6 -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" --always-copy -U setuptools failed with error code 1
AFAIK _md5 depends on some openssl packages. You should install them first.
You may also find this thread useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With