Zain-Bin-Arshad/pdf-viewer

Requirements problems

NicolasMICAUX opened this issue · 4 comments

Hi,
I ran
git clone https://github.com/Zain-Bin-Arshad/pdf-viewer.git cd pdf-viewer/ pip install -r requirements.txt

i got errors :
Traceback (most recent call last): File "pdfviewer.py", line 40, in <module> import fitz File "/xxxxx/venv/lib/python3.8/site-packages/fitz/__init__.py", line 1, in <module> from frontend import * ModuleNotFoundError: No module named 'frontend'
related to https://stackoverflow.com/questions/56467667/how-do-i-resolve-no-module-named-frontend-error-message

you also forgot to mention the python version you're using. I think it's 2.7 ?

Using python 2.7 venv, pip install -r requirements.txt returns compilation errors on linux.

ERROR: Command errored out with exit status 1:
   command: /xxxxxxxxxx/venv/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1ddHG9/pymupdf/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1ddHG9/pymupdf/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-CrAJvS
       cwd: /tmp/pip-install-1ddHG9/pymupdf/
  Complete output (20 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/fitz
  copying fitz/__init__.py -> build/lib.linux-x86_64-2.7/fitz
  copying fitz/fitz.py -> build/lib.linux-x86_64-2.7/fitz
  copying fitz/utils.py -> build/lib.linux-x86_64-2.7/fitz
  copying fitz/__main__.py -> build/lib.linux-x86_64-2.7/fitz
  running build_ext
  building 'fitz._fitz' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/fitz
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-U5f0ID/python2.7-2.7.18=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -Imupdf/thirdparty/freetype/include -I/usr/include/python2.7 -c fitz/fitz_wrap.c -o build/temp.linux-x86_64-2.7/fitz/fitz_wrap.o
  fitz/fitz_wrap.c:2767:10: fatal error: fitz.h: Aucun fichier ou dossier de ce type
   2767 | #include <fitz.h>
        |          ^~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ERROR: Failed building wheel for PyMuPDF

I was very impressed by your PDF viewer screenshots, so I would love to use your code.

Thx a lot.
N. M.

Hello, I used python 3.7.4. Thanks for the remainder I added this to the README file. Talking about your issue, follow the steps mentioned in the link that you already mentioned. I remember that I faced similar issue and I followed solution mentioned here: https://stackoverflow.com/questions/56467667/how-do-i-resolve-no-module-named-frontend-error-message and it solved my issue.

As stated there the issue is that there is a package named fitz on PyPI. Because PyMuPDF uses the same name, fitz, as its top-level text, both packages cannot co-exist in the same Python. Let me know if have any other issue. Thanks

Thanks you so much for answering so fast. Testing all this tomorrow and I tell you. Thx a lot.

I solved the error by running pip install PyMuPDF==1.16.14.
The other solutions (just pip install PyMuPDF or changing from frontend to fitz.frontend didn't work for me)

I also downgraded my python version from 3.8 to 3.7 but not sure that is the pb

Again thx you !