Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip says version 40.8.0 of setuptools does not satisfy requirement of setuptools>=40.8.0

Tags:

python

pip

I am seriously stumped with this one and can't find any questions that match.

If I run pip3 show setuptools or pip2 list, both say that setuptools 40.8.0 is installed, but when I try to install a module locally, from a local source code directory, I get the error that says No matching distribution found for setuptools>=40.8.0

Due to access and firewall restrictions, I have to install the module into my home directory and using what's already installed on the system.

This worked with the previous version of the module, but now it's failing.

like image 609
RayInNoIL Avatar asked Dec 08 '25 23:12

RayInNoIL


1 Answers

I had this problem trying to build psycopg from source, using downloaded dependencies on an air-gapped machine.

I did this initially :

$ python3.11 -m venv tmp-venv
$ . tmp-venv/bin/activate
$ pip list
Package    Version
---------- -------
pip        22.3.1
setuptools 65.5.0
$ mkdir deps
$ pip download --destination-dir=deps wheel tomli==2.0.1 backports.zoneinfo==0.2.1 typing_extensions==4.7.1 psycopg==3.1.9 psycopg-c==3.1.9
$ pip install --no-index --find-links=deps wheel tomli

I then executed

$ pip install --no-index --find-links=deps psycopg[c]

which errored out with

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      Looking in links: deps
      ERROR: Could not find a version that satisfies the requirement setuptools>=49.2.0 (from versions: none)
      ERROR: No matching distribution found for setuptools>=49.2.0
      [end of output]

The solution, gleaned from this GitHub issue, was to add the --no-build-isolation flag so that pip would find the setuptools installation.

pip install --no-index --find-links=deps --no-build-isolation psycopg[c]

Build isolation is a feature of PEP518 in which the build process does not look for build-time dependencies (such as setuptools) in the local environment. The --no-build-isolation flag disables this feature so that the local setuptools installation is used for the build.

like image 51
snakecharmerb Avatar answered Dec 10 '25 11:12

snakecharmerb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!