Installing Python 3 via Conda
This tutorial describes how to install Python 3 into your home directory using the Conda package manager. We'll use the Miniconda variant, which is just Anaconda with fewer packages installed by default.
- Make executable:
chmod +x Miniconda3-py37_4.8.3-Linux-x86_64.sh
- Run installer:
./Miniconda3-py37_4.8.3-Linux-x86_64.shWhen prompted, say yes when asked if you want to initialize Miniconda.
- Close and re-open your shell in order for the installation to take effect. (e.g., close your terminal or SSH connection and then re-open)
- Update your conda environment to the latest:
conda update -n base -c defaults conda
You should now have a functioning
base Conda environment. It's best to leave this default Conda environment untouched and to create new Conda environments for each project you use.
- Create a new environment:
conda create --name MyNewEnv python=3.7
- Activate an existing environment:
conda activate MyNewEnv
- Deactivate the current enrivonment:
The standard workflow is to create a separate environment for each project. When switching projects, you then run
conda activate <name> to activate the appropriate environment. This replaces the common practice of using a separate Python virtual environment for each project.
Packages can be installed into the Conda environment using both
conda. The latter can install non-Python programs in addition to Python packages. The standard practice is to install any needed
conda packages first, followed by any
pip packages. For example, you can install PyTorch and Java 11:
conda install -c conda-forge 'openjdk>=11,<12'
conda install -c pytorch pytorch torchvision cudatoolkit=10.1
Followed by Capreolus via pip:
pip install capreolus