# Error importing DocTest.VisualTest Library

**URL:** <https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407>\
**Category:** Libraries\
**Created:** [5 February 2025 12:42 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407 "2025-02-05T12:42:17Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Leo](https://forum.robotframework.org/u/Leo)\
**Post date:** [5 February 2025 12:42 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/1 "2025-02-05T12:42:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Many](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/many/32/658_2.png) [@Many](https://forum.robotframework.org/u/Many)\
**Post date:** [5 February 2025 12:48 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/2 "2025-02-05T12:48:54Z")

</div>

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

> **[GitHub - manykarim/robotframework-doctestlibrary: Robot Framework DocTest library. Simple Automated...](https://github.com/manykarim/robotframework-doctestlibrary?tab=readme-ov-file#windows-error-message-regarding-pylibdmtx)**
>
> Robot Framework DocTest library. Simple Automated Visual Document Testing.

---

<div class="post-metadata">

**Author:** ![Leo](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Leo](https://forum.robotframework.org/u/Leo)\
**Post date:** [5 February 2025 13:16 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/3 "2025-02-05T13:16:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Leo](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Leo](https://forum.robotframework.org/u/Leo)\
**Post date:** [5 February 2025 13:22 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/4 "2025-02-05T13:22:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Many](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/many/32/658_2.png) [@Many](https://forum.robotframework.org/u/Many)\
**Post date:** [5 February 2025 13:43 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/5 "2025-02-05T13:43:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Many](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/many/32/658_2.png) [@Many](https://forum.robotframework.org/u/Many)\
**Post date:** [5 February 2025 13:46 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/6 "2025-02-05T13:46:06Z")

</div>

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

> **[Installation - PyMuPDF 1.25.2 documentation](https://pymupdf.readthedocs.io/en/latest/installation.html#problems-after-installation)**
>
> PyMuPDF is a high-performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.

---

<div class="post-metadata">

**Author:** ![Leo](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Leo](https://forum.robotframework.org/u/Leo)\
**Post date:** [5 February 2025 13:53 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/7 "2025-02-05T13:53:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Many](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/many/32/658_2.png) [@Many](https://forum.robotframework.org/u/Many)\
**Post date:** [5 February 2025 14:04 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/8 "2025-02-05T14:04:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Many](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/many/32/658_2.png) [@Many](https://forum.robotframework.org/u/Many)\
**Post date:** [5 February 2025 14:07 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/9 "2025-02-05T14:07:11Z")

</div>

Also seeing the issue reported here at PyMuPDF

> <https://github.com/pymupdf/PyMuPDF/issues/3598>
>
> \### Description of the bug
> 
> Tried reinstalling, changed policy in powershell but… nothing have worked so far.
> 
> 
> Error log:
> 
> \---------------------------------------------------------------------------
> ImportError Traceback (most recent call last)
> Cell In\[29\], \[line 1\](vscode-notebook-cell:?execution\_count=29&line=1)
> \----\> \[1\](vscode-notebook-cell:?execution\_count=29&line=1) import fitz # PyMuPDF
> \[3\](vscode-notebook-cell:?execution\_count=29&line=3) def test\_pymupdf():
> \[4\](vscode-notebook-cell:?execution\_count=29&line=4) try:
> 
> File c:\\Users\\thiag\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\fitz\\\_\_init\_\_.py:2
> \[1\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/fitz/\_\_init\_\_.py:1) # pylint: disable=wildcard-import,unused-import,unused-wildcard-import
> \----\> \[2\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/fitz/\_\_init\_\_.py:2) from pymupdf import \*
> \[3\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/fitz/\_\_init\_\_.py:3) from pymupdf import \_as\_fz\_document
> \[4\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/fitz/\_\_init\_\_.py:4) from pymupdf import \_as\_fz\_page
> 
> File c:\\Users\\thiag\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pymupdf\\\_\_init\_\_.py:29
> \[26\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:26) import weakref
> \[27\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:27) import zipfile
> \---\> \[29\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:29) from . import extra
> \[32\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:32) # Set up g\_out\_log and g\_out\_message from environment variables.
> \[33\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:33) #
> \[34\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:34) # PYMUPDF\_MESSAGE controls the destination of user messages (the \`message()\`
> (...)
> \[43\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:43) # stdout.
> \[44\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:44) #
> \[46\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/\_\_init\_\_.py:46) def \_set\_stream(name, default):
> ...
> \---\> \[10\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/extra.py:10) from . import \_extra
> \[11\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/extra.py:11) else:
> \[12\](file:///C:/Users/thiag/AppData/Local/Programs/Python/Python311/Lib/site-packages/pymupdf/extra.py:12) import \_extra
> 
> ImportError: DLL load failed while importing \_extra: The specified module could not be found.
> 
> \### How to reproduce the bug
> 
> pip install pymupdf
> 
> 
> import fitz 
> 
> def test\_pymupdf():
> try:
> doc = fitz.open("iec60730\_sample\_pics.pdf")
> print("PDF opened successfully")
> except Exception as e:
> print(f"An error occurred: {e}")
> 
> test\_pymupdf()
> 
> \### PyMuPDF version
> 
> 1.24.5
> 
> \### Operating system
> 
> Windows
> 
> \### Python version
> 
> 3.11

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

---

<div class="post-metadata">

**Author:** ![Leo](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Leo](https://forum.robotframework.org/u/Leo)\
**Post date:** [5 February 2025 14:26 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/10 "2025-02-05T14:26:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Leo](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Leo](https://forum.robotframework.org/u/Leo)\
**Post date:** [5 February 2025 14:30 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/11 "2025-02-05T14:30:56Z")

</div>

I’m going to try using python 3.11

---

<div class="post-metadata">

**Author:** ![Many](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/many/32/658_2.png) [@Many](https://forum.robotframework.org/u/Many)\
**Post date:** [5 February 2025 14:40 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/12 "2025-02-05T14:40:50Z")

</div>

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.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/d/dabb53693784aae2db83646bf97ef4b994dd566b.png)

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

---

<div class="post-metadata">

**Author:** ![Many](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/many/32/658_2.png) [@Many](https://forum.robotframework.org/u/Many)\
**Post date:** [5 February 2025 14:43 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/13 "2025-02-05T14:43:17Z")

</div>

Here it is definitely the same problem reported at PyMuPDF

> <https://github.com/pymupdf/PyMuPDF/issues/2678>
>
> system:Windows 10 64
> python:Python 3.10.11 amd64
> pypdf:1.23.3
> 
> after use pip… install PyMuPdf,get error
> 
> Type "help", "copyright", "credits" or "license" for more information.
> \>\>\> import fitz
> Traceback (most recent call last):
> File "\<stdin\>", line 1, in \<module\>
> File "C:\\Users\\yuc\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\fitz\\\_\_init\_\_.py", line 22, in \<module\>
> from fitz.fitz import \*
> File "C:\\Users\\yuc\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\fitz\\fitz.py", line 14, in \<module\>
> from . import \_fitz
> ImportError: DLL load failed while importing \_fitz: 找不到指定的模块。

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [5 February 2025 16:36 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/14 "2025-02-05T16:36:14Z")

</div>

> [@Many](#):
>
> I have the strong feeling that it is caused by a missing Visual C++ Redistributable package.

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.](https://youtu.be/lwFrSOabn-g))

---

<div class="post-metadata">

**Author:** ![Leo](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@Leo](https://forum.robotframework.org/u/Leo)\
**Post date:** [5 February 2025 16:51 UTC](https://forum.robotframework.org/t/error-importing-doctest-visualtest-library/8407/15 "2025-02-05T16:51:01Z")

</div>

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!
