Error importing DocTest.VisualTest Library

I have a problem with DocTest.VisualTest library: Error importing library ‘DocTest.VisualTest’: ImportError: Error loading DLL when importing _extra.
The message in the robot is: No keyword found with name ‘Compare Images’.

I tried several ways and I can’t find the solution
I’m using PyCharm Community Edition
What can I do?

Have you checked the installation instructions?
Are you running on windows?

The error is on Windows 10. It does not occur on Windows 11.

ImportError: DLL load failed while importing extra: The specified module cannot be found.
Traceback (most recent call last):
File “C:\code\VMRSeriesTest.venv\Lib\site-packages\DocTest\VisualTest.py”, line 2, in
from DocTest.CompareImage import CompareImage
File “C:\code\VMRSeriesTest.venv\Lib\site-packages\DocTest\CompareImage.py”, line 19, in
import fitz
File "C:\code\VMRSeriesTest.venv\Lib\site-packages\fitz_init
.py", line 2, in
from pymupdf import *
File “C:\code\VMRSeriesTest.venv\Lib\site-packages\pymupdf_init_.py”, line 30, in
from . import extra
File “C:\code\VMRSeriesTest.venv\Lib\site-packages\pymupdf\extra.py”, line 10, in
from . import _extra

I’m using Python 3.12 (Windows 10) and the instructions for installing on Windows don’t mention this error.

mhm, interesting.
Could you please do a “pip list” and give the versions of robotframework-doctestlibrary and pymupdf ?

I’m also seeing this error on the PyMuPDF site:

Package Version


comtypes 1.4.9
deepdiff 8.2.0
imageio 2.37.0
imutils 0.5.4
lazy_loader 0.4
lxml 5.3.0
MouseInfo 0.1.3
networkx 3.4.2
numpy 1.26.4
opcua 0.98.13
opencv-python-headless 4.11.0.86
orderly-set 5.3.0
packaging 24.2
parsimonious 0.10.0
pillow 11.1.0
pip 23.2.1
PyAutoGUI 0.9.54
PyGetWindow 0.0.9
pylibdmtx 0.1.10
PyMsgBox 1.0.9
PyMuPDF 1.25.2
pyperclip 1.9.0
PyRect 0.2.0
PyScreeze 1.0.1
pytesseract 0.3.13
python-dateutil 2.9.0.post0
pytweening 1.2.0
pytz 2025.1
pywin32 308
pywinauto 0.6.9
pyzbar 0.1.9
regex 2024.11.6
robotframework 7.2
robotframework-doctestlibrary 0.23.0
scikit-image 0.25.1
scipy 1.15.1
setuptools 75.8.0
six 1.17.0
tifffile 2025.1.10
Wand 0.6.13

Could you try to install pymupdf with a lower version, like
pip install pymupdf==1.24.14
Just wondering if something changed there…

Also seeing the issue reported here at PyMuPDF

There it was mentioned that installing pymupdf==1.24.9 could solve it.
But still I’d love to figure out the root cause…

Running pip pymupdf==1.24.9
the same error: No keyword with name ‘Compare Images’ found.

I’m going to try using python 3.11

It should work with Python 3.12 as well.
I have the strong feeling that it is caused by a missing Visual C++ Redistributable package.
Below you can find a screenshot from my machine.

Maybe you can compare with your Windows 11 machine where it is working.

Here it is definitely the same problem reported at PyMuPDF

2 Likes

I have just recently discovered that when installing Python from Microsoft Store, the Visual C++ library is missing.

(Here is my video about the installation of RIDE where I have found that problem.)

1 Like

I installed Visual C++ Redistributable package x86 and x64.
Then I uninstalled everything with: pip freeze > out.txt
pip uninstall -r out.txt -y
and then reinstalled everything again
robotframework==7.2
robotframework-doctestlibrary==0.23.0
pyautogui==0.9.54
pywinauto==0.6.9

and it worked!!!
thanks for the help!

2 Likes