Here are the steps:
- Create environment with specific Python and package versions
- Activate the environment
- List packages in environment
- Install PyTorch
- Deactivate environment
- List environments
Create Environment
Enter this command in Terminal to install Python 3.6, NumPy 1.13.3, and the newest version of SciPy.
conda create -n pytorch python=3.6 numpy=1.13.3 scipy
Note: including a conda package without a version number installs the latest and greatest by default.
Activate Environment
You have to activate the environment to actually use it. Do this like so:
source activate pytorch
List Packages
Now we’re inside the pytorch container (notice pytorch in parantheses?). We can see which packages are installed by typing:
conda list
Install PyTorch
Let’s install PyTorch while we’re here.
conda install pytorch torchvision -c pytorch
Deactivate Environment
We can return to the root environment by typing:
source deactivate
List Environments
We can also see which environments are installed.
conda info --envs