dsanson / termpdf.py

A graphical pdf and epub reader that works inside the kitty terminal
MIT License
496 stars 30 forks source link

Module fiz #17

Open wookayin opened 2 years ago

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

This is not listed in setup.py.

dsanson commented 2 years ago

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

typkrft commented 2 years ago

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

gautampk commented 2 years ago

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).

typkrft commented 2 years ago

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.