title: jupyter notebook running kernel in different env
body: <p>I've gotten myself into some kind of horrible virtualenv mess.  Help?!</p>
  
  <p>I manage environments with <code>conda</code>.  Until recently, I only had a python2 jupyter notebook kernel, but I decided to drag myself kicking and screaming into the 21st century and installed a python3 kernel; I forget how I did it.  </p>
  
  <p>My main (anaconda) python defaults to 2.7.  </p>
  
  <p>So here I am, merrily trying to use beautiful soup from inside my shiny new python3 kernel, and I don't seem to be able to do anything to get at whatever environment it's finding packages in.  Viz (all from notebook): </p>
  
  <pre><code>from bs4 import BeautifulSoup 
  
  -&gt; ImportError: No module named 'bs4'
  </code></pre>
  
  <p>Ok, fine, I'll install it using shell magic.  Right?  Right? </p>
  
  <pre><code>! pip install bs4
  
  --&gt; Collecting bs4
    Downloading bs4-0.0.1.tar.gz
  Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in /Users/[MY-USER]/anaconda/lib/python2.7/site-packages (from bs4)
  [...]
  Successfully built bs4
  Installing collected packages: bs4
  Successfully installed bs4-0.0.1
  
  from bs4 import BeautifulSoup 
  
  -&gt; ImportError: No module named 'bs4'
  </code></pre>
  
  <p>Oh no.  Does it think I'm in a 2.7 env even though I'm running a python3 kernel?  That won't do.  </p>
  
  <pre><code>! conda info --envs
  --&gt; # conda environments:
  #
  flaskenv                 /Users/[MY-USER]/anaconda/envs/flaskenv
  mesa                     /Users/[MY-USER]/anaconda/envs/mesa
  py35                     /Users/[MY-USER]/anaconda/envs/py35
  root                  *  /Users/[MY-USER]/anaconda
  </code></pre>
  
  <p>Ok, I can fix that. One of those is a 3.5 env.</p>
  
  <pre><code>! source activate py35
  --&gt; prepending /Users/[MY-USER]/anaconda/envs/py35/bin to PATH
  
  ! conda install beautifulsoup4
  --&gt; Fetching package metadata .......
  Solving package specifications: ..........
  
  # All requested packages already installed.
  # packages in environment at /Users/[MY-USER]/anaconda:
  #
  beautifulsoup4            4.4.1                    py27_0  
  </code></pre>
  
  <p>concerning... </p>
  
  <pre><code>! pip install bs4
  --&gt; Requirement already satisfied (use --upgrade to upgrade): bs4 in /Users/[MY-USER]/anaconda/lib/python2.7/site-packages
  </code></pre>
  
  <p>more concerning... </p>
  
  <pre><code>from bs4 import BeautifulSoup 
  
  -&gt; ImportError: No module named 'bs4'
  </code></pre>
  
  <p>ARRGH!!!  <em>headdesk</em>  Am I going to have to kill the kernel in order to fix this (and re-run a bit of work)?  Is killing the kernel even going to work?  How do I get my jupyter kernel to know what environment it's supposed to be running under?</p>
  
  <p>thanks!</p>