Search code examples
pythoneasy-install

Python library issue


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.


Solution

  • 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__