Trying to run python script that have import fitz cause an error if used with virtualenv with python 3.8.
Create virtualenv using python 3.8.
pip install pymupdf
add import fitz at the beginning of the file
observe stacktrace
Traceback (most recent call last):
File "process.py", line 80, in <module>
main()
File "process.py", line 56, in main
import fitz
File "/home/adam/venvs/p3/lib/python3.8/site-packages/fitz/__init__.py", line 1, in <module>
from frontend import *
File "/home/adam/venvs/p3/lib/python3.8/site-packages/frontend/__init__.py", line 1, in <module>
from .events import *
File "/home/adam/venvs/p3/lib/python3.8/site-packages/frontend/events/__init__.py", line 1, in <module>
from .clipboard import *
File "/home/adam/venvs/p3/lib/python3.8/site-packages/frontend/events/clipboard.py", line 2, in <module>
from ..dom import Event
File "/home/adam/venvs/p3/lib/python3.8/site-packages/frontend/dom.py", line 439, in <module>
from . import dispatcher
File "/home/adam/venvs/p3/lib/python3.8/site-packages/frontend/dispatcher.py", line 15, in <module>
from . import config, server
File "/home/adam/venvs/p3/lib/python3.8/site-packages/frontend/server.py", line 24, in <module>
app.mount(config.STATIC_ROUTE, StaticFiles(directory=config.STATIC_DIRECTORY), name=config.STATIC_NAME)
File "/home/adam/venvs/p3/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
raise RuntimeError(f"Directory '{directory}' does not exist")
It should import library
print(sys.version, "\n", sys.platform, "\n")
3.8.3 (default, May 17 2020, 18:15:42)
[GCC 10.1.0]
linux
I can't provide fitz.__doc__ because importing does not work :)
For example, the output of print(sys.version, "\n", sys.platform, "\n", fitz.__doc__) would be sufficient (for the first two bullets).
It works with python 3.6 venv.
The error lines quoted from __init__.py are not contained in PyMuPDF. They demonstrate that you have installed a package named fitz in the same Python where PyMuPDF resides. This _cannot coexist with PyMuPDF_ which has a top-level name of fitz as well.
@akjanik, Hi Adam, how have you managed to solve the issue? I got the same issue, pl. shed a light.
@G4al I have created new venv and run just
pip install pymupdf
without running
pip install fitz
Most helpful comment
@G4al I have created new venv and run just
without running