Product Documentation

ActivePython 2.6 Documentation

You are here: ActivePython User Guide » PyPM Tutorial

PyPM Tutorial

Welcome to the PyPM tutorial.

What is PyPM?

PyPM is the package management utility for ActivePython. It simplifies the task of locating, installing, upgrading and removing Python modules. The PyPM client accesses PyPM repositories (collections of packages) on the internet or on a local network.

Setup

PyPM is installed automatically with ActivePython.

To use PyPM, your computer must be connected to the internet (to access the ActiveState PyPM repository), or have access to a PyPM repository on a local hard drive or network share.

If you connect to the internet through a firewall or proxy, you may need to set the http_proxy environment variable (see Proxies and Firewalls).

All PyPM operations are performed at the command line.

Note

On Windows systems with more than one Python interpreter, ActivePython's Python directory must come before other Python installations in your %PATH% environment variable.

For example, if you installed another version of Python in C:\Python26 and ActivePython in E:\Apps\Python26, then your %PATH% should have E:\Apps\Python26 listed before C:\Python26.

Package Management

Finding packages

Use the the search command to find the package you are looking for. This returns substring matches in the name or description:

C:\> pypm search django url
django-localeurl-1.3-1   A Django application that
django-shorturls-1.0.1-1 A short URL (rev=cannonical)
django-auto-urls-0.1-1   Django app that try to load
...

Installing packages

Installing packages is simple:

C:\> pypm install pylons

This command will download pylons and its depdendencies automatically. Packages are not installed into the ActivePython installation directory. Instead, PyPM follows the PEP 370 specification and installs packages by default in ~/.local on Unix and Mac and %APPDATA%\Python on Windows; and the Python interpreter (2.6 and above) automatically picks up the local packages.

Note

The install command upgrades packages to newly available versions automatically.

Removing packages

To remove a package:

C:\> pypm remove mako

Removing a package will automatically remove other packages that depend upon that package.

Showing package details

The 'list' command shows the currently installed packages:

C:\> pypm list
jsontools  0.1-1   jsontools - Useful utilities for JSON
simplejson 2.0.9-1 Simple, fast, extensible JSON encoder/decoder for Python
paste      1.7.2-1 Tools for using a Web Server Gateway Interface stack
...

The 'show' command displays information about a specified package in the repository:

C:\> pypm show mako
Name: mako
Version: 0.2.5-1
Author: Mike Bayer <mike@zzzcomputing.com>
Description: A super-fast templating language that borrows the
best ideas from the existing templating languages.
Home Page: http://www.makotemplates.org/
License: MIT
Dependencies: Beaker>=1.1
Status: Not installed

The 'files' command displays all files installed by a specified package:

$ pypm files mako
/home/user/.local/bin
/home/user/.local/bin/mako-render
/home/user/.local/lib
...

Other commands

The 'help' command provides details on specific sub commands. Abbreviations for the command is shown in parentheses:

C:\> pypm help list
list (l): List the currently installed packages

Usage:
    pypm list

The 'info' command shows the PyPM version, Python version, platform and repositories:

$ pypm info
PyPM 0.1b1 <...>
ActivePython (2.6.2, 5, r2833-trunk) built on Tue Apr 21 14:41:05 2009
Installation target: Python 2.6 <...</opt/ActivePython-2.6/bin/python,/home/user/.local>>
Platform: linux-x86
Repositories: ['http://pypm.activestate.com/root/2.6/linux-x86']
Log file: /home/user/.pypm/pypm.log
Repository index cache: /home/user/.pypm/idx
Download cache: /home/user/.pypm/download-cache

Virtualenv support

PyPM supports virtualenv (a tool for creating isolated Python environments) with the -E option:

C:\> virtualenv C:\myvirtualenv
C:\> pypm -E C:\myvirtualenv install pylons

Note

To use virtualenv on Mac OS X, you will need to have Xcode installed.

Repository management

Documentaiton for the following is coming soon:

  1. hosting repositories using the pypm-repository command
  2. specifying additional repositories using pypm -L

Proxies and Firewalls

If you connect to the internet through a proxy server, you may need to set the http_proxy environment variable.

Set the http_proxy variable with the hostname or IP address of the proxy server:

http_proxy=http://proxy.example.org

If the proxy server requires a user name and password, include them in the following form:

http_proxy=http://username:password@proxy.example.org

If the proxy server uses a port other than 80, include the port number:

http_proxy=http://username:password@proxy.example.org:8080

Package status

The build status of all packages in the ActiveState repository can be seen at:

http://pypm.activestate.com

Each package, has an icon representing the target platform (Windows, Mac OS X, or Linux) which links to the build logs. If the icon has a red background, the build has failed; clicking the icon will show you why.

If a package is missing altogether, it might be because the package does not have complete metadata in it's source (e.g. Twisted-8.2.0 lacks a PKG-INFO file)

Roadmap

This is a beta relese of PyPM. There is currently no GUI and there may be some bugs.

Some important modules, like SciPy and Matplotlib, are not currently available from the ActiveState repository, but we're working to make these available as soon as possible.

We have plans for several improvements: support for installing eggs, source packages, and even a buildout receipe!

Credits

PyPM would not be possible without the generous support of the following open source Python modules: