Reputation: 621
It checks the lib folder where my seaborn stuff is, but still error._.
Hi,
I have looked at other posts, but most seemed to be dealing with Jupyter notebooks, which I'm not. I was wondering how to get to use Seaborn in the basic Python IDE or in PyCharm. I read about filepath collisions stuff, but not too clear on that front.
I'm using Python 3.6 right now.
Thanks for any help!
Upvotes: 23
Views: 173841
Reputation: 1
To fix this, you can install the seaborn package using pip. Run the following command in your terminal:
pip install seaborn
If you are using a Jupyter notebook or a similar environment, you can install it directly in the notebook like this:
!pip install seaborn
Once installed, you should be able to import and use seaborn without any issues:
import seaborn as sns
Upvotes: 0
Reputation: 3598
pip install seaborn
[![enter image description here][3]][3]
import seaborn as sns
sns.set_theme()
tips = sns.load_dataset("tips")
sns.relplot( data=tips, x="total_bill", y="tip", col="time", hue="smoker", style="smoker", size="size", ) [3]: https://i.sstatic.net/ZId3H.png
Upvotes: 0
Reputation: 1
I recommend you to use seaborn under Anaconda environment. I met same condition as you, but when I use online Jupyter Notebook, it works. If you don't want to use the web version, like running the code this locality, you can download Jupyter notebook and Anaconda. And choose the Anaconda as your kernel. If you use vs code, you can refer to this official statement: https://code.visualstudio.com/docs/datascience/jupyter-notebooks
Upvotes: 0
Reputation: 21
If you're using Jupyter notebook try to run this:
pip install seaborn --user
Upvotes: 0
Reputation: 3801
If you are using jupyter notebook following command will solve the issue
!pip install seaborn
Upvotes: 4
Reputation: 6511
My fix (Same import error but on Jupyter Notebook). The import sequence:
import numpy as np
import seaborn as sns
%matplotlib inline
import matplotlib.pyplot as plt
Importing Matplotlib before seaborn can lead to an import error (I have no idea why).
The Seaborn official document also shows this: https://seaborn.pydata.org/installing.html
Upvotes: 0
Reputation: 329
import pip
pip.main(['install','seaborn'])
From: https://stackoverflow.com/a/49391839
Upvotes: 16
Reputation: 51
Try running it in the terminal, it will work. But while running the command your pwd should be in the virtual environment in activated form
$ sudo apt-get install -y python3-seaborn
Upvotes: 5
Reputation: 79
If you're doing in jupyter notebook Try doing this:
!conda install -c anaconda seaborn -y
Upvotes: 7
Reputation: 21
Just found a new method to install all important libraries. Open command prompt: Pip install pyforest All the most important libraries got installed.
Upvotes: 0
Reputation: 621
In PyCharm IDE, we can import the downloaded libraries, and that's what I did. Still, I have no clue on how to resolve this issue on Python IDE, but as of now, it's working on PyCharm for me.
Upvotes: 2
Reputation: 121
Maybe you should try “python —version “to check if you’re using the right version of python in cmd. Sometimes it happens that there are multiple versions installed and it sometimes picks the wrong one.
Also it can happens that python hasn’t the rights to use the module. Then you should create your file and run it with “python [path of file]”
Upvotes: 0
Reputation: 621
Tried importing seaborn in Pycharm with the proper configuration thing, and it works. I still don't know why the regular Python IDE doesn't work even though one of the sys.path folder it checks contains the seaborn folder, but oh well.
Thanks for all the replies!
Upvotes: 0
Reputation: 389
When dealing with version ambiguity, remember that pip
is a python module. Once you're confident that python
is the python installation that your IDE is running, run
python --version
python -m pip install seaborn
>pip3
may be pointing to an old or different python installation.
Upvotes: 28
Reputation: 338
Since you are using python 3, try to open with idle3 from terminal
Upvotes: 0
Reputation: 23
Try running this in a command line 'pip install seaborn'
https://seaborn.pydata.org/installing.html#installing
Upvotes: 2