Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python - Can't import Seaborn

I'm running iPhyton Notebooks and I'm trying to import the Seaborn package. When I try to import it from the Terminal, it loads up fine, but when I import it through iPython Notebooks, it give me the following error. I have even tried to re-install Seaborn using both Conda and Pip inside iPython notebooks and still it wont work. Any idea why?

Thanks.

ImportError                               Traceback (most recent call last)
<ipython-input-1-417274a1ae6c> in <module>()
      1 get_ipython().system(u'conda install seaborn')
      2 get_ipython().system(u'pip install seaborn')
----> 3 import seaborn as sb
      4 

ImportError: No module named seaborn

enter image description here enter image description here

like image 217
jmich738 Avatar asked Sep 16 '26 20:09

jmich738


1 Answers

Try this

import sys
print sys.path
sys.path.append('<path to package in your syste>')

import seaborn

In my Ubuntu 14.4LTS the packages get installed in the following folder

/usr/local/lib/python2.7/dist-packages

So I simply add the package path at run time

like image 54
Aakash Gupta Avatar answered Sep 18 '26 10:09

Aakash Gupta