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
    
  2. Install required Python packages using pipenv

    pipenv [--two|--three] install -r requirements.txt
    pipenv [--two|--three] install [package1 package2 ...]
    
  3. 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 "$@"
    
  4. Symlink the pipenv-wrapper.sh to /usr/local/bin

    ln -s /opt/awesometool/pipenv-wrapper.sh /usr/local/bin/awesometool.py
    

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