frescobaldi / qpageview

page-based viewer widget for Qt5/PyQt5
https://qpageview.org/
GNU General Public License v3.0
20 stars 9 forks source link

Installation trouble: distutils, setuptools, PyQt5.QtSvg? #20

Closed sincere-music closed 1 year ago

sincere-music commented 1 year ago

After newly setting up my computer, frescobaldi cannot find qpageview anymore. Running the setup script from within the Git directory yields

~/qpageview$ python3 setup.py install
/home/simon/qpageview/setup.py:30: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.core import setup
Traceback (most recent call last):
  File "/home/simon/qpageview/setup.py", line 28, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/simon/qpageview/setup.py", line 30, in <module>
    from distutils.core import setup
ModuleNotFoundError: No module named 'distutils.core'

whereas trying to install via pip yields

~/qpageview$ pip install qpageview
Defaulting to user installation because normal site-packages is not writeable
Collecting qpageview
  Downloading qpageview-0.6.2.tar.gz (162 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.2/162.2 KB 993.1 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-if44a7gl/qpageview_d35e241f9b4949fcab0bc7e436a919fa/setup.py", line 32, in <module>
          from qpageview import pkginfo
        File "/tmp/pip-install-if44a7gl/qpageview_d35e241f9b4949fcab0bc7e436a919fa/qpageview/__init__.py", line 65, in <module>
          from . import link
        File "/tmp/pip-install-if44a7gl/qpageview_d35e241f9b4949fcab0bc7e436a919fa/qpageview/link.py", line 36, in <module>
          from . import page
        File "/tmp/pip-install-if44a7gl/qpageview_d35e241f9b4949fcab0bc7e436a919fa/qpageview/page.py", line 32, in <module>
          from PyQt5.QtSvg import QSvgGenerator
      ModuleNotFoundError: No module named 'PyQt5.QtSvg'
      [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.
jeanas commented 1 year ago

First, direct invocation of setup.py is deprecated. Don't use it.

You should try to install PyQt5 before qpageview. It needs to be done in two steps. This will be fixed when #18 is merged.

For PyQt5, either use your distro package manager or pip (but in either case, be sure to use the same method for the python-poppler-qt5 module; it must come from the same source as PyQt5).

sincere-music commented 1 year ago

Well, I have to say this seems pretty opaque to me still.

I had installed python3-poppler-qt5 via the package manager already, that was the first issue Frescobaldi had complained about when opening on the fresh system (with restored home directory, hence the Frescobaldi and qpageview directories in the same state as before). Fortunately I knew to add the “3” after “python”, since without it, the package cannot be found.

Now, sudo apt install pyqt5 was one of the first things I tried to make qpageview work, since it was the only dependency listed in the README that I figured might be missing. However, apt cannot locate pyqt5. So I installed that via pip (although I had to install pip first via apt…)

The first thing that really puzzles me now: PyQt5 isn’t in the package sources for Lubuntu, even though the desktop environment is LXQt?

The second thing: what does “installing” qpageview mean now that the setup.py method is of the past?

Thanks for the help.

jeanas commented 1 year ago

The first thing that really puzzles me now: PyQt5 isn’t in the package sources for Lubuntu, even though the desktop environment is LXQt?

It's probably called python3-pyqt5 rather than pyqt5.

python-poppler-qt5 depends on PyQt5, so if the system package manager installed python-poppler-qt5, it must also have installed PyQt5.

Thus, I would recommend uninstalling the version of PyQt5 that you installed via pip. Alternatively, if you want, you can install python-poppler-qt5 via pip as well. I would recommend against it; it will try to build it from source (python-poppler-qt5 is a Python binding for C++ code), and that needs more dependencies like qmake etc.

The second thing: what does “installing” qpageview mean now that the setup.py method is of the past?

Nothing different from what it meant in the past. Only the method changes. If you want to install from PyPI, use pip install qpageview. To install from your local Git checkout, pip install . in that directory.

jeanas commented 1 year ago

Aah, now I also understand why you had an error with pip install qpageview even though PyQt5 was installed.

It's probably because of build isolation. Nowadays, pip tries to make installs more reproducible by building their wheels in a temporary isolated environment. pip install --no-isolation would likely work.

Now that #18 is merged, I would recommend just cd-ing into an up-to-date source directory and pip install ..

sincere-music commented 1 year ago

I’m sorry this drags on:

sudo apt install python3-pyqt5
[sudo] password for simon: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-pyqt5 is already the newest version (5.15.6+dfsg-1ubuntu3).
python3-pyqt5 set to manually installed.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
simon@simon-laptop:~/qpageview$ pip uninstall pyqt5
Found existing installation: PyQt5 5.15.6
Not uninstalling pyqt5 at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'PyQt5'. No files were found to uninstall.

After I ~/qpageview$ pip install ., Frescobaldi still can’t find PyQt5.qtsvg.

pip install --no-isolation says there is no such option.

It seems the whole ecosystem is incredibly peculiar about what is supposed to be installed from which source and in which order, and real-life scenarios are very likely to result in conflicts without error messages that could help a user without python knowledge.

jeanas commented 1 year ago

After I ~/qpageview$ pip install ., Frescobaldi still can’t find PyQt5.qtsvg.

Hmm, maybe your distro packages the QtSvg bindings separately? Possibly sudo apt install python3-pyqt5.qtsvg will work?

pip install --no-isolation says there is no such option.

Sorry, my mistake. The option is called --no-build-isolation.

(Also, #18 is merged now, so this won't be necessary anymore.)

It seems the whole ecosystem is incredibly peculiar about what is supposed to be installed from which source and in which order, and real-life scenarios are very likely to result in conflicts without error messages that could help a user without python knowledge.

Well, the packaging around Frescobaldi-related modules is made more complicated by the presence of non-pure-Python modules (basically PyQt and python-poppler-qt5). Plus, until recently, it was relying on outdated Python packaging practices. It's a bit better now for python-ly and qpageview, though Frescobaldi itself still has a setup.py and uses distutils, which we need to migrate away from...

sincere-music commented 1 year ago

Thanks for that! python3-pyqt5.qtsvg was an important pointer. Triggering auto-complete, I noticed that python3-pyqt5.qtwebkit was also offered, and required for frescobaldi. (EDIT: Re-reading the Installing instructions from the Frescobaldi wiki, I realise that it’s qtwebengine, not qtwebkit, which is required.)

With these two installed, I could run Frescobaldi successfully!—however, then I had the idea of git pulling in the frescobaldi directory, after which it didn’t work anymore. I tried repeating some of the steps from above, to no avail:

simon@simon-laptop:~/qpageview$ pip install --no-build-isolation .
Defaulting to user installation because normal site-packages is not writeable
Processing /home/simon/qpageview
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: UNKNOWN
  Building wheel for UNKNOWN (pyproject.toml) ... done
  Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=13307 sha256=810a2f0f6bdc63ddbb39baf67016ada040bb5abaa5ae9107c7883c513502816c
  Stored in directory: /tmp/pip-ephem-wheel-cache-mgc2twoq/wheels/e9/0b/01/43de0beb4faf4c7a0beb719537e67cf0fea319b76e79bc7584
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
  Attempting uninstall: UNKNOWN
    Found existing installation: UNKNOWN 0.0.0
    Uninstalling UNKNOWN-0.0.0:
      Successfully uninstalled UNKNOWN-0.0.0
Successfully installed UNKNOWN-0.0.0
simon@simon-laptop:~/qpageview$ cd ..
simon@simon-laptop:~$ frescobaldi
Traceback (most recent call last):
  File "/home/simon/frescobaldi/frescobaldi_app/plugin.py", line 79, in instance
    return _instances[cls][obj]
  File "/usr/lib/python3.10/weakref.py", line 416, in __getitem__
    return self.data[ref(key)]
KeyError: <weakref at 0x7f47522ab650; to 'type' at 0x55b2452520d0 (PanelManager)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/simon/frescobaldi/frescobaldi", line 46, in <module>
    main.main()                     # Parse command line, create windows etc
  File "/home/simon/frescobaldi/frescobaldi_app/main.py", line 218, in main
    win = mainwindow.MainWindow()
  File "/home/simon/frescobaldi/frescobaldi_app/mainwindow.py", line 137, in __init__
    self.createMenus()
  File "/home/simon/frescobaldi/frescobaldi_app/mainwindow.py", line 1124, in createMenus
    menu.createMenus(self)
  File "/home/simon/frescobaldi/frescobaldi_app/menu.py", line 61, in createMenus
    m.addMenu(menu_file(mainwindow))
  File "/home/simon/frescobaldi/frescobaldi_app/menu.py", line 95, in menu_file
    m.addMenu(snippet.menu.TemplateMenu(mainwindow))
  File "/home/simon/frescobaldi/frescobaldi_app/snippet/menu.py", line 149, in __init__
    self.addAction(self.tool().actionCollection.templates_manage)
  File "/home/simon/frescobaldi/frescobaldi_app/snippet/menu.py", line 58, in tool
    return panelmanager.manager(self.mainwindow()).snippettool
  File "/home/simon/frescobaldi/frescobaldi_app/panelmanager.py", line 38, in manager
    return PanelManager.instance(mainwindow)
  File "/home/simon/frescobaldi/frescobaldi_app/plugin.py", line 84, in instance
    result.__init__(obj)
  File "/home/simon/frescobaldi/frescobaldi_app/panelmanager.py", line 70, in __init__
    self.loadPanel("musicview.MusicViewPanel", "viewers")
  File "/home/simon/frescobaldi/frescobaldi_app/panelmanager.py", line 107, in loadPanel
    __import__(module_name)
  File "/home/simon/frescobaldi/frescobaldi_app/musicview/__init__.py", line 52, in <module>
    import pagedview
  File "/home/simon/frescobaldi/frescobaldi_app/pagedview.py", line 44, in <module>
    import qpageview.view
ModuleNotFoundError: No module named 'qpageview.view'

At this point I was kind of fed up, so I wiped the directories for frescobaldi, python-ly and qpageview to proceed exactly according to the instructions from https://github.com/frescobaldi/frescobaldi/wiki/Run-Frescobaldi-3-on-Linux and hopefully rid myself of the mess I had made.

Firstly, I had to run pip install without the -e toggle, since that isn’t supported by qpageview anymore, as you are surely well aware. (I postponed editing the Wiki page, since other changes might be necessary.)

Secondly, now Frescobaldi shows the error message about qpageview not being found on startup again. Should I have uninstalled qpageview before redoing the whole Frescobaldi installation? If yes, how?

jeanas commented 1 year ago

For me, pip install -e . still works for qpageview. This, and the “UNKNOWN” in the pip install step, suggests to me that you might have an older setuptools version.

Can you try without --no-build-isolation? With #18 being merged, it should never be necessary or useful anymore (at least in qpageview). I would expect pip install -e ./qpageview to download the latest setuptools version behind the scenes in the isolated build environment. If it still doesn't work, can you give the log printed by pip install --verbose -e ./qpageview?

jeanas commented 1 year ago

(FWIW, if you'd like, I can try debugging these issues on your machine through a VNC access or such...)

sincere-music commented 1 year ago
~/frescobaldi$ pip install --verbose -e ./qpageview/                    
Using pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/simon/frescobaldi/qpageview
  Running command pip subprocess to install build dependencies
  Collecting setuptools>=64
    Using cached setuptools-67.7.2-py3-none-any.whl (1.1 MB)
  Installing collected packages: setuptools
  Successfully installed setuptools-67.7.2
  Installing build dependencies ... done
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
ERROR: Project file:///home/simon/frescobaldi/qpageview has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660. 

I’ve never done VNC access, is that complicated?

jeanas commented 1 year ago

????

I have no clue about this error. I just tested this in a virtual environment with the exact same pip version. It downloaded the same setuptools version and there were no problems.

I’ve never done VNC access, is that complicated?

I don't think so, but I haven't done it often either.

jeanas commented 1 year ago

Simon, can you try this? Don't ask about it, I just want the output...

python -m venv tmp-test-venv
source tmp-test-venv/bin/activate
pip install setuptools==67.7.2 pip==22.0.2
python -c 'from setuptools.build_meta import build_editable; print(build_editable)'
deactivate
rm -rf tmp-test-venv
sincere-music commented 1 year ago

Ok, I had to install python-is-python3 (duh…) and python3.10-venv first.

simon@simon-laptop:~$ python -m venv tmp-test-venv
simon@simon-laptop:~$ source tmp-test-venv/bin/activate
(tmp-test-venv) simon@simon-laptop:~$ pip install setuptools==67.7.2 pip==22.0.2
Collecting setuptools==67.7.2
  Using cached setuptools-67.7.2-py3-none-any.whl (1.1 MB)
Requirement already satisfied: pip==22.0.2 in ./tmp-test-venv/lib/python3.10/site-packages (22.0.2)
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 59.6.0
    Uninstalling setuptools-59.6.0:
      Successfully uninstalled setuptools-59.6.0
Successfully installed setuptools-67.7.2
(tmp-test-venv) simon@simon-laptop:~$ python -c 'from setuptools.build_meta import build_editable; print(build_editable)'
<bound method _BuildMetaBackend.build_editable of <setuptools.build_meta._BuildMetaBackend object at 0x7fb86e229810>>
(tmp-test-venv) simon@simon-laptop:~$ deactivate
simon@simon-laptop:~$ rm -rf tmp-test-venv/
simon@simon-laptop:~$ 
jeanas commented 1 year ago

OK... what if you pass --verbose 3 times to pip install -e ./qpageview? Maybe that'll give more info?

sincere-music commented 1 year ago

I assume you mean running pip install --verbose -e ./qpageview three times? Sorry, that results in the same output as above each time.

jeanas commented 1 year ago

No :) Run pip install --verbose --verbose --verbose -e ./qpageview. This is supposed to increase the verbosity even more.

sincere-music commented 1 year ago

Oh! I didn’t know that was a thing ;)

~/frescobaldi$ pip install --verbose --verbose --verbose -e ./qpageview
Using pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
Defaulting to user installation because normal site-packages is not writeable
Created temporary directory: /tmp/pip-ephem-wheel-cache-j30oo4uu
Created temporary directory: /tmp/pip-req-tracker-25bcvznl
Initialized build tracking at /tmp/pip-req-tracker-25bcvznl
Created build tracker: /tmp/pip-req-tracker-25bcvznl
Entered build tracker: /tmp/pip-req-tracker-25bcvznl
Created temporary directory: /tmp/pip-install-jd5pm82j
Obtaining file:///home/simon/frescobaldi/qpageview
  Added file:///home/simon/frescobaldi/qpageview to build tracker '/tmp/pip-req-tracker-25bcvznl'
  Created temporary directory: /tmp/pip-build-env-0oegdnek
  Created temporary directory: /tmp/pip-standalone-pip-guxxkgxn
  Running command pip subprocess to install build dependencies
  Using pip 22.0.2 from /tmp/pip-standalone-pip-guxxkgxn/__env_pip__.zip/pip (python 3.10)
  Collecting setuptools>=64
    Using cached setuptools-67.7.2-py3-none-any.whl (1.1 MB)
  Installing collected packages: setuptools
  Successfully installed setuptools-67.7.2
  Installing build dependencies ... done
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
ERROR: Project file:///home/simon/frescobaldi/qpageview has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.            
Exception information:                                                                              
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
    status = run_func(*args)
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 339, in run
    requirement_set = resolver.resolve(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 75, in resolve
    collected = self.factory.collect_root_requirements(root_reqs)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 506, in collect_root_requirements
    req = self._make_requirement_from_install_req(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 468, in _make_requirement_from_install_req
    cand = self._make_candidate_from_link(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 188, in _make_candidate_from_link
    self._editable_candidate_cache[link] = EditableCandidate(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 313, in __init__
    super().__init__(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 158, in __init__
    self.dist = self._prepare()
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 227, in _prepare
    dist = self._prepare_distribution()
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 323, in _prepare_distribution
    return self._factory.preparer.prepare_editable_requirement(self._ireq)
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 609, in prepare_editable_requirement
    dist = _get_prepared_distribution(
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 58, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/usr/lib/python3/dist-packages/pip/_internal/distributions/sdist.py", line 43, in prepare_distribution_metadata
    self.req.isolated_editable_sanity_check()
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 492, in isolated_editable_sanity_check
    raise InstallationError(
pip._internal.exceptions.InstallationError: Project file:///home/simon/frescobaldi/qpageview has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.
Removed file:///home/simon/frescobaldi/qpageview from build tracker '/tmp/pip-req-tracker-25bcvznl'
Removed build tracker: '/tmp/pip-req-tracker-25bcvznl'
jeanas commented 1 year ago

OK, let's try something else. Can you do this and report back?

cd qpageview
curl https://jean.abou-samra.fr/share/use_hatch.diff | git apply
pip install -e .
sincere-music commented 1 year ago

Looks good. I’ll try Frescobaldi in a second…

~/frescobaldi/qpageview$ pip install --verbose --verbose --verbose -e .
Using pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
Defaulting to user installation because normal site-packages is not writeable
Created temporary directory: /tmp/pip-ephem-wheel-cache-driv8i69
Created temporary directory: /tmp/pip-req-tracker-6nku5ows
Initialized build tracking at /tmp/pip-req-tracker-6nku5ows
Created build tracker: /tmp/pip-req-tracker-6nku5ows
Entered build tracker: /tmp/pip-req-tracker-6nku5ows
Created temporary directory: /tmp/pip-install-36wuy8rh
Obtaining file:///home/simon/frescobaldi/qpageview
  Added file:///home/simon/frescobaldi/qpageview to build tracker '/tmp/pip-req-tracker-6nku5ows'
  Created temporary directory: /tmp/pip-build-env-mpzggyku
  Created temporary directory: /tmp/pip-standalone-pip-rjxqd_nf
  Running command pip subprocess to install build dependencies
  Using pip 22.0.2 from /tmp/pip-standalone-pip-rjxqd_nf/__env_pip__.zip/pip (python 3.10)
  Collecting hatchling
    Downloading hatchling-1.14.1-py3-none-any.whl (73 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.5/73.5 KB 611.7 kB/s eta 0:00:00
  Collecting trove-classifiers
    Downloading trove_classifiers-2023.4.29-py3-none-any.whl (13 kB)
  Collecting tomli>=1.2.2
    Downloading tomli-2.0.1-py3-none-any.whl (12 kB)
  Collecting pathspec>=0.10.1
    Downloading pathspec-0.11.1-py3-none-any.whl (29 kB)
  Collecting editables>=0.3
    Downloading editables-0.3-py3-none-any.whl (4.7 kB)
  Collecting pluggy>=1.0.0
    Downloading pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
  Collecting packaging>=21.3
    Downloading packaging-23.1-py3-none-any.whl (48 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 KB 418.9 kB/s eta 0:00:00
  Installing collected packages: trove-classifiers, tomli, pluggy, pathspec, packaging, editables, hatchling
    Creating /tmp/pip-build-env-mpzggyku/overlay/local/bin
    changing mode of /tmp/pip-build-env-mpzggyku/overlay/local/bin/hatchling to 775
  Successfully installed editables-0.3 hatchling-1.14.1 packaging-23.1 pathspec-0.11.1 pluggy-1.0.0 tomli-2.0.1 trove-classifiers-2023.4.29
  Installing build dependencies ... done
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
  Running command Getting requirements to build editable
  Getting requirements to build editable ... done
  Created temporary directory: /tmp/pip-modern-metadata-5vok9ffy
  Running command Preparing editable metadata (pyproject.toml)
  Preparing editable metadata (pyproject.toml) ... done
  Source in /home/simon/frescobaldi/qpageview has version 0.6.2, which satisfies requirement qpageview==0.6.2 from file:///home/simon/frescobaldi/qpageview
  Removed qpageview==0.6.2 from file:///home/simon/frescobaldi/qpageview from build tracker '/tmp/pip-req-tracker-6nku5ows'
Created temporary directory: /tmp/pip-unpack-ineypk2k
Building wheels for collected packages: qpageview
  Created temporary directory: /tmp/pip-wheel-wc1x3yxi
  Destination directory: /tmp/pip-wheel-wc1x3yxi
  Running command Building editable for qpageview (pyproject.toml)
  Building editable for qpageview (pyproject.toml) ... done
  Created wheel for qpageview: filename=qpageview-0.6.2-py2.py3-none-any.whl size=14457 sha256=4446160100049d7c8af402ae85efa1f22ce7f64fa324d78877a2f080f11af334
  Stored in directory: /tmp/pip-ephem-wheel-cache-driv8i69/wheels/b4/af/f8/77dd8ab3fa740f28b5998224f42ebdf5752acd7d96313fee41
Successfully built qpageview
Installing collected packages: qpageview

Successfully installed qpageview-0.6.2
Removed build tracker: '/tmp/pip-req-tracker-6nku5ows'

Well, now Frescobaldi complains about python-ly, which should mean qpageview is good now, congrats! I suppose that might be exactly the same issue, considering

~/frescobaldi/python-ly$ pip install --verbose --verbose --verbose -e .
Using pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
Defaulting to user installation because normal site-packages is not writeable
Created temporary directory: /tmp/pip-ephem-wheel-cache-yhkdwuy4
Created temporary directory: /tmp/pip-req-tracker-5wdmlw4g
Initialized build tracking at /tmp/pip-req-tracker-5wdmlw4g
Created build tracker: /tmp/pip-req-tracker-5wdmlw4g
Entered build tracker: /tmp/pip-req-tracker-5wdmlw4g
Created temporary directory: /tmp/pip-install-7r0nj_kj
Obtaining file:///home/simon/frescobaldi/python-ly
  Added file:///home/simon/frescobaldi/python-ly to build tracker '/tmp/pip-req-tracker-5wdmlw4g'
  Created temporary directory: /tmp/pip-build-env-bzz_9bbo
  Created temporary directory: /tmp/pip-standalone-pip-7gzjjetx
  Running command pip subprocess to install build dependencies
  Using pip 22.0.2 from /tmp/pip-standalone-pip-7gzjjetx/__env_pip__.zip/pip (python 3.10)
  Collecting setuptools>=64
    Using cached setuptools-67.7.2-py3-none-any.whl (1.1 MB)
  Installing collected packages: setuptools
  Successfully installed setuptools-67.7.2
  Installing build dependencies ... done
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
ERROR: Project file:///home/simon/frescobaldi/python-ly has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.            
Exception information:                                                                              
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
    status = run_func(*args)
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 339, in run
    requirement_set = resolver.resolve(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 75, in resolve
    collected = self.factory.collect_root_requirements(root_reqs)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 506, in collect_root_requirements
    req = self._make_requirement_from_install_req(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 468, in _make_requirement_from_install_req
    cand = self._make_candidate_from_link(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 188, in _make_candidate_from_link
    self._editable_candidate_cache[link] = EditableCandidate(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 313, in __init__
    super().__init__(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 158, in __init__
    self.dist = self._prepare()
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 227, in _prepare
    dist = self._prepare_distribution()
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 323, in _prepare_distribution
    return self._factory.preparer.prepare_editable_requirement(self._ireq)
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 609, in prepare_editable_requirement
    dist = _get_prepared_distribution(
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 58, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/usr/lib/python3/dist-packages/pip/_internal/distributions/sdist.py", line 43, in prepare_distribution_metadata
    self.req.isolated_editable_sanity_check()
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 492, in isolated_editable_sanity_check
    raise InstallationError(
pip._internal.exceptions.InstallationError: Project file:///home/simon/frescobaldi/python-ly has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does not have a 'setup.py' nor a 'setup.cfg', it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.
Removed file:///home/simon/frescobaldi/python-ly from build tracker '/tmp/pip-req-tracker-5wdmlw4g'
Removed build tracker: '/tmp/pip-req-tracker-5wdmlw4g'
sincere-music commented 1 year ago

I sure hope this isn’t an issue concerning only me and your work helps to improve the software for others as well! But already I’m really grateful :)

jeanas commented 1 year ago

OK, good that you've solved your problem for now.

I've opened a discussion thread on dpo about this: https://discuss.python.org/t/pip-complains-your-backend-does-not-support-editable-installs-with-latest-setuptools/26387

sincere-music commented 1 year ago

Well, I still can’t use Frescobaldi since python-ly isn’t usable, and naively applying the same change to its pyproject.toml doesn’t work.

jeanas commented 1 year ago

How “naively” is that? Can you try https://jean.abou-samra.fr/share/use_hatch_python_ly.diff for python-ly?

sincere-music commented 1 year ago

Slightly more naively than you did ;) I did exactly the same you had done for qpageview, and the second half of your patch is different, if I see that correctly without double-checking.

But this does the job, and allows me to successfully launch Frescobaldi again! Thanks a ton.

jeanas commented 1 year ago

Good. It would be great if you could answer the questions from Paul Moore on https://discuss.python.org/t/pip-complains-your-backend-does-not-support-editable-installs-with-latest-setuptools/26387/2 to understand what the underlying issue was (something may have to be fixed either in pip, or in your environment, or in your distribution's packages).

sincere-music commented 1 year ago

Can I do any clerical work to help you apply those changes in the proper places? I’m not sure it’s going to save you a lot of time if I prepare a pull request for qpageview/python-ly, but I could propose changes to the Frescobaldi wiki page about installing for Linux.

sincere-music commented 1 year ago

Ah, yes. It’s good that it is being discussed there, so I’ll check in.

jeanas commented 1 year ago

Well, the changes aren't really a fix, more a workaround for some wrong detection of setuptools in your environment specifically -- the same could in theory happen with hatch.

That being said, setuptools is known for being somewhat ridden by all the legacy it supports, so moving to hatch as a more modern build backend could be a good idea regardless.

sincere-music commented 1 year ago

Huh, thanks all the more for helping with my apparently rare issue. As I said, I’d be glad if this can help make the software more stable and easy to install, but I can’t say anything about how to achieve that.

jeanas commented 1 year ago

For this specific issue, the solution turns out to be installing a newer pip (via the system pip...); see the dpo thread.

In general, the one thing that would really smooth the install process would be not to rely on distro packages for python-poppler-qt5, because mixing distro packages and PyPI packages can be a source of trouble (e.g., it will fail if you install python3-poppler-qt5 from your distro, with python3-pyqt5 as a dependency, and on top of that also install PyQt5 separately via pip). The blocker for that is https://github.com/frescobaldi/python-poppler-qt5/issues/42, which is pretty tough, unfortunately.

jeanas commented 1 year ago

Well, this discussion remotivated me to work on Frescobaldi's packaging.

https://github.com/frescobaldi/frescobaldi/pull/1597 adds a note to the INSTALL.md about the problem you encountered.

jeanas commented 1 year ago

There is now https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/2018288

Phew, Ubuntu Jammy will have caused quite a lot of trouble for Frescobaldi. (It also broke the frescobaldi package for months initially...)