obiii
(Obiii)
April 8, 2017, 9:45am
1
Hi,
I am trying to create a docker container to tun ipython notebook.
I have tried using docker-notebook image.
The problem is:
Even though I have mentioned all the dependencies in Dockerfile and it installs all the dependencies during the build, but when the ipython server is launched and after creating a new notebook, i get "ImportError: no module named ‘pandas’ found.
Things i have tried:
1.docker exec sudo apt-get install pandas [Doesnt work]
2.laucnhing bib/bsh of container: docker run bin/bash
2.1.and installing inside bin/bash: sudo apt-get install pandas OR pip install pandas [Doesnt work]
3.Commiting the container after making changes [YES it works,changes are preserved] BUT i cannot run the newly commited container because it launches the bin/bash where as i need ipython server.
I have also tried the git repo: ipython/ipython :
It throws the error that: No runnable webbrowser found.
I checked in container using bin/bash, the ipython_notebook_config.py file has no entry of c.NotebookApp.browser.
How can i fix this in Dockerfile? Because i cannot fix it using boin/bash as all the changes are lost when I exit the container.
think
(Think)
April 8, 2017, 1:16pm
2
you could try this one. I’m using it and it works for me. You can check the Dockerfile to see how I got it to work.
https://hub.docker.com/r/think/notebook/
Pandas is not installed. If you want to install pandas, you just could execute:
apk update &&
apk add libpng-dev freetype-dev &&
ln -s /usr/include/locale.h /usr/include/xlocale.h &&
pip3 install matplotlib pandas numpy
Normally I just sometimes need pandas, so I’m happy enough to install pandas in a notebook-shell step, once the notebook requires it.
obiii
(Obiii)
April 8, 2017, 4:04pm
3
I will try this solution and let you know. Thanks so much
Have you tried importing pandas in ipython notebook after running this container ? @think
think
(Think)
April 8, 2017, 4:07pm
4
yes. did yesterday some histograms with pandas. So also the inlining of the plot is working.
1 Like
obiii
(Obiii)
April 8, 2017, 4:20pm
5
oh thats great! can you post your docker file please? @think
think
(Think)
April 8, 2017, 4:27pm
6
just check out the dockerhub link above…you will find everything there, including the link to github with even more details
obiii
(Obiii)
April 8, 2017, 5:53pm
7
I checked the Dockerfile. These line you provided above
apk update &&
apk add libpng-dev freetype-dev &&
ln -s /usr/include/locale.h /usr/include/xlocale.h &&
arent in the dockerfile. You added these above lines to install pandas numy & matplotlib? @think
obiii
(Obiii)
April 8, 2017, 6:40pm
8
I have added line pip3 install pandas matplotlib numpy. but it throws a very long error when collecting pandas
think
(Think)
April 8, 2017, 8:02pm
9
i do not deploy pandas in my notebook by default. I just have it as notebook shell-cell if one notebook needs it.
%%sh
apk update ....
could show me your error message? your Dockerfile?
obiii
(Obiii)
April 9, 2017, 8:23am
10
its a very long error, “something not found in locale.h”. Anyway, i got it. Thnaks alot its working fine now.
Can you please tell me what this shell-cell is? can we install any library on the run using this shel-thing inside notebook cells?
think
(Think)
April 9, 2017, 8:58am
11
yes, you could, you besically just add in your notebook a new cell.
instead of python, you write
%%sh
ps -Af
this lets you execute everything you want.
Also install new plugins / tools / …