Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams 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!

What does that mean? Like also Python 3.7? If so, I do have MiniConda Python 3.7. Should I remove that? Anon Li Jan 9, 2019 at 19:09 From terminal open idle, using idle3, since you are using python 3.6, then do import seaborn. Do not use idle as it will open 2.7 version. Harshit Mehta Jan 9, 2019 at 19:26 Please do not share information as images unless absolutely necessary. See: meta.stackoverflow.com/questions/303812/… , idownvotedbecau.se/imageofcode , idownvotedbecau.se/imageofanexception . AMC Mar 5, 2020 at 23:10

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.

imgur.com/a/r2Qiz7R Wait, does the Python IDE have to exactly match? I have python 3.6.0 installed, but my Python IDE is for 3.6.6 – Anon Li Jan 9, 2019 at 21:21 That definitely means they're not pointing to the same python installation, and almost definitely that's what causing the issue. Your python 3.6.0 installation has seaborn installed correctly, but the python 3.6.6 installation that the IDE is calling does not. If I were you, I might actually uninstall python 3.6.0 entirely, if you don't have a very specific version requirement. – GiovanH Jan 11, 2019 at 5:22 If you're doing in jupyter notebook That's clearly not the case, since OP wrote I have looked at other posts, but most seemed to be dealing with Jupyter notebooks, which I'm not. – AMC Mar 5, 2020 at 23:11 The default install command with conda is conda install seaborn, letting conda manage the default source per local configuration (configuration exists for good reasons, in particular for using conda-forge repository rather than anaconda). So if you are suggesting to not use the local configuration (c and y options force to use anaconda blindly without confirmation) then explain why... – mins Nov 29, 2020 at 16:02

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
                Please explain why this is a solution. What does your solution do, how does it solve the problem. (It should also have an educational effect on people who find this question because they have a similar problem. )
– user1986815
                Dec 18, 2020 at 5:17
                Welcome to Stack Overflow. It would be helpful if you could write how to use your code and how it would solve the problem.
– Dinkheller
                Dec 15, 2019 at 13:46
                I only have the Python 3.6.X IDE. I checked the sys.path and it includes the folder that contains my seaborn folder but still import error
– Anon Li
                Jan 10, 2019 at 6:40

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!

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]”

Just found a new method to install all important libraries. Open command prompt: Pip install pyforest All the most important libraries got installed.

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

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – xlmaster Feb 26 at 12:54

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.