title: Jupyter Notebook Not Recognizing "import torch"
body: <p>To install <code>PyTorch</code> on Ubuntu, as instructed by the official website, I did <code>pip3 install torch torchvision</code>, and I am able to run <code>PyTorch</code> using the <code>python3.5</code> command. </p>
  
  <p>However, when I run <code>Jupyter Notebook</code> (I'm just running <code>Jupyter Notebook</code> in the terminal and using Chrome to access my notebooks), it doesn't recognize the package, throwing <code>ModuleNotFoundError: No module named 'torch'</code> at me. </p>
  
  <p>The other odd thing is that <strong><code>PyTorch</code> seems to have only been installed on <code>Python 3.5</code></strong> and not on <code>Python 3.6</code> because:</p>
  
  <pre><code>➜  ~ python3.5 -c "import torch; print(torch.__version__)"     
  0.4.1
  ➜  ~ python3.6 -c "import torch; print(torch.__version__)"     
  Traceback (most recent call last):
    File "&lt;string&gt;", line 1, in &lt;module&gt;
  ModuleNotFoundError: No module named 'torch'
  ➜  ~
  </code></pre>
  
  <p>Therefore I'm guessing that <code>Jupyter Notebook</code> is not using <code>Python 3.5</code>.</p>
  
  <p>This is the result when I type <code>python</code> in my terminal and press <code>TAB</code>:</p>
  
  <pre><code>➜  ~ python
  python             python2.7          python3.5          python3.5m         python3.6          python3.6m         python3-config     python3m-config  
  python2            python3            python3.5-config   python3.5m-config  python3.6-config   python3.6m-config  python3m
  </code></pre>
  
  <p>Also, when I run <code>which python</code>, I get <code>/home/mhy/anaconda3/bin/python</code> since I installed <code>Anaconda</code> recently. I then activated my <code>env</code> and installed <code>PyTorch</code> using the following commands:</p>
  
  <pre><code>source activate my_env
  conda install torch torchvision
  </code></pre>
  
  <p>But I wasnt able to run <code>PyTorch</code> on <code>Anaconda</code> either.</p>