Import Error: DLL load failed: The specified module could not be found
Title
Question
Sir/ Madam,
While I am entering "import matplotlib" command in ipython3, it shows the following:
Microsoft Windows [Version 10.0.17134.1667]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\DELL>ipython3
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import numpy
In [2]: import matplotlib
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-0484cd13f94d> in <module>
----> 1 import matplotlib
c:\users\dell\appdata\local\programs\python\python36\lib\site-packages\matplotlib\__init__.py in <module>
172
173
--> 174 _check_versions()
175
176
c:\users\dell\appdata\local\programs\python\python36\lib\site-packages\matplotlib\__init__.py in _check_versions()
157 # Quickfix to ensure Microsoft Visual C++ redistributable
158 # DLLs are loaded before importing kiwisolver
--> 159 from . import ft2font
160
161 for modname, minver in [
ImportError: DLL load failed: The specified module could not be found.
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\DELL>ipython3
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import numpy
In [2]: import matplotlib
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-0484cd13f94d> in <module>
----> 1 import matplotlib
c:\users\dell\appdata\local\programs\python\python36\lib\site-packages\matplotlib\__init__.py in <module>
172
173
--> 174 _check_versions()
175
176
c:\users\dell\appdata\local\programs\python\python36\lib\site-packages\matplotlib\__init__.py in _check_versions()
157 # Quickfix to ensure Microsoft Visual C++ redistributable
158 # DLLs are loaded before importing kiwisolver
--> 159 from . import ft2font
160
161 for modname, minver in [
ImportError: DLL load failed: The specified module could not be found.
Ultimately I am unable to run %pylab.
Python-3.4.3 Using-plot-command-interactively 01-02 min 50-60 sec
Answers:
Installing the Visual C++ Redistributable for Visual Studio 2015 from the link given below may solve the problem. <a href="https://www.microsoft.com/en-US/download/details.aspx?id=48145" target="" title="">https://www.microsoft.com/en-US/download/details.aspx?id=48145</a> Please let us know if you face any problem.
It looks like the environment variables have become corrupt after the update. The solution is to provide the python interpreter with the path-to-your-module. The simplest solution is to append that <a href="http://net-informations.com/python/intro/path.htm" target="" title="python path">python path</a> to your sys.path list. In your notebook, first try:
import sys
sys.path.append('my/path/to/module/folder')
This isn't a permanent change in sys.path, because when you log out, your environment is reset, so any variables you may have set are lost.
The better (and more permanent) way to solve this is to set your PYTHONPATH, which provides the interpreter with additional directories look in for python packages/modules.
from BASH type: export PYTHONPATH=/path/to/new/folder:/another/path/...../ #each path must be separated by a colon
Login to add comment