Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install library for jupyter notebook

I start my jupyter notebook with python2 as:

jupyter notebook nameofnotebook

Then I want to import library like this:

import scipy

But I have an error telling that there is no such library.

So I execute in the notebook cell:

!pip2 install scipy
Requirement already satisfied: scipy in /usr/local/lib/python2.7/dist-packages

How to install package correctly to jupyter kernel?

like image 227
Kenenbek Arzymatov Avatar asked Jun 28 '17 10:06

Kenenbek Arzymatov


People also ask

How do I install a library?

Using the Library ManagerOpen the IDE and click to the "Sketch" menu and then Include Library > Manage Libraries. Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation.


1 Answers

@håken-lid is right. There are probably several versions of python. So to install your package to python where your jupyter is located:

$ which jupyter
/YOURPATH/bin/jupyter
$ /YOURPATH/bin/pip install scipy

This will do for Python 2.x

For Python 3.x pip3 will be in /YOURPATH/bin instead of single pip

like image 177
vishes_shell Avatar answered Oct 18 '22 13:10

vishes_shell