close

[Solved] DLL load failed error when importing cv2

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error DLL load failed error when importing cv2 in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How DLL load failed error when importing cv2 Error Occurs?

Today I get the following error DLL load failed error when importing cv2 in python.

How To Solve DLL load failed error when importing cv2 Error ?

  1. How To Solve DLL load failed error when importing cv2 Error ?

    To Solve DLL load failed error when importing cv2 Error Hence you have to manually install the features so that you can get dll related to window media service.

  2. DLL load failed error when importing cv2

    To Solve DLL load failed error when importing cv2 Error Hence you have to manually install the features so that you can get dll related to window media service.

Solution 1

I took a lot of time to solve this error! Run command

pip install opencv-contrib-python

Solution 2

Recently I have faced the similar issue in Azure Windows Server 2012 r2 . Tried all option with and without Anaconda but none of them helped. After lot of findings I found that mfplat.dll was missing which is related to Window Media Service.

Hence you have to manually install the features so that you can get dll related to window media service.

1.Turn windows features on or off

2.Skip the roles screen and directly go to Feature screen

3.Select “Desktop Experience” under “User Interfaces and Infrastructure”

After this all required dll of media services for opencv would be available.

So if you are planning to run your code in cloud(Window Server) then please dont forget to select Desktop Experience feature.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read