Pip complains “your backend does not support editable installs” with latest setuptools...?

Hi,

On this issue in the qpageview project, a user reports the following output from pip:

~/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. 

Yet, on the same code repository at the same commit, using the same Python version and pip version (in a virtual environment), the installation works for me:

~/repos/qpageview $ python3.10 -m venv test-venv
~/repos/qpageview $ source test-venv/bin/activate
(test-venv) ~/repos/qpageview $ pip install pip==22.0.2
Collecting pip==22.0.2
  Using cached pip-22.0.2-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.3.1
    Uninstalling pip-22.3.1:
      Successfully uninstalled pip-22.3.1
Successfully installed pip-22.0.2
(test-venv) ~/repos/qpageview $ pip list
Package    Version
---------- -------
pip        22.0.2
setuptools 65.5.1
WARNING: You are using pip version 22.0.2; however, version 23.1.2 is available.
You should consider upgrading via the '/home/jean/repos/qpageview/test-venv/bin/python3.10 -m pip install --upgrade pip' command.
(test-venv) ~/repos/qpageview $ pip install --verbose -e ./qpageview
Using pip 22.0.2 from /home/jean/repos/qpageview/test-venv/lib64/python3.10/site-packages/pip (python 3.10)
Obtaining file:///home/jean/repos/qpageview/qpageview
ERROR: file:///home/jean/repos/qpageview/qpageview does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
WARNING: You are using pip version 22.0.2; however, version 23.1.2 is available.
You should consider upgrading via the '/home/jean/repos/qpageview/test-venv/bin/python3.10 -m pip install --upgrade pip' command.
(test-venv) ~/repos/qpageview $ pip install --verbose -e .
Using pip 22.0.2 from /home/jean/repos/qpageview/test-venv/lib64/python3.10/site-packages/pip (python 3.10)
Obtaining file:///home/jean/repos/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
  WARNING: You are using pip version 22.0.2; however, version 23.1.2 is available.
  You should consider upgrading via the '/home/jean/repos/qpageview/test-venv/bin/python3.10 -m pip install --upgrade pip' command.
  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
  /tmp/pip-build-env-abvqxe4v/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
    config = read_configuration(filepath, True, ignore_option_errors, dist)
  No `packages` or `py_modules` configuration, performing automatic discovery.
  `flat-layout` detected -- analysing .
  discovered packages -- ['qpageview']
  running egg_info
  writing qpageview.egg-info/PKG-INFO
[lots of output trimmed...]
Successfully built qpageview
Installing collected packages: qpageview
Successfully installed qpageview-0.6.2
WARNING: You are using pip version 22.0.2; however, version 23.1.2 is available.
You should consider upgrading via the '/home/jean/repos/qpageview/test-venv/bin/python3.10 -m pip install --upgrade pip' command.

As you can see, inside the isolated build environment, the same setuptools version has been installed as the one that was installed for the user. Therefore, I’m confused as to why the user’s pip thinks this setuptools 67.7.2 doesn’t have support for editable builds.

Could this be a pip bug, or am I missing something? Also, how can I further debug the issue? Making the output more verbose (with --verbose --verbose --verbose didn’t help).

Thanks.

Most likely, the user has somehow got setuptools installed in multiple places, and pip is picking up the wrong one. If they create an empty venv (python -m venv --without-pip) can they import setuptools? Do they have any PYTHON* environment variables? What does pip config debug show?

I’m my experience, this is much more likely to be a user environment issue than a pip issue. Especially as you don’t get the same problem when you follow the reproduction process.

Edit: Actually, why are you using pip 22.0.2, that’s over a year old. Does the user get the same problem with the latest pip (23.1.2)?

I’m the user in question and Jean asked me to provide answers. In general, what I did is wipe the hard drive, install Lubuntu 22.04 and restore my home directory on a separate partition. I suppose that created discrepancies between configurations already extant in the git-cloned directories for the frescobaldi/qpageview/python-ly projects and packages installed within the “fresh” OS.

$ pip config debug
env_var:
env:
global:
  /etc/xdg/xdg-Lubuntu/pip/pip.conf, exists: False
  /etc/xdg/pip/pip.conf, exists: False
  /etc/pip/pip.conf, exists: False
  /usr/share/pip/pip.conf, exists: False
  /etc/pip.conf, exists: False
site:
  /usr/pip.conf, exists: False
user:
  /home/simon/.pip/pip.conf, exists: False
  /home/simon/.config/pip/pip.conf, exists: False

I think 22.0.2 is the version from python3-pip on Ubuntu Jammy LTS (and consequently Lubuntu)?

Right, that makes sense. @sincere-music also got logs where the package name was “UNKNOWN” after building the wheel, which I read could be caused by an outdated setuptools version.

simon@simon-laptop:~/frescobaldi$ python -m venv --without-pip tmp-venv
simon@simon-laptop:~/frescobaldi$ source tmp-venv/bin/activate
(tmp-venv) simon@simon-laptop:~/frescobaldi$ python -c 'import setuptools'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
1 Like

Aah, I can reproduce the problem in an Ubuntu 22.04 VM.

I’ll investigate more and report back.

After pip install --upgrade pip, to install the latest pip version in the user site packages directory (shadowing the one from the system package), the issue goes away. Whatever this was, it seems to have already been fixed.

It might be related to distro patches to pip, if it only happens with the system pip. That’s been a problem in the past, and if so, you’d need to raise the issue with the distro.

It still reproduces with pip==22.0.2 from PyPI.

(But only on Ubuntu 22.04, or at least not on my Fedora 38 system, so something’s still system-dependent.)

This is likely a result of Debian or Ubuntu patches. Please reach out to those maintainers and flag this to them.

Thanks for the advice. I’ve opened