Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Ok, this is totally my fault. I should not have tried to install and compile Python 2.75. After everything went haywire, I saw someone on this site caution against doing this very thing.

I am running Django and it was working fine until the upgrade attempt. I then managed to switch the default version from 2.73 to 2.75 and by doing a make install within the python dir. When I checked the version running the OS said 2.75, so I figured great it worked. NOT SO. Django then stopped working.

I attempted to switch back to 2.73 and that seemed to have worked. However, now I get python errors showing that Django, PIL etc are not installed. So, I thought to try and re-install them and I get these messages "Requirement already satisfied" and that the packages are in the dist-packages dir in the python 2. 7 directory. What happened? How do I fix this?

I have tried creating a running a simple test script containing this code:

    from distutils.sysconfig import get_python_lib
    print(get_python_lib())

and it worked. So, I know python 2.73 is functional, but my libraries including Django do not work still. I tried adding import site; site.getsitepackages() to one of my python scripts that uses PIL and i still get this error:

File "display.py", line 6, in <module>
from imgProcess import imgProcess
File "/var/www/opengov/imageXMLtoCVSTestPY/imgProcess.py", line 3, in <module>
from PIL import Image
ImportError: No module named PIL

I have tried running sudo pip uninstall PIL to see if maybe re-installing it might clear the error. It asks if i want to proceed, naturally i say yes and it says it was removed. Now when i ls /usr/lib/python2.7/dist-packages/PIL I see that it is still there and when i try to sudo pip install PIL, it of course says it is already there. What????

share|improve this question
    
Which version of Ubuntu are you using? –  user68186 May 21 at 16:42
    
I am using Version 12.04 –  Mr. Concolato May 21 at 17:00
    
Is there a way to back-track in version 12.04 without using "Back In Time"? –  Mr. Concolato May 21 at 17:46
1  
Please, stop doing that. You are just digging yourself deeper. –  Braiam May 21 at 18:27
    
@Braiam Doing what exactly? –  Mr. Concolato May 21 at 19:37

1 Answer 1

I have solved the problem using virtualenv.

sudo easy_install virtualenv

Here is a great tutorial on how to set up self-contained python environments with different versions of python as well as different packages. In addition, here is a SO Q&A where they also address the usage of virtualenvwrapper. I hope this aids anyone else who may have gotten a bit too curious for their own good with Django and Python as far as updating and configuration. ;) Oops. Lesson learned. If you find this helpful kindly give it the old thumbs up, thanks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.