2

I have a very peculiar issue with Python library. I downloaded the a python library source, changed some code and used python setup.py install to install the library. The original library was already installed with easy_install. Later on I further changed some source code and called the command python setup.py install again. When I use the library in code, I randomly get different versions of the library being called. I am not able to fully uninstall the library too, even though by both easy_install -m and pip both say uninstall successful, the library persists.

The environment is Ubuntu 11.04

Edit: When I call the same function from Python commandLine the latest build is called, but when I call python myfile.py which uses the library it calls an older build.

2
  • @GWW I am running it on Amazon server. Cannot afford a reboot Commented Dec 19, 2011 at 7:26
  • 1
    When you say random, do you really mean random? i.e. can you run the same program multiple times in the exact same way and get different versions of the library used? Anyway, to find out where the library is being loaded from you can print the value of library.__file__ and this should give you the directory the library is loaded from if you want to delete it. Commented Dec 19, 2011 at 7:34

1 Answer 1

1

An installer typically loads a third-party library code in the site-packages directory. You can go to that directory and delete the library (that will include new and old versions). Then you can do a fresh install (using setup.py on your edited source).

If the library is somewhere else on the path, you can find it with:

>>> import somelib
>>> print somelib.__file__
Sign up to request clarification or add additional context in comments.

2 Comments

Used somelib.__file__ to recursely to find different every version of the library installed. Deleted each of them and used python setup.py install again.
nice, or inspect.getabsfile(somelib)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.