termpdf.py icon indicating copy to clipboard operation
termpdf.py copied to clipboard

Module fiz

Open wookayin opened this issue 4 years ago • 4 comments

  File "/usr/local/bin/termpdf.py", line 56, in <module>
    import fitz
ModuleNotFoundError: No module named 'fitz'

This is not listed in setup.py.

wookayin avatar Oct 11 '21 19:10 wookayin

For reasons I do not understand, the module provided by PyMuPDF is called 'fitz'. So this error suggests you don't have PyMuPDF installed.

dsanson avatar Dec 29 '21 20:12 dsanson

The same thing happens to me. If I go into a python console it says it fails to import front end. Installing frontend results in this error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/brandon/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/fitz/__init__.py", line 1, in <module>
    from frontend import *
  File "/Users/brandon/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/frontend/__init__.py", line 1, in <module>
    from .events import *
  File "/Users/brandon/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/frontend/events/__init__.py", line 1, in <module>
    from .clipboard import *
  File "/Users/brandon/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/frontend/events/clipboard.py", line 2, in <module>
    from ..dom import Event
  File "/Users/brandon/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/frontend/dom.py", line 439, in <module>
    from . import dispatcher
  File "/Users/brandon/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/frontend/dispatcher.py", line 15, in <module>
    from . import config, server
  File "/Users/brandon/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/frontend/server.py", line 24, in <module>
    app.mount(config.STATIC_ROUTE, StaticFiles(directory=config.STATIC_DIRECTORY), name=config.STATIC_NAME)
  File "/Users/brandon/.asdf/installs/python/3.10.0/lib/python3.10/site-packages/starlette/staticfiles.py", line 53, in __init__
    raise RuntimeError(f"Directory '{directory}' does not exist")
RuntimeError: Directory 'static/' does not exist

Possibly related to this, though I'm not sure how to resolve it. Python Wheel Discussion

typkrft avatar Jan 03 '22 09:01 typkrft

If you're on M1 macOS you need to do brew install mupdf swig freetype (to get the source dependencies) before running pip3 install pymupdf because for some reason there is no pre-compiled Universal wheel provided (see here, though the discussion is somewhat beyond me).

gautampk avatar Jan 16 '22 22:01 gautampk

If you're on M1 macOS you need to do brew install mupdf swig freetype (to get the source dependencies) before running pip3 install pymupdf because for some reason there is no pre-compiled Universal wheel provided (see here, though the discussion is somewhat beyond me).

This unfortunately didn't work for me. I was able in the past to use Rosetta a while back, but keeping up with two brew installations or using non native seemed like a band-aid. It brings me back to the ModuleNotFoundError: No module named 'fitz' error.

typkrft avatar Jan 17 '22 03:01 typkrft