0

I'm trying to run Jupyterhub on a Ubuntu 14.04 VM. I've successfully done this before on a similar Amazon EC2 instance, but for some reason it's not cooperating with me here.

I've installed both the Python 27 and Python 35 Anaconda packages, so I expect to be able to access libraries like matplotlib and numpy.

When I use Python from the command line, I can successfully import matplotlib:

$ python3
>>> import matplotlib
>>> # no error

However, when I try and import matplotlib from an iPython notebook inside of Jupyterhub, I'm told no such module exists:

import matplotlib
-----------------------
ImportError
...
ImportError: No module named 'matplotlib'

Why does Jupyterhub not recognize the module despite my being able to use it through other means?

Polyov
  • 2,281
  • 2
  • 26
  • 36
  • Is the notebook's kernel the same version as the default Python from your command line? – nitind Aug 05 '16 at 06:44
  • @nitind The notebook says "Python 3" kernel. The example holds true if I substitute `python` with `python3`. – Polyov Aug 05 '16 at 19:30

1 Answers1

0

Fixed myself. I needed to specify a different Python instance in a generated kernel.json file.

To generate the kernel.json file:

sudo anaconda3/bin/ipython kernel install

Then edit it:

sudo nano /usr/local/share/jupyter/kernels/python3/kernel.json

...

{
    "argv": [
        "/PATH/TO/ANACONDA/bin/python",    
Polyov
  • 2,281
  • 2
  • 26
  • 36