Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter: install new modules

I have recently installed Anaconda with Python 3.5 and all the rest. I come from R where I am used to install packages dynamically. I am trying to install a module called scitools through jupyter notebook. I would like to recreate this in jupyter. However, I don't know how to dynamically install packages (if it's possible). I would greatly appreciate your help. Thank you!

enter image description here

EDIT: I am trying to use conda as recommended by the community, but it's not working. I am using mac OSX

enter image description here

like image 456
Johnathan Avatar asked Nov 29 '16 23:11

Johnathan


People also ask

How do I install new Jupyter modules?

Installing packages globally and locally If we want to install packages from Jupyter Notebook itself, we can put an exclamation point ( ! ) before the pip3 / conda install command. This command will then act as if it were executed in the terminal. Note: we cannot run pip install from the Python shell.


2 Answers

Check Jake Vander Plus Blog here to learn how to install a package with pip from Jupyter Notebook.

# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy
like image 110
AB Abhi Avatar answered Sep 27 '22 18:09

AB Abhi


So if you have already done the install with anaconda, you may already have the module installed. In that case in your jupyter notebook after you have activated your kernel, you just need to make sure you execute the import statement.

import scitools

If you haven't installed that module yet, you can install it one of two ways. Both work from your command line or terminal.

pip install scitools

or since you have Anaconda

conda install scitools

and that should do it. Your import statement in your notebook when executed should correctly locate and enable the use of that module.

like image 29
Steve D. Avatar answered Sep 27 '22 18:09

Steve D.