views:

74

answers:

3

How can i quickly migrate/copy my python packages that i have installed over time to a new machine?

This is my scenario;

Am upgrading from an old laptop running python2.5 & Django1.0, to a new laptop which i intend to install python 2.6.2 & Django 1.1. In time i have downloaded and installed many python packages in my old machine(e.f pygame,pyro genshi,py2exe bla bla bla many...), is there an easier way i can copy my packages to the new laptop without running installation file for each individual package?

Gath

+2  A: 

If they're pure Python, then in theory you could just copy them across from one Lib\site-packages directory to the other. However, this will not work for any packages which include C extensions (as these need to be recompiled anew for every Python version). You also need to consider e.g. .pth files which have been created by the installation packages, deleting pre-existing .pyc files etc.

I'd advise just reinstalling the packages.

Vinay Sajip
+1: Keep a complete list. If you can use `easy_install`, your complete list can be a simple `easy_install` script.
S.Lott
+1  A: 

As Vinay says, there are some parts of common installations that can't be just copied over. Also, keep in mind that setup.py scripts can perform arbitrary work, for example, they could test for the version of Python, and change how they install things, or they could write registry entries, or create .rc files, etc.

I concur: re-install the packages. The time you save by trying to just copy everything over will be completely lost the first time something mysteriously doesn't work and you try to debug it.

Also, another benefit to re-installation: if you only do it when you need the package, then you won't bother reinstalling the packages you no longer need.

Ned Batchelder
A: 

Use Portable Python then you can have everything on your USB stick. Your entire development environment always in your pocket, just plug it in in ANY pc and start coding.

You can even have multiple versions of Portable Python on same USB stick and run them side by side which helps if you e.g. are busy with transition to Python 3.* or just want to experiment.

Perica Zivkovic