0

I successfully ran the command:

pip install pymupdf
Successfully installed pymupdf-1.18.15

However, both

import fitz

and import pymupdf

both output an ModuleNotFoundError.

Why is python giving me a ModuleNotFoundError?

Alan Bagel
  • 818
  • 5
  • 24

1 Answers1

1
  1. According to PyMuPDF Documentation you need to download a wheel file that is specific to your platform (e.g windows, mac, linux). The wheel files can be found on PyMuPDF files.

  2. Make sure to check the correct version of your python running on your system python -V

  3. Once downloaded place it at the root directory of your project.

  4. Then run pip install PyMuPDF-<...>.whl replace PyMuPDF-<...>.whl with the name of the wheel file you have downloaded in (1) above.

  5. Now import fitz should be available in your module.

Makyen
  • 31,849
  • 12
  • 86
  • 121
Musty
  • 41
  • 4
  • It would be better to link to the current, official documentation, which, for [PyMuPDF](//pypi.org/project/PyMuPDF/), is on pymupdf.readthedocs.io. The [current installation documentation](//pymupdf.readthedocs.io/en/latest/installation.html) is different than what's shown on the docs page you've linked in this answer. That doesn't invalidate your statement that it's necessary to install the correct wheel. However, `pip` *should* automatically select and install the correct wheel for the current architecture, or build from source if none is found or the `--no-binary` option is used. – Makyen Aug 18 '21 at 18:33
  • pip install PyMuPDF-<...>.whl throws this error. ERROR: PyMuPDF-1.21.1-cp311-cp311-win_amd64.whl is not a supported wheel on this platform. My laptop config : Windows 11 OS 16 GB RAM, with AMD Ryzen Radeon Graphics Card. tried downloading most approrpiate .whl file, PyMuPDF-1.21.1-cp311-cp311-win_amd64.whl , but refuses to install.! – user76170 Jan 25 '23 at 06:05