2. Install in Virtual Environments#
If you do not want the installation to occupy your main python’s site-packages (either you are testing or the dependencies may clutter your existing installed packages), install the package in an isolated virtual environment. Two common virtual environments are virtualenv and conda.
2.1. Install in virtualenv Environment#
Install
virtualenv:python -m pip install virtualenvCreate a virtual environment and give it a name, such as
imate_envpython -m virtualenv imate_envActivate python in the new environment
source imate_env/bin/activateInstall
imatepackage with any of the above methods. For instance:python -m pip install imateThen, use the package in this environment.
To exit from the environment
deactivate
2.2. Install in conda Environment#
In the followings, it is assumed anaconda (or miniconda) is installed.
Initialize conda
conda initYou may need to close and reopen your terminal after the above command. Alternatively, instead of the above, you can do
sudo sh $(conda info --root)/etc/profile.d/conda.shCreate a virtual environment and give it a name, such as
imate_envconda create --name imate_env -yThe command
conda info --envsshows the list of all environments. The current environment is marked by an asterisk in the list, which should be the default environment at this stage. In the next step, we will change the current environment to the one we created.Activate the new environment
source activate imate_envInstall
imatewith any of the above methods. For instance:conda install -c s-ameli imateThen, use the package in this environment.
To exit from the environment
conda deactivate