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

qpageview could not find PyQt5 #30

Open
abeq opened this issue Sep 15, 2024 · 12 comments
Open

qpageview could not find PyQt5 #30

abeq opened this issue Sep 15, 2024 · 12 comments

Comments

@abeq
Copy link

abeq commented Sep 15, 2024

I want to setup for Frescobaldi as Frescobaldi 3 on https://www.frescobaldi.org/download with Windows11.

I have installed PyQt5 with

python -m pip install PyQt5

Then I try to install qpageview with

pip install qpageview

but return error with

...(snip)
          from PyQt5.QtCore import pyqtSignal, QEvent, QRectF, Qt
      ModuleNotFoundError: No module named 'PyQt5'
...(snip)

Please advise.

@jeanas
Copy link
Member

jeanas commented Sep 15, 2024

Have you followed the instructions at https://github.com/frescobaldi/frescobaldi/blob/master/INSTALL.md? If this doesn't work, please paste the output of each step. Thanks.

@bmjcode
Copy link
Contributor

bmjcode commented Sep 15, 2024

Hi @abeq! A couple of us are finishing up a Qt 6 port of Frescobaldi and qpageview. Since you're installing from source, would you be willing to help us test it? The port is much easier to install on Windows because of simplified dependencies. (I run Windows myself and can help with the process.)

@jka-kan
Copy link

jka-kan commented Nov 22, 2024

I get the same error on Ubuntu 24.10. I followed the INSTALL.md instructions.

@bmjcode
Copy link
Contributor

bmjcode commented Nov 22, 2024

If you're running the latest version from Git, note we're using PyQt6 now. The INSTALL.md instructions are slightly out of date in that regard (I guess we should probably update them).

@jka-kan
Copy link

jka-kan commented Nov 22, 2024

Yes, I noticed. According to the error message pip subprocess seems to require PyQt5 for some reason. I've tried installing both 5 and 6 without luck. Everything seems to work when I copied qpageview from Git. Problem with pip setup?

However, the PointAndClick feature does not work, so there is still something wrong with my setup.

Traceback (most recent call last):
File "/home/foo/code/frescobaldi/frescobaldi/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
File "/home/foo/code/frescobaldi/frescobaldi/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/foo/code/frescobaldi/frescobaldi/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)

File "/tmp/pip-build-env-i8mtdk1n/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-i8mtdk1n/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
          self.run_setup()
File "/tmp/pip-build-env-i8mtdk1n/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 522, in run_setup
          super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-i8mtdk1n/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
          exec(code, locals())
File "<string>", line 32, in <module>
File "/tmp/pip-install-h0dadidd/qpageview_90b08220b2df4b5b99be5ff9bb5ed7ce/qpageview/__init__.py", line 65, in <module>
          from . import link
File "/tmp/pip-install-h0dadidd/qpageview_90b08220b2df4b5b99be5ff9bb5ed7ce/qpageview/link.py", line 34, in <module>
 from PyQt5.QtCore import pyqtSignal, QEvent, QRectF, Qt
 ModuleNotFoundError: No module named 'PyQt5'
note: This error originates from a subprocess, and is likely not a problem with pip.

@bmjcode
Copy link
Contributor

bmjcode commented Nov 23, 2024

Are you trying to install qpageview from pip? That's still the old PyQt5 version (we only recently merged the Qt 6 port).

@jka-kan
Copy link

jka-kan commented Nov 23, 2024

I tried with pip, running setup.py and copying files to frescobaldi_app directory.
The problem is that running pipx install --system-site-packages --editable ./frescobaldi tries to install qpageview with pip and fails to build the package.
What is the current recommended installation method?

@bmjcode
Copy link
Contributor

bmjcode commented Nov 23, 2024

If you're talking about the latest from Git, I just run it from the source directory:

  1. Install dependencies (PyQt6, pygame if you want MIDI) from your distro packages and/or pip.
  2. Install python-ly from pip.
  3. Install qpageview from Git (run pip3 install --user . in its source directory).
  4. Run ./frescobaldi in its source directory.

The Git code is by definition work in progress, so I'd wait for the release before trying to install it. We will have installation and packaging worked out by then.

@jka-kan
Copy link

jka-kan commented Nov 24, 2024

Thanks, this worked. Afterwards I noticed that point-and-click feature was not working, so I tried to track down the cause of it which was that I had ‘@’ sign in the path where lilypond-files were stored. This was converted to ‘%40’ and that’s why links were not correctly added to self._links at pointandclick.py.
I tried this simple decoding, which made the paths to appear correctly, but it didn’t affect the cursor() function. It still receives the wrong path. I’ve checked that the paths are fine at add_link(), finish(), bind(), slotDocumentLoaded(), also openUrl() and findDocument() at app.py.
Is this qpageview related or a different issue?

 def add_link(self, filename, line, column, destination):
        print("add_link", filename, line, column, destination)
        
        from urllib.parse import unquote
        decoded_filename = unquote(filename)

        self._links[decoded_filename][(line, column)].append(destination)

@bmjcode
Copy link
Contributor

bmjcode commented Nov 24, 2024

Afterwards I noticed that point-and-click feature was not working, so I tried to track down the cause of it which was that I had ‘@’ sign in the path where lilypond-files were stored.

What is the path in question? I'll see if I can reproduce the problem here. This is all stuff I reworked for the Qt 6 port, so wherever the problem winds up being it's probably something I wrote. :)

@jka-kan
Copy link

jka-kan commented Nov 24, 2024

This was tricky one to reproduce. It seems that two conditions must be met to break the path: it has to have '@' and a scandinavian letter 'ä' ('a' with two dots). So this path fails: /home/john/first.last@domain.com/music/Ä/song.ly.
In that case 'self._docs.get(filename) at cursor() returns None.

bmjcode added a commit to bmjcode/frescobaldi that referenced this issue Nov 25, 2024
This fixes a bug reported in frescobaldi/qpageview#30 where
point-and-click fails when the filename contains both punctuation and
non-latin1 characters.
@bmjcode
Copy link
Contributor

bmjcode commented Nov 25, 2024

OK, the bug here was not at all what I expected. It turns out Frescobaldi was using its own URL-unquoting logic for textedit:// URLs, which only worked properly for latin1. The combination of '@' (must be percent-encoded) and 'ä' (not in latin1) resulted in an un-unquotable string. I changed it to use urllib like your example and it worked. Nice catch there, @jka-kan.

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