Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation headaches on Mac and Windows #51

Open
bordaigorl opened this issue Feb 20, 2022 · 8 comments
Open

Installation headaches on Mac and Windows #51

bordaigorl opened this issue Feb 20, 2022 · 8 comments

Comments

@bordaigorl
Copy link

Hi. I like this package for the functionality it provides, thanks for your work.

TLDR: After some fiddling I was able to use the package and it provides exactly what my app needs.
However installing it required some hacks and I don't know how to reliably install the package on other systems.
Moreover I was unable to use pyinstaller to bundle the app.


I am developing a PyQt5 app that needs to render PDF pages.
This package provides just what I needed.
My first issue with it was installing it on my system (MacOs 10.15, Python 3.8.2, Qt 5.15.2).
What I did after some trial&error was:

brew install cmake poppler-qt5
pip install git+git://github.com/frescobaldi/python-poppler-qt5@92e5962ec3751ab051d0b655fd61afc7a1cf709e

For reasons that are not clear to me to make that work I had to manually link the directory of PyQt5-stubs so that it could be found by python-poppler-qt5.

After that I can run my app and it works perfectly.
I would not know where to start, however, in giving instructions to reliably replicate the installation on other machines.
In the trial and error phase I also managed to get all the error messages mentioned in building/installation issues on this repo, suggesting those are still not addressed.

To make this worse, even after installing the library on my system, I cannot successfully bundle the app with pyinstaller. That is, I can produce a bundle but it will crash when the features using python-poppler-qt5 are exercised. I am not familiar enough with the internals of pyinstaller to really figure out what goes wrong, but maybe it has trouble bundling poppler?

Finally, I tried to install python-poppler-qt5 on Windows, but I am clueless about how to install the dependencies (e.g. poppler) so that the installation through pip works.

I guess #42 would help with this?

I am at this point stumped and would appreciate some advice for how to approach the problem.

@fedelibre
Copy link
Member

fedelibre commented Feb 23, 2022

I guess #42 would help with this?

Yes. I did a try but always found some problems.
The images to build the wheels use old software on purpose, because this allows the binaries to be run on as many hardware as possible. But current python-poppler-qt5 needs more up-to-date dependencies than those present in those images.
Unfortunately I could not find more recent images of... cibuildwheel (IIRC).

If you are interested to work on it, tonight I can check better and send links to what I did.

@bordaigorl
Copy link
Author

Thanks for the update!
I have to admit I am pretty clueless about how this wheels business works, but I guess it's never too late to learn.
If you can give me some pointers to learn how this works and what you tried I can have a go at it, with no promise of a timeframe/success.

@fedelibre
Copy link
Member

For reasons that are not clear to me to make that work I had to manually link the directory of PyQt5-stubs so that it could be found by python-poppler-qt5.

After that I can run my app and it works perfectly. I would not know where to start, however, in giving instructions to reliably replicate the installation on other machines. In the trial and error phase I also managed to get all the error messages mentioned in building/installation issues on this repo, suggesting those are still not addressed.

You didn't take any note, did you?

I've restarted my work on cibuildwheel, see my cibuildwheel branch. Building wheels for Linux is easy, while Mac and Windows are giving me headaches. Especially Mac, as I don't have a Mac to test and check where files are.

