Installation on macOS and Linux with PyPI using pip - gecos-lab/PZero GitHub Wiki

Installation on macOS

We recommend using Anaconda as explained here.

However, it is also possible to install PZero on macOS without Anaconda. For this Homebrew is needed and, in order not to alter the base Python environment, we strongly suggest to create a dedicated virtual environment using virtualenvwrapper.

All the following commands must be entered in the macOS Terminal. First Homebrew, Python 3 (needed because the default Python on macOS is Python 2) and virtualenvwrapper are installed:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python3
brew install virtualenvwrapper

Then to be able to use virtualenvwrapper, some lines must be added to the options file of the zsh shell (the shell that runs in the macOS Terminal). The options file can be opened with:

nano ~/.zshrc

Then the following lines must be pasted and the file saved with control+X.

# lines needed by virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

After restarting the Terminal, a virtual environment called pzero based on Python 3.8 can be created and activated:

mkvirtualenv --python=3.8 pzero
workon pzero

When the pzero environment is active, it will be highlighted within brackets at the command prompt, as in:

(pzero) <user>@<machine> <directory> %

To activate and deactivate the pzero environment, and in case you want to remove it completely, use respectively:

workon pzero

deactivate

rmvirtualenv pzero

All the lines above, from brew install virtualenvwrapper, can be skipped in case a virtual environment is not being created, or created using a different virtual environment manager.

Now the Python modules required by PZero can be automatically installed using pip3 (not pip that will point to Python 2) within the PZero directory downloaded from GitHub.

pip3 install -r .envs/requirements.txt

These should be the same packages listed in the "from history" conda environment file.


Installation on Linux (Debian) using pip

For Debian based Linux distros pip can be installed using the apt package manager.

  1. Check if packages and dependencies need to be upgraded (routine check):
sudo apt update
sudo apt upgrade
  1. Install pip3:
sudo apt install python3-pip

Then to install the python3 modules required by pzero we can just run:

pip3 install -r ./envs/requirements.txt

These should be the same packages listed in the "from history" conda environment file.

⚠️ **GitHub.com Fallback** ⚠️