8

I am getting the "ImportError: DLL load failed: The specified module could not be found." when importing the module seaborn.

I tried uninstalling both seaborn and matplotlib, then reinstalling by using

pip install seaborn 

but no luck. I still get the same error.

ImportError                               Traceback (most recent call last)
<ipython-input-5-085c0287ecb5> in <module>()
----> 1 import seaborn

C:\Users\johnsam\venv\lib\site-packages\seaborn\__init__.py in <module>()
      4 
      5 # Import seaborn objects
----> 6 from .rcmod import *
      7 from .utils import *
      8 from .palettes import *

C:\Users\johnsam\venv\lib\site-packages\seaborn\rcmod.py in <module>()
      6 import matplotlib as mpl
      7 
----> 8 from . import palettes, _orig_rc_params
      9 
     10 

C:\Users\johnsam\venv\lib\site-packages\seaborn\palettes.py in <module>()
     10 from .external.six.moves import range
     11 
---> 12 from .utils import desaturate, set_hls_values, get_color_cycle
     13 from .xkcd_rgb import xkcd_rgb
     14 from .crayons import crayons

C:\Users\johnsam\venv\lib\site-packages\seaborn\utils.py in <module>()
      6 
      7 import numpy as np
----> 8 from scipy import stats
      9 import pandas as pd
     10 import matplotlib as mpl

C:\Program Files\Continuum\Anaconda3\lib\site-packages\scipy\stats\__init__.py in <module>()
    332 from __future__ import division, print_function, absolute_import
    333 
--> 334 from .stats import *
    335 from .distributions import *
    336 from .rv import *

C:\Program Files\Continuum\Anaconda3\lib\site-packages\scipy\stats\stats.py in <module>()
    179 from scipy.lib.six import callable, string_types
    180 from numpy import array, asarray, ma, zeros, sum
--> 181 import scipy.special as special
    182 import scipy.linalg as linalg
    183 import numpy as np

C:\Program Files\Continuum\Anaconda3\lib\site-packages\scipy\special\__init__.py in <module>()
    544 from __future__ import division, print_function, absolute_import
    545 
--> 546 from ._ufuncs import *
    547 
    548 from .basic import *

ImportError: DLL load failed: The specified module could not be found.

Is there a way to get around this error?

Ariel
  • 928
  • 4
  • 15
  • 32

5 Answers5

4

I was having this issue until I uninstalled and reinstalled scipy with the pip command. Just got to your command line and type pip uninstall scipy and pip install scipy.

Hopefully that works for you as well. I also uninstalled/installed seaborn before this although I'm not sure if that was necessary.

Using conda rather than pip may also work.

robsiemb
  • 6,157
  • 7
  • 32
  • 46
2

What solved this for me was installing seaborn via conda:

conda install seaborn

And then restarting the kernel

Pythoner
  • 460
  • 6
  • 23
1

The problem is because you are using windows. Scipy has problems with windows, if you check the sklearn site they say if you were unsuccessful for installing their packages by pip or conda you can install them with unofficial windows binary packages

so what you need to do is this, find your required package in This Link and download it

uninstall your previous installed packages :

pip uninstall seaborn

install all you need from this link, i suggest you to install numpy , pandas, matplotlib, seaborn , ... from this link

after you downloaded the required package, open your cmd, go to the folder that contains the .whl file

you can install them by the following command :

pip install "seaborn‑0.8.1‑py2.py3‑none‑any.whl"
Mohsen_Fatemi
  • 2,183
  • 2
  • 16
  • 25
1

I had the same problem.

I uninstalled seaborn with pip uninstall seaborn and then I installed it with pip install seaborn

Then it didn't work so I restarted the KERNEL and it works.

B. Go
  • 1,436
  • 4
  • 15
  • 22
Guddeee_
  • 11
  • 1
0

I also had the same problem with Windows 10. After upgraded my python version from 3.7 to 3.9 and reinstall all the packages, the issue disappears. Guess it also works for python 3.8 but has not been verified.

Update: Found the comments in Scipy: Lib\site-packages\scipy_distributor_init.py: "minimum supported Python version is 3.8". Also verified that python 3.8 works in my Windows 10.

Ying Dai
  • 171
  • 1
  • 6
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. – EDS Sep 06 '21 at 03:57