A PyTorch Environment

Ok, the goal of this article is to find out how to create our own environments and export them for future use.

First, let's find out which python version we're running when using the Python Default environment.

python --version

Ok, and I guess a bunch of packages are already there (it's Anaconda after all).

pip freeze

Ok great! Let's go ahead and install PyTorch... but wait! What about a GPU? Let's click on the Runtime and select the Dedicated 4 CPU + GPU, 16GB Ram as Resources.

nvcc --version

Great! Looks like we got some working CUDA (8.0). With that we can get the easy-to-use install command from PyTorch's official website. It's a simple conda command.

pip install http://download.pytorch.org/whl/cu80/torch-0.4.1-cp36-cp36m-linux_x86_64.whl
pip install torchvision

Awesome, let's see if we can work with this.

pip freeze

With that we add a new runtime (Python) of the same environment. Let's import torch to see if it worked.

import torch
import torchvision
print(torch.cuda.is_available())
© 2018 Nextjournal GmbH