Issues Installing Modules (seaborn & statsmodels)

Hey guys, I'm using Python within pycharm to do some data analysis and statistics. I'd like to use seaborn with statsmodels to do this, however both those modules are failing to install.

Installing both in the GUI or with pip yields no errors, but when trying to import them I get the following error:
"ImportError: DLL load failed: The specified module could not be found."

I would try installing them using Conda, but when trying to install that I get the following error:
"Could not find a version that satisfies the requirement menuinst (from conda) (from versions: none)
No matching distribution found for menuinst (from conda)"

I'm very new to Python so I would be grateful if someone could explain why this is happening and how I can fix it.

Thanks,

Daniel

 

I'm running the latest version of PyCharm on Windows 10

7 comments
Comment actions Permalink

Here's the full console output:

>>> import seaborn
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\seaborn\__init__.py", line 6, in <module>
from .rcmod import *
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\seaborn\rcmod.py", line 5, in <module>
from . import palettes, _orig_rc_params
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\seaborn\palettes.py", line 12, in <module>
from .utils import desaturate, set_hls_values, get_color_cycle
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\seaborn\utils.py", line 7, in <module>
from scipy import stats
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\__init__.py", line 379, in <module>
from .stats import *
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\stats.py", line 180, in <module>
import scipy.special as special
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\special\__init__.py", line 641, in <module>
from ._ufuncs import *
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: The specified module could not be found.
import statsmodels.api as sm
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\statsmodels\api.py", line 7, in <module>
from . import regression
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\statsmodels\regression\__init__.py", line 1, in <module>
from .linear_model import yule_walker
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\statsmodels\regression\linear_model.py", line 39, in <module>
from scipy.linalg import toeplitz
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\__init__.py", line 195, in <module>
from .misc import *
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\blas.py", line 214, in <module>
from scipy.linalg import _fblas
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: The specified module could not be found.
0
Comment actions Permalink

Hello Daniel,

Could you please provide me with screenshots:

1. PyCharm | Preferences | Build, Execution, Deployment | Console | Python Console

2. PyCharm | Preferences | Project Interpreter   

Do you see the packages present in the list? 

 

 

 

 

0
Comment actions Permalink

Same here.

 

`setup.py clean` is not supported, use one of the following instead:

- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
files that aren't checked into the git repo)

Add `--force` to your command to use it anyway if you must (unsupported).


----------------------------------------
Failed to build scipy

Failed building wheel for scipy
Failed cleaning build dir for scipy
Could not build wheels for scipy which use PEP 517 and cannot be installed directly

0
Comment actions Permalink

Dear Antonina Belianskaya,

 

Please see attached the requested screenshots. I assume you meant File > Settings not PyCharm > Preferences? Please note that I have not made any configuration changes as far as I know, other than installing some packages. I do see the referenced packages yes, as can be seen in the screenshot below.

 

Thank you for your support!

 

0
Comment actions Permalink

Hello Daniel,

Could you please try importing a package from the system terminal (outside of PyCharm) using the same interpreter/environment:

  1. Go to File | Settings | Project: <project_name> | Project Interpreter (Preferences | Project: <project_name> | Project Interpreter for macOS) to find where your environment/interpreter is located;

  2. Open your system terminal/cmd prompt and activate the same environment;

  3. run import seaborn

 

Also, please try to re-create a virtual environment in PyCharm and check if there are any differences.

 

0
Comment actions Permalink

Dear Antonina Belianskaya,

Thanks for the tips. I should mention that I've tried this on another computer and it works, but I can see no reason it wouldn't work on this instance of Windows too.

I've followed the steps you provided, navigating to the interpreter folder and running the python.exe and trying to install the modules, but unfortunately I'm still getting "ImportError: DLL load failed: The specified module could not be found." When trying to run code reliant on them. Here is an example:

"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\python.exe" "C:/Users/Daniel/OneDrive - CIRCLE COMPUTERS LTD/Documents/Cranfield/Flight Experimental Methods/C1.3.2/ooh boy.py"
Traceback (most recent call last):
File "C:/Users/Daniel/OneDrive - CIRCLE COMPUTERS LTD/Documents/Cranfield/Flight Experimental Methods/C1.3.2/ooh boy.py", line 5, in <module>
import statsmodels.api as sm
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\statsmodels\api.py", line 7, in <module>
from . import regression
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\statsmodels\regression\__init__.py", line 1, in <module>
from .linear_model import yule_walker
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\statsmodels\regression\linear_model.py", line 39, in <module>
from scipy.linalg import toeplitz
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\__init__.py", line 195, in <module>
from .misc import *
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs
File "C:\Users\Daniel\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\blas.py", line 214, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.

I have also tried changing the environment by making new ones and as shown above switching to the base interpreter.

 

Thanks again for any help. I am not sure why this is happening, clearly something is not installing or being set up as intended.

0
Comment actions Permalink

Hello Daniel, 

If the issue is reproducible out of IDE, it confirms it caused by other components and not related to PyCharm. 

I would recommend using  external resources to find a solution, for example: https://github.com/pytorch/pytorch/issues/9263 or https://stackoverflow.com/questions/43549269/seaborn-importerror-dll-load-failed-the-specified-module-could-not-be-found

https://github.com/mwaskom/seaborn/issues/924

 

 

0

Please sign in to leave a comment.