User Tools

Site Tools


pip

PIP

Install and Update packages from a File

For pip you can create so called requirements files. These files just list one package per line. Packages from this file can be installes with pip install -r <requirements_file.txt> and updatet with pip install -r <requirements_file.txt> -U. The update only makes sence when you do not specify a version number with the package.

Since pip does not support an “update all” mechanism this is a good way to install and update the needed packages.

Install GIT development code

pip install git+<https_git_clone_link>
 
# for branch_name:
pip install git+<https_git_clone_link>@<branch_name>

To put it into a requirements file just add this: git+<https_git_clone_link> instead of the normal package name.

FAQ

Wo speichert pip die Pakete unter Linux?

Die Pakete werden unter ~/.local/lib/<python_version>/site-packages/ gespeichert. Dieses gilt natürlich nur wenn pip ohne Environment-Manager wie zum Beispiel conda genutzt wird.

Install editable local Projects

pip install -e .

If you updated the project with git pull do this:

pip install -e . -U

also see: https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs

List outdated Packages

pip list -o

List packages in requirements.txt Format

pip list --format freeze

Show and Clean Cache

  • show where the cache is located: pip cache dir
  • Linux: rm -r ~/.cache/pip
  • Windows: delete <user_home>\AppData\Local\pip

also see

pip.txt · Last modified: 2020/08/26 21:16 by pmay