Unable to import fitz (PyMuPDF)

  1. Are you running your app locally or is it deployed?
    Deployed on Streamlit.io

  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform?
    b. Share the link to the public deployed app.
    Deployed on Streamlit, although it is private so it might not be loadable.
    https://rewordify.streamlit.app/

  3. Share the link to your app’s public GitHub repository (including a requirements file).
    GitHub - tkim1205/enable

requirements.txt file:
PyPDF2
openai
fitz

streamlit_app.py file:
import streamlit as st
import fitz

This is all I have, I removed all my functions because the streamlit app won’t deploy due to the “import fitz” command.

  1. Share the full text of the error message (not a screenshot).
    ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)File "/mount/src/enable/streamlit_app.py", line 3, in <module>
    import fitzFile "/home/adminuser/venv/lib/python3.9/site-packages/fitz/__init__.py", line 1, in <module>
    from frontend import *
  1. Share the Streamlit and Python versions.

:rotating_light: Before clicking “Create Topic”, please make sure your post includes the following information (otherwise, the post will be locked). :rotating_light:

  1. Are you running your app locally or is it deployed?
  2. If your app is deployed:
    a. Is it deployed on Community Cloud or another hosting platform?
    b. Share the link to the public deployed app.
  3. Share the link to your app’s public GitHub repository (including a requirements file).
  4. Share the full text of the error message (not a screenshot).
  5. Share the Streamlit and Python versions.

Hi @tkim1205enable,

Thanks for posting!

The fitz library is part of PyMuPDF. So you need to update your requirements.txt file to look like this:

PyPDF2
openai
PyMuPDF  # instead of fitz

More details here. I hope this resolves the error.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.