For Python programmers, is there anything equivalent to Perl's CPAN?

Question:

I’m learning Python now because of the Django framework. I have been a Perl programmer for a number of years and I’m so used to Perl’s tools. One of the things that I really miss is Perl’s CPAN and its tools. Is there anything equivalent in Python? I would like to be able to search, install and maintain Python modules as easy as CPAN. Also, a system that can handle dependencies automatically. I tried to install a module in Python by downloading a zip file from a website, unzipped it, then do:

sudo python setup.py install

but it’s looking for another module. Now, lazy as I am, I don’t like chasing dependencies and such, is there an easy way?

Asked By: sammydc

||

Answers:

sammy, have a look at pip, which will let you do “pip install foo”, and will download and install its dependencies (as long as they’re on PyPI). There’s also EasyInstall, but pip is intended to replace that.

Answered By: llimllib

It might be useful to note that pip and easy_install both use the Python Package Index (PyPI), sometimes called the “Cheeseshop”, to search for packages. Easy_install is currently the most universally supported, as it works with both setuptools and distutils style packaging, completely. See James Bennett’s commentary on python packaging for good reasons to use pip, and Ian Bicking’s reply for some clarifications on the differences.

Answered By: alif

If you do use easy_install, I’d suggest installing packages by doing..

easy_install -v -Z package_name  |  tee date-package.log

-Z (short for --always-unzip) unzips the .egg files to directories so you can then..

less *.egg/EGG-INFO/requires.txt  
less *.egg/EGG-INFO/PKG-INFO  
egrep '^(Name|Version|Sum|...)'  *.egg/EGG-INFO/PKG-INFO

On Sammy’s original question, a couple of package indexes other than PyPI are:
Scipy
and Scipy docs for scientific computing
ohloh with code metrics.

Answered By: denis
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.