can't import seaborn on Jupyter notebook - python

I have installed numpy, pandas and matplot lib
but installation of seaorn i not possible. I ve tried updating Numpy, installing seaborn through the cmd command but in vain. I restarted the kernel each time.
import seaborn as sns
I keep recieving ;
ImportError: DLL load failed while importing _arpack: The specified procedure could not be found.
I have used:
!pip install seaborn
pip install numpy --upgrade --user
pip import seaborn as sns df = sns.load_dataset(penguins) sns.pairplot(df, hue=species)

It seems like your seaborn and/or numpy installation is broken or at least there is some versions conflict.
Try to run these commande from the command line :
pip unistall seaborn numpy
pip install mkl numpy seaborn
After that, you can run this code in your Jupyter notebook :
import seaborn as sns
df = sns.load_dataset("penguins")
sns.pairplot(df, hue="species")

the problem was fixed by updating matplotlib on the conda shell.
conda update matplotlib

Related

How can I install pyplot?

I tried to install pyplot using 'pip install pyplot' in command prompt while it was installing by mistake i closed command prompt then again i am trying to install pyplot using the same command but it was not installing.Can anyone guide me how to install pyplotKindly find the error in this image
error rectification in installing pyplot
pyplot is part of a matplotlib.
In order to install pyplot you should install matplotlib
pip install matplotlib
So you can "import matplotlib.pyplot"
You can go to https://pypi.org/project/matplotlib to see and install the version you want.
Then you can import the pylot
from matplotlib import pyplot

How to Import Pandas Profiling [duplicate]

I am new to pandas_profiling and getting ImportError while importing it. Please help.
import numpy as np
import pandas as pd
import pandas_profiling
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
%matplotlib inline
import seaborn as sns
After executing the above code in jupyter notebook, I am getting the following error.
ImportError: matplotlib is required for plotting when the default backend "matplotlib" is selected.
> python --version
Python 3.7.3
> pip list | grep -E "matplotlib|pandas"
matplotlib 3.2.0
pandas 0.25.3
pandas-profiling 2.5.3
I don't know the actual reason but I restarted the kernel and it is working.
Before restarting the kernel I executed following commands:
conda install -c anaconda pandas-profiling

KeyError: 'PROJ_LIB' while installing basemap using conda install

I want to use matplotlib basemap, using Anaconda in a Jupyter Notebook. while running this:
from mpl_toolkits.basemap import Basemap
I get the following error:
KeyError: 'PROJ_LIB'
What I've tried and haven't worked:
conda install basemap
and
conda install basemap -c conda-forge
I checked similar questions here but couldn't find a proper answer.
If you already haven't found the solution, adding
import os
os.environ['PROJ_LIB'] = '<path to anaconda>/anaconda3/share/proj'
to your code preamble will do the job.

Get dependency file to host Jupyter notebook on Binder?

I am trying to export my dependencies to a requirements.txt or environment.yml file for pip or conda respectively - in order to host a Binder notebook.
How can I get only the dependencies that my notebook is using?
When I tried pip freeze or conda env export, I get all my installed packages, which leads to errors when building the Docker environment.
You might want to try watermark:
Install:
pip install watermark
Then, in your notebook:
# Load the extension
%load_ext watermark
# import your libraries
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Determine the dependency version
%watermark -p numpy,matplotlib,seaborn
The results will look like this:
numpy 1.14.3
matplotlib 2.2.2
seaborn 0.9.0

Google Colab not updating package?

I am trying to use seaborn==0.8.1 in an ipynb on Google colab. Here is my code:
"""General import statements and settings config."""
!pip install seaborn==0.8.1
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
pd.set_option('max_columns', 10)
color = sns.color_palette()[0]
print (sns.__version__)
However, this outputs the following:
Requirement already satisfied: seaborn==0.8.1 in /usr/local/lib/python3.6/dist-packages (0.8.1)
0.7.1
If the requirement is satisfied why am I importing the old version of Seaborn?
The issue here is that Colab imports seaborn at startup, before you've pip install'd the new version. If you restart your runtime after the install, you'll pick up the new version.
!pip install seaborn --upgrade packageName and then restart the kernel/runtime.
If you just need to upgrade seaborn in a hosted collab notebook to the latest version then run
!pip install seaborn --upgrade and then restart the kernel/runtime.

Categories

Resources