1. Installing Python with Anaconda¶
Python can be installed in many ways or may even already be installed on your machine (e.g., on some Unix distros). However, since phenopype is a scientific Python package, only the installation procedure using Anaconda, a scientific Python distribution, is described here. Anaconda, more specifically, its terminal interface conda
, is both a Python package and environment manager. To avoid conflicts between package dependencies, and for a cleaner and more reproducible workflow, phenopype should always be installed inside a Python virtual environment that you create first (read about virtual envs here). This procedure is explained here.
1.1. Installing conda
¶
Download and install Miniconda3 to create virtual environments using the conda
manager. Miniconda is a scientific Python distribution that comes with some packages already built in. Follow the OS-specific installation instructions. WINDOWS USERS: install miniconda directly to the top level of your drive so you don’t run into privilege issues - e.g. C:\miniconda3
. Test if conda was successfully installed:
conda --version
If this doesn’t show the current conda version, please refer to the references below for troubleshooting.
Troubleshooting references
Consult these references if you have trouble installing Miniconda (they are discussing Anaconda, but the same applies for Miniconda):
https://docs.anaconda.com/anaconda/user-guide/troubleshooting/
https://stackoverflow.com/questions/28612500/why-anaconda-does-not-recognize-conda-command
https://stackoverflow.com/questions/44597662/conda-command-is-not-recognized-on-windows-10
https://askubuntu.com/questions/908827/variable-path-issue-conda-command-not-found
1.2. Installing mamba
(optional)¶
This step is optional, but highly recommended! The mamba package manager replaces conda
and is much faster. For detailed installation instructions and user guide refer to the documentation. In short, do the following:
conda install -c conda-forge mamba
Test the installation with
mamba --version
1.3. Creating a virtual environment with conda
(or mamba
)¶
Note
If you have installed mamba, use mamba
instead of conda
here (except when activating and environment: there you still need to use conda activate
).
Use conda
to create a new Python virtual environment (needs to be Python 3.7 for phenopype):
conda create -n <NAME> python=3.7 # <NAME> == chosen name, e.g. "pp-env"
conda activate <NAME> # activates the new environment
After successful installation and activation, you should see the name of the environment in the console - e.g.:
(pp-env) D:\projects>
Now all libraries installed into this environment will be isolated from those installed in other virtual environments.