Seaborn: Import Error: DLL load failed

Created on 15 May 2016  ·  12Comments  ·  Source: mwaskom/seaborn

When trying to import seaborn on windows (x64) the following error is raised:

ImportError                               Traceback (most recent call last)
<ipython-input-1-ed9806ce3570> in <module>()
----> 1 import seaborn as sns

C:\Users\kasus\Anaconda3\lib\site-packages\seaborn\__init__.py in <module>()
----> 1 from .rcmod import *
      2 from .utils import *
      3 from .palettes import *
      4 from .linearmodels import *
      5 from .categorical import *

C:\Users\kasus\Anaconda3\lib\site-packages\seaborn\rcmod.py in <module>()
      6 import matplotlib as mpl
      7 
----> 8 from . import palettes
      9 
     10 mpl_ge_150 = LooseVersion(mpl.__version__) >= '1.5.0'

C:\Users\kasus\Anaconda3\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\kasus\Anaconda3\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:\Users\kasus\Anaconda3\lib\site-packages\scipy\stats\__init__.py in <module>()
    336 from __future__ import division, print_function, absolute_import
    337 
--> 338 from .stats import *
    339 from .distributions import *
    340 from .morestats import *

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

C:\Users\kasus\Anaconda3\lib\site-packages\scipy\special\__init__.py in <module>()
    625 from __future__ import division, print_function, absolute_import
    626 
--> 627 from ._ufuncs import *
    628 
    629 from .basic import *

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

These are the current verions of my conda environment:

conda: 4.0.6.
numpy: 1.10.4
pandas: 0.18.1
scipy: 0.17.1
seaborn: 0.7.0

Do you know how to fix this?

Most helpful comment

I had the same problem trying to run seaborn within a conda environment running with Python 3.4.5. In my case the solution was downgrading scipy (and dependencies sklearn, mkl, and numpy) from 0.19.1to 0.17.1. I also tried first downgrading it to 0.18.1, but apparently the bad interaction with seaborn appears in version 0.18.1 already. So by doing this, i can import seaborn without that error message. I hope someone has some time to take a look to this and provide some more info :-)

All 12 comments

As you can see in the traceback the error happens on a scipy import (import scipy.special as special) - so it is not seaborn specific.

Yep, looks like a bad scipy installation. I'd ask over there.

Did you get solution for this problem..?

I can't remember to be honest, feel free to close the issue :)

@methodds It was closed more than year ago! :)

Ok... Finally I got Solution...

What was the solution?

I had the same problem trying to run seaborn within a conda environment running with Python 3.4.5. In my case the solution was downgrading scipy (and dependencies sklearn, mkl, and numpy) from 0.19.1to 0.17.1. I also tried first downgrading it to 0.18.1, but apparently the bad interaction with seaborn appears in version 0.18.1 already. So by doing this, i can import seaborn without that error message. I hope someone has some time to take a look to this and provide some more info :-)

Seaborn has no compiled components, so it is not really possible for there the be a “bad interaction” between it and the scipy C libraries. Also, seaborn is regularly tested against the latest versions of its dependencies on conda. I’m highly skeptical that the problem has anything to do with seaborn other than that you happen not to be importing scipy directly and only do so when you import seaborn.

ImportError                               Traceback (most recent call last)
<ipython-input-15-7267c01924b6> in <module>
----> 1 import seaborn
      2 

D:\anaconda3\lib\site-packages\seaborn\__init__.py in <module>
      1 # Capture the original matplotlib rcParams
----> 2 import matplotlib as mpl
      3 _orig_rc_params = mpl.rcParams.copy()
      4 
      5 # Import seaborn objects

D:\anaconda3\lib\site-packages\matplotlib\__init__.py in <module>
    203 
    204 
--> 205 _check_versions()
    206 
    207 

D:\anaconda3\lib\site-packages\matplotlib\__init__.py in _check_versions()
    188     # Quickfix to ensure Microsoft Visual C++ redistributable
    189     # DLLs are loaded before importing kiwisolver
--> 190     from . import ft2font
    191 
    192     for modname, minver in [

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

I faced this error while importing seaborn. What should I do?

@Faizul314 Take a look at the traceback - you can see that the problem happens during matplotlib import, so it is not related specifically to seaborn.

You may find more information somewhere in these issues (on matplotlib's issue pages):
https://github.com/ContinuumIO/anaconda-issues/issues/6689
https://github.com/matplotlib/matplotlib/issues/14558
https://github.com/matplotlib/matplotlib/pull/14316

@Faizul314 was your issue resolved? I am facing the same error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexpetralia picture alexpetralia  ·  3Comments

btyukodi picture btyukodi  ·  3Comments

vinay-jayaram picture vinay-jayaram  ·  3Comments

amelio-vazquez-reina picture amelio-vazquez-reina  ·  4Comments

TDaltonC picture TDaltonC  ·  3Comments