from matplotlib import ft2font: "ImportError: DLL load failed: The specified procedure could not be found."
Asked Answered
S

13

18

I have Windows 7.

For some reason, f2tfont.cpp does not compile when installing matplotlib (through pip), hence, the matplotlib install fails. Also, the matplotlib installer cannot find a Python installation.

See comments here for further details on the problem.

Semitics answered 16/6, 2014 at 19:49 Comment(0)
S
24

These following commands worked for me. I think problem is with the new matplotlib version 3.3.1. I downgraded to matplotlib 3.0.3.

I uninstalled the newer version, then reopen command prompt and installed matplotlib 3.0.3. It's worked for me. I am not sure if it will work for you, so I recommend to check out the discussion.

pip uninstall matplotlib
pip install matplotlib==3.0.3
Strawser answered 16/8, 2020 at 9:8 Comment(3)
On Windows 10, using virtual env with miniconda, and python 3.7, down grading to matplotlib-3.0.3 worked for me.Revisal
Someone hand this person a medal. Out of all the internet's solution this simple one did the job. Thank you so much.Sousa
Things changed. Your method does not work now. ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Consider an update to your answer?Sin
S
8

This solves my problem

As a workaround until matplotlib 3.1.1 is released, you could install this package msvc-runtime using the following command:

pip install msvc-runtime
Sanjiv answered 1/10, 2020 at 11:28 Comment(1)
Would be nice to show your ref. github.com/matplotlib/matplotlib/issues/…Globule
C
5

This worked for me on Windows 10 (using the Anaconda prompt):

pip uninstall matplotlib
pip install --upgrade matplotlib
Cootie answered 4/11, 2019 at 15:24 Comment(0)
U
5

This worked for me on Windows 10:

pip install matplotlib==3.2.1
Unmanly answered 9/1, 2021 at 19:23 Comment(0)
H
4

As specified in PEP 11, a Python release only supports a Windows platform while Microsoft considers the platform under extended support. This means that Python 3.7 supports Windows Vista and newer. If you require Windows XP support then please install Python 3.4.

  1. For Python 3.6+ you need to have Windows Service Pack 1 installed.

enter image description here

In case Windows Service Pack isn't installed. You can download Windows 7 Service Pack 1 (SP1) manually from here or also you can download it from Windows Update of Windows 7.

  1. Python needs the Microsoft C runtime for Visual Studio 2015, especially the file ucrtbase.dll.

    enter image description here

So, you need to install Microsoft Visual C++ redistribution 2015 from here.

You don't need to install Microsoft Visual Studio just C++ redistributions of 2015 will do the job.

Honeydew answered 16/5, 2020 at 17:51 Comment(0)
C
4

You need to have Visual Studio c++ in Your System.

Install Visual Studio 2019 with c++ distributions .

It worked perfectly for me.

Cloud answered 21/8, 2020 at 6:42 Comment(2)
installing visual studio c++ is what fixed it for me (win10, python 3.9.1, matplotlib 3.3.3) direct link to visual studio c++ x64 download hereLotetgaronne
Worked for me as well, (win10, python 3.7.4, matplotlib 3.2.1)Heath
J
3

I had this issue and then uninstalled and reinstalled conda, and updated all packages through conda. But the issue persisted. I then did a conda uninstall of the offending package (in my case, this error appeared for both matplotlib and h5py), and then pip installed them. This seemed to have fixed the issue. Strangely, it would only give this error through the console. When run through a Jupyter notebook, I didn't see this error. Must be some difference between IPython and python.

Jews answered 5/6, 2018 at 16:52 Comment(0)
H
2

If you get this error by just importing matplotlib, you probably have a botched matplotlib installation. Did you compile it yourself (which I find very hard to do) or did you use a binary installer from the official page (which works like a charm, as long as you installed the dependencies beforehand)?

DO NOT USE pip for installing matplotlib and numpy, but use it for all other dependencies. This may change in the future as soon as wheels arecoming out for matplotlib.

Python console output on a Windows box:

