Managing ActivePython packages with Pip
Pip is the recommended tool for installing and maintaining packages for Python, and it is now the package manager for ActivePython. It simplifies the task of locating, installing, and upgrading Python packages.
Pip is installed automatically with ActivePython. To use Pip, your computer must be connected to the internet, or have access to a pip repository on a network share. All Pip operations are performed at the command line, or through integration with Komodo, or another IDE.
Note: For older versions of ActivePython, ActiveState continues to maintain the PyPM Index, a repository for installing packages for ActivePython. The latest releases of all ActivePython versions do not include the PyPM tools, because Pip is the recommended package manager. For more information on ActiveState languages and supported package managers, see Good things come in managed packages.
Displaying information about installed packages
You can display a list of packages and versions installed by ActivePython using the
pip freeze command.
python -m pip freeze
You can write the output of the to a file, which can be used to recreate your environment on a different machine:
python -m pip freeze > requirements.txt
You can view complete details for any package, including dependencies and file locations:
python -m pip show --files django
You can search the Python Package Index for package names or descriptions. By default, pip searches for packages available from the Python Package Index. The repository includes over 100 000 packages.
python -m pip search <query>
You can alternatively search for and browse packages on the PyPI website.
You can use Pip to install additional packages you require that are not included in the ActivePython distribution.
python -m pip install <package>
pip install <package>
If you need the latest version of a package, you can upgrade the existing package using the following syntax:
python -m pip install --upgrade <package>
You can also specify a specific version to upgrade to. For example:
python -m pip install --upgrade <package>==<version>
ActivePython, pip, and virtualenv
If you want to make the packages included with ActivePython available to your virtual environment, you can specify this when you create it, and then activate the environment:
python -m virtualenv --system-site-packages <directory_name> source <directory_name>/bin/activate
You can choose to install or upgrade individual packages, if you need specific versions or additional packages that are not included in ActivePython. The upgraded version of Django will be installed in you virtual environment, and the earlier version that shipped with ActivePython will be maintained in your global
python -m pip install --upgrade Django==2.0a1
You can create a
requirements.txt file that lists only the packages that have changed in your virtual environment:
python -m pip freeze --local > requirements.txt
Deactivate the virtual environment when you are finished: