Getting started with PyThorch - Installation in a virtualenvironment

Hi, I am getting started with Pythorch and I would like to understand what procedure I need to follow to install pythorch. I would like to use pythorch in a virtualenvironment with a virtualenvironmentwrapper (this is what’s used at my company and I don’t want to change it).

However, I am concerned if doing the installation below (found on the main pythorch page) would compromise the rest of my environment:

I say this because I need to use systemwide a python 2.7 while I know that Pythorch works for Python 3.XX.

Could you let me know what is best to do and if there is a guide to install Pythorch in a virtualenvironment without any problems?

Hi Follow below Steps if you are using Linux Distro:
I done same for my ubuntu 18.04 LTS

  1. Go to the dirctory where you want to create virtual environment.

  2. conda create -n yourenvname python=x.x anaconda (at place of x.x put version of python,I am using 3.6 and yourenvname is your enviroment name could be of anyname)

  3. install conda install pytorch torchvision cudatoolkit=10.1 -c pytorch according to your feasibility.

  4. source activate yourenvname

  5. Jupyter notebook

  6. When you done deactivate your environment with source deactivate command.

Want to access your environment again type this command "source activate yourenvname"

Also if you need to install any packages type “source activate yourenvname” command and install packages.

cheers !!! stay safe

Hi, thanks for your reply. However, I am not using conda as a virtual environment “manager” but I am using virtual env and virtualenvironmentwrapper as I specified in my question. Anyone knows how to install pytorch in that case?

The corresponding command I would like to do with conda is:

conda install pytorch=0.4.1 torchvision -c pytorch

what would be the equivalent with virtual env and virtualenvironmentwrapper ?