>>> matplotlib.__version__
'1.3.1'
>>> from matplotlib import ft2font
>>>
Honkytonk answered 16/6, 2014 at 20:43 Comment(12)
I used the python(x,y) installer to get matplotlib. I know it's not a problem with the installer because I used the same installer on another computer, and everything works fine. How would you suggest I go about fixing my botched install?Semitics
I have no experience with python(x,y) (I contemplated it once but found no real advantage over installing everything by hand). You should update your original question by mentioning python(x,y). I would try to uninstall python(x,y) completely (delete remnants on the file system by hand, if necessary) and start from fresh. If the problem persists, you could try another python distribution like anaconda.Honkytonk
I just really like Spyder to be honest. Nothing has come close to beating it for me, in terms of user experience.Semitics
That's funny because Spyder has been the worst python experience ever (worse than IDLE) and I have been happy with PyDev since. Maybe I should try it again. But back to your problem: Have you tried reinstalling at least matplotlib package for python(x,y)?Honkytonk
Sigh. I tried uninstalling the matplotlib package. I couldn't re-install it using the installer from the matplotlib website, because "Python 2.7 was not found in registry"...so...I tried to install it using pip, and it turns out that pip has trouble building ft2font.cpp. Alright, well, I tried to completely uninstall python(x,y). I then used the Python windows installer in an attempt to repair things. No luck.Semitics
I then uninstalled everything, and manually deleted as much as I could from the registry, and from the C:\ drive (where I install Python). I try reinstalling everything. Still the same problem -- matplotlib installer says there is no Python 2.7 installed, and pip has the same issue. I try to use the registry patches provided here, in an attempt to fix the registry...*but the matplotlib installer still says I don't have Python 2.7 installed*...Semitics
I am pretty dejected, and not sure what I should do. My problems really started when I tried out Enthought Canopy (I got an academic license). I didn't like it much, so I uninstalled it, but...nothing has been right since. I tried to delete all the Enthought registry keys as well after uninstall, so I feel that things should be clean..Semitics
Going to try installing Anaconda...wish me luck!Semitics
Ok, as it seems something is weird with your python installation. What does happen (give version and 32/64 bits) when you type python on your command line (or C:\Python27\python if it is not on the path)?Honkytonk
Well, now I have Anaconda installed. When I type in python, I get: Python 2.7.7 |Anaconda 2.0.1 (32-bit)| (default, Jun 11 2014, 10:41:43) [MSC v.1500 32 bit (Intel)] on win32.Semitics
Interestingly, I can now also import matplotlib. However, the matplotlib installer still believes Python is not installed anywhere.Semitics
Let us continue this discussion in chat.Honkytonk
C
2

I am running windows 7 with Python version 3.7.1 and Pip version 19.1.1

I needed to install Microsoft visual studio. Microsoft visual studio is needed for the kiwisolver that is installed with matplotlib using pip. It is free but a 4MB download took over one to two hours to get on my machine and installed.

After using pip to install matplotlib, but without visual studio on my machine, running my script with

import matplotlib.pyplot as plt

the error I had was:

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

After installing visual studio everything worked great!

Get Microsoft visual studio here.

Cydnus answered 1/7, 2019 at 17:0 Comment(0)
C
2

None of above solutions worked for me! Try this:

pip uninstall matplotlib
pip install -U matplotlib==3.2.0rc1
Cerebellum answered 20/8, 2020 at 13:10 Comment(1)
Thank you! This was an instant fix for me on windows 10 and python 3.8Quattrocento
B
1

If you are getting error each time u try installing matplotlib on ur pc through jupyter, just down download the ccleaner and then click on the health check icon after installation, followed by the custom clean to check for duplicated files causing the issue, then go back to install the matplotlib through anaconda command prompt by typing pip install matplotlib

Babbittry answered 20/5, 2021 at 9:57 Comment(0)
K
0

to me i solved the problem by uninstalling python 3.8 and installed python 3.5

Kamilah answered 29/10, 2020 at 13:53 Comment(0)
T
0

just install "Microsoft Visual C++ redistributable"

Tadpole answered 22/12, 2020 at 11:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.