3

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

Thomas K
  • 39,200
  • 7
  • 84
  • 86
jmich738
  • 1,565
  • 3
  • 24
  • 41
  • did you install ipython with conda? You may have to do a `conda install notebook` to make sure ipython sees your library. – cel Jan 24 '16 at 09:17
  • tried that and it will wont work. Still the same error. – jmich738 Jan 24 '16 at 11:34
  • then please add the output of `which -a pip`, `which -a python` and `which -a ipython` – cel Jan 24 '16 at 11:45
  • Did you solve the problem? I had similar problems. Which version of ipython are you using? – Yaoyu Yang Mar 22 '16 at 01:43
  • I do not know if this will solve your problem or if you have already solved it, but this typically happens to me if I try to do install anything from my office since there is a firewall which blocks auto install. The work around I use is manually download the library and then install – PagMax Jun 23 '16 at 04:12

4 Answers4

3

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

Aakash Gupta
  • 716
  • 6
  • 11
0

Donit install Ipython on all your system. Install it only in the environments you want it. Otherwise Ipython will look for modules in the default path instead of the environment's path.

This is probably where your ipython is looking:

/home/user/anaconda2/lib/python2.7/

It should be looking for modules here:

/home/user/anaconda2/envs/name-of-env/lib/python3.4/

To check the path you type:

import sys
sys.path
Laraconda
  • 667
  • 6
  • 15
0

Try entering the following in your terminal:

conda install seaborn

It will install seaborn and make it available for you to import into your notebook

K. Fowler
  • 1
  • 2
0

Open anaconda prompt and Type

pip install seaborn
Machavity
  • 30,841
  • 27
  • 92
  • 100