Forums

Importing fitz

Hi there

I am trying to get code which works fine locally working with flask on pythonanywhere.

My code depends on the fitz module which is also known as PyMuPDF. The module is sitting in my home directory.

When trying to run my code I get the following error:

cannot import name '_fitz' from partially initialized module 'fitz' (most likely due to a circular import)

Currently the fitz module is sitting in a folder named "fitz" in the mysite directory alongside flask_app.py.

Looking at this thread (https://github.com/pymupdf/PyMuPDF/issues/430) there may be a need to deploy this package "as a deployment package" , equivalent to AWS's. I don't know how to do this on pythonanywhere. Any help appreciated.

did you run into any errors when you were building PyMuPDF? perhaps don't name it fitz and instead name it something else?