Getting started with PyThorch - Installation in a virtualenvironment

desmond13: <p>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).</p>
<p>However, I am concerned if doing the installation below (found on the main pythorch page) would compromise the rest of my environment:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/9/f/9f8fece90376d5fd08c3b0b32dfc60b3bad73e8c.png" data-download-href="https://discuss.pytorch.org/uploads/default/9f8fece90376d5fd08c3b0b32dfc60b3bad73e8c" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/9/f/9f8fece90376d5fd08c3b0b32dfc60b3bad73e8c_2_608x500.png" alt="image" data-base62-sha1="mLyh9iTaxpVPnsaWZYj2zxVQnzC" width="608" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/9/f/9f8fece90376d5fd08c3b0b32dfc60b3bad73e8c_2_608x500.png, https://discuss.pytorch.org/uploads/default/original/3X/9/f/9f8fece90376d5fd08c3b0b32dfc60b3bad73e8c.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/9/f/9f8fece90376d5fd08c3b0b32dfc60b3bad73e8c.png 2x" data-dominant-color="DED2D1"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">862×708 64.9 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>I say this because I need to use systemwide a python 2.7 while I know that Pythorch works for Python 3.XX.</p>
<p>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?</p>

sgaur: <p>Hi Follow below Steps if you are using Linux Distro:<br>
I done same for my ubuntu 18.04 LTS</p>
<ol>
<li>
<p>Go to the dirctory where you want to create virtual environment.</p>
</li>
<li>
<p>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)</p>
</li>
<li>
<p>install <strong>conda install pytorch torchvision cudatoolkit=10.1 -c pytorch</strong> according to your feasibility.</p>
</li>
<li>
<p>source activate yourenvname</p>
</li>
<li>
<p>Jupyter notebook</p>
</li>
<li>
<p>When you done deactivate your environment with source deactivate command.</p>
</li>
</ol>
<p>Want to access your environment again type this command <strong>"source activate yourenvname"</strong></p>
<p>Also if you need to install any packages type  “source activate yourenvname” command and install packages.</p>
<p>cheers !!! stay safe</p>

desmond13: <p>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?</p>
<p>The corresponding command I would like to do with conda is:</p>
<p><code>conda install pytorch=0.4.1 torchvision -c pytorch</code></p>
<p>what would be the equivalent with virtual env and virtualenvironmentwrapper ?</p>
<p>Thanks.</p>