Question

I've installed A LOT of python packages for Python 2.6. Now I would like to upgrade Python to 2.7. Is there a proper or systematic way to update all the installed packages?

In my system, all the packages are installed at /usr/lib64/python2.6/site-packages/ and /usr/lib/python2.6/site-packages/

One obvious way is to install Python 2.7, download all the package sources or egg files, and re-install them one by one. However, Some useful packages like numpy and scipy are notorious for installation, especially when one needs to install from source. I expect I'll need to spend several hours to find the packages and solve the installation problems here and there.

Anyone has any suggestions on systematically update the installed packages?

Was it helpful?

Solution

First, you should not never ever ever ever install Python packages in in system library folder with easy_install using sudo on any operating system.

http://jamiecurle.co.uk/blog/installing-pip-virtualenv-and-virtualenvwrapper-on-os-x/#comment-573429347

The correct procedure would be make your installation procedure repeatable. There exist two commonly used solutions in Python world. These solutions automatically download correct versions of Python packages from http://pypi.python.org

PIP

pip and requirements.txt http://www.pip-installer.org/en/latest/requirements.html within virtualenv http://pypi.python.org/pypi/virtualenv

Buidout

Buildout, example from Plone CMS https://github.com/plone/Installers-UnifiedInstaller/blob/master/base_skeleton/versions.cfg

Buildout can also do configure, make, make install style installations for packages which need native libraries. For example there exist solution for libxml2 + lxml

http://pypi.python.org/pypi/z3c.recipe.staticlxml/

(Note: buildout does not need virtualenv as it does its own isolation from system Python)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top