I think my current problem with Mac is the path of qmake. If you see the logs of the latest build, there's this error:

 File "/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-build-env-eiwl0juu/overlay/lib/python3.7/site-packages/pyqtbuild/builder.py", line 70, in apply_user_defaults
        "specify a working qmake or add it to PATH")
    sipbuild.pyproject.PyProjectOptionException
    error: subprocess-exited-with-error
    
    × Preparing metadata (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> See above for output.

This happened with the following options in pyproject.toml:

[tool.cibuildwheel.macos]
before-build = "brew install qt@5 poppler-qt5"
environment = "PATH=$PATH:/usr/local/opt/qt/bin QT_SELECT=5"

qmake comes from the homebrew installation.
I found on Internet that in Homebrew the path to qmake is /usr/local/opt/qt/bin/, but I cannot verify that it's (still) true.

@fedelibre
Copy link
Member

Nevermind, on lilypond-user I've been told that the path is /usr/local/opt/qt@5/bin/.

Now looking for the poppler-qt5.pc path...

@fedelibre
Copy link
Member

Now looking for the poppler-qt5.pc path...

For the records, currently it's /usr/local/Cellar/poppler-qt5/22.12.0/lib/pkgconfig.

@celticflute
Copy link

For reasons that are not clear to me to make that work I had to manually link the directory of PyQt5-stubs so that it could be found by python-poppler-qt5.
After that I can run my app and it works perfectly. I would not know where to start, however, in giving instructions to reliably replicate the installation on other machines. In the trial and error phase I also managed to get all the error messages mentioned in building/installation issues on this repo, suggesting those are still not addressed.

You didn't take any note, did you?

I've restarted my work on cibuildwheel, see my cibuildwheel branch. Building wheels for Linux is easy, while Mac and Windows are giving me headaches. Especially Mac, as I don't have a Mac to test and check where files are.

I think my current problem with Mac is the path of qmake. If you see the logs of the latest build, there's this error:

 File "/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-build-env-eiwl0juu/overlay/lib/python3.7/site-packages/pyqtbuild/builder.py", line 70, in apply_user_defaults
        "specify a working qmake or add it to PATH")
    sipbuild.pyproject.PyProjectOptionException
    error: subprocess-exited-with-error
    
    × Preparing metadata (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> See above for output.

This happened with the following options in pyproject.toml:

[tool.cibuildwheel.macos]
before-build = "brew install qt@5 poppler-qt5"
environment = "PATH=$PATH:/usr/local/opt/qt/bin QT_SELECT=5"

qmake comes from the homebrew installation. I found on Internet that in Homebrew the path to qmake is /usr/local/opt/qt/bin/, but I cannot verify that it's (still) true.

.........

Hello, All

I know this thread is rather long in the tooth, but it is the closest I can find to what I am experiencing. I am getting an error when pip installing python-poppler-qt5 that is somewhat similar to that above. The guts of Python package installation is beyond me, so I am jut hoping someone has some direction to offer. I am installing Frescobaldi and its dependencies in order as described on frescobaldi.org/download. The previous dependency installs ran without incident, but I get the following when I run pip install python-poppler-qt5:

C:\Users\tcros>pip install python-poppler-qt5
Defaulting to user installation because normal site-packages is not writeable
Collecting python-poppler-qt5
Downloading python-poppler-qt5-21.3.0.tar.gz (28 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
pyproject.toml: line 5: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead
Traceback (most recent call last):
File "C:\Program Files\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
main()
File "C:\Program Files\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 152, in prepare_metadata_for_build_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tcros\AppData\Local\Temp\pip-build-env-rwwiyl9p\overlay\Lib\site-packages\sipbuild\api.py", line 46, in build_wheel
project = AbstractProject.bootstrap('wheel',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tcros\AppData\Local\Temp\pip-build-env-rwwiyl9p\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 92, in bootstrap
project.setup(pyproject, tool, tool_description)
File "C:\Users\tcros\AppData\Local\Temp\pip-build-env-rwwiyl9p\overlay\Lib\site-packages\sipbuild\project.py", line 587, in setup
self.apply_user_defaults(tool)
File "C:\Users\tcros\AppData\Local\Temp\pip-build-env-rwwiyl9p\overlay\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\tcros\AppData\Local\Temp\pip-build-env-rwwiyl9p\overlay\Lib\site-packages\sipbuild\project.py", line 237, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "C:\Users\tcros\AppData\Local\Temp\pip-build-env-rwwiyl9p\overlay\Lib\site-packages\pyqtbuild\builder.py", line 69, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: Failed to remove contents in a temporary directory 'C:\Users\tcros\AppData\Local\Temp\pip-build-env-rwwiyl9p'.
You can safely remove it manually.
...

Any insight would be greatly appreciated.

VITALS:
Windows 10.0.19045.4046
Python 3.12.2
Lilypond 2.24.3
Frescobaldi 3.3.0
python-ly 0.9.7

@jeanas
Copy link
Member

jeanas commented Mar 5, 2024

@celticflute To build python-poppler-qt5 from source (which you implicitly do if you use 'pip install', given that there are no prebuilt packages on PyPI at the moment), you need a C++ compilation environment with Qt including its development headers, qmake, and Poppler with its development headers. (Honestly, I have no idea how to do that on Windows, sorry.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants