views:

212

answers:

3

Hello,

when I try to create a virtualenv that uses python2.5 I get the following error:

File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1489, in <module>main()
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 526, in main use_distribute=options.use_distribute)
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 609, in create_environment
site_packages=site_packages, clear=clear))
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 672, in install_python fix_lib64(lib_dir)
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 891, in fix_lib64
if [p for p in distutils.sysconfig.get_config_vars().values()
File "/usr/lib/python2.5/distutils/sysconfig.py", line 499, in get_config_vars func() 
File "/usr/lib/python2.5/distutils/sysconfig.py", line 351, in _init_posix filename = get_makefile_filename()
File "/usr/lib/python2.5/distutils/sysconfig.py", line 210, in get_makefile_filename
return os.path.join(lib_dir, "config" + (sys.pydebug and "_d" or ""), "Makefile")
AttributeError: 'module' object has no attribute 'pydebug'

I get this error by doing this command:

virtualenv -p python2.5 .

Because Ubuntu10.04 doesn't come with Python2.5 I installed it from: https://launchpad.net/~fkrull/+archive/deadsnakes

First I thought that I should installed virtualenv for Python2.5 also but that doesn't seem to work either. If I try to create a virtualenv with the following command:

sudo Python2.5 /usr/lib/python2.5/site-packages/virtualenv.py .

I end up getting the same error. I am kinda new to Ubuntu and Python and there are stil a few blank spot. Like if you have two version of Python, for Python2.6 I can just do virtualenv . But I guess to use the 2.5 one I have to call it directly like I did in the sudo command above?

Or is it completely wrong and all virtualenvs are the same and can be used with different Python versions?

Anyway my main question is how I can fix the error so I can setup a virtualenv using Python2.5. Any extra information is appreciated.

+1  A: 

You don't need two virtualenvs installed. You can tell virtualenv which python to use by using the --python argument as follows:

virtualenv --python=python2.5 <my-venv>
Matthew Rankin
Crap, guess I didn't mention how I got the first error. It was by doing that cmd. I'll update my question. You answered my side question though so thank you for that.
Pickels
A: 
sudo easy_install-2.5 virtualenv

will give you a python 2.5-specific virtualenv. Invoke it using virtualenv-2.5. You may need to apt-get install setuptools first if you don't have easy_install.

Ivo van der Wijk
That's how I got virtualenv install on Python2.5.
Pickels
A: 

I had some other Python 2.5 installed. I forgot the name but something like Python 2.5 minimal and it gave some problems with the deadsnakes install. When I uninstall it everything started working fine.

Pickels