Pipenv

As pipenv aims to replace pip, you should always install Python packages in virtual environments with pipenv. DO NOT INSTALL SYSTEM-WIDE PACKAGES USING pip.

Workflow

Follow this workflow when you have to install a Python tool requiring additional packages or simply developping your own.

  1. Create a directory dedicated to the software or project
mkdir /opt/awesometool
git clone https://github.com/awesome/tool -o /opt/awesometool
  1. Install required Python packages using pipenv
pipenv [--two|--three] install -r requirements.txt
pipenv [--two|--three] install [package1 package2 ...]
  1. Create a pipenv-wrapper.sh to run the Python software or project within the venv
#!/bin/sh
cd /opt/awesometool
pipenv run python awesometool.py "$@"
  1. Symlink the pipenv-wrapper.sh to /usr/local/bin
ln -s /opt/awesometool/pipenv-wrapper.sh /usr/local/bin/awesometool.py

Tip

Set the PIPENV_VENV_IN_PROJECT environment variable to create your pipenv environment in the project directory under the .pipenv/ folder.

export PIPENV_VENV_IN_PROJECT=yes

Warning

On Arch Linux, never ever install system-wide Python packages using pip. As Arch maintains most of Python packages in standard pacman packages, they will almost always conflict with each others. Either install the pacman package or use a venv using pipenv