bzm3r
bzm3r

Reputation: 4605

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

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.

Upvotes: 18

Views: 69053

Answers (13)

PETER
PETER

Reputation: 11

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

Upvotes: 1

vramires
vramires

Reputation: 51

This worked for me on Windows 10:

pip install matplotlib==3.2.1

Upvotes: 5

Phonix
Phonix

Reputation: 2217

just install "Microsoft Visual C++ redistributable"

Upvotes: 0

mostafa adel
mostafa adel

Reputation: 11

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

Upvotes: 0

Qazi Haseeb Yousaf
Qazi Haseeb Yousaf

Reputation: 81

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

Upvotes: 8

code_conundrum
code_conundrum

Reputation: 599

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

Upvotes: 24

findtharun
findtharun

Reputation: 146

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

Install Visual Studio 2019 with c++ distributions .

It worked perfectly for me.

Upvotes: 4

Tabaraei
Tabaraei

Reputation: 495

None of above solutions worked for me! Try this:

pip uninstall matplotlib
pip install -U matplotlib==3.2.0rc1

Upvotes: 2

Zahid Khan
Zahid Khan

Reputation: 3277

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.

Upvotes: 4

Hagbard
Hagbard

Reputation: 3700

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

pip uninstall matplotlib
pip install --upgrade matplotlib

Upvotes: 5

P_freak
P_freak

Reputation: 21

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.

Upvotes: 2

Rama Vasudevan
Rama Vasudevan

Reputation: 29

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.

Upvotes: 3

nepix32
nepix32

Reputation: 3177

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
>>>

Upvotes: 2

Related Questions