Importing setuptools in a python interpreter works fine: rocko@ubuntu:~$ python3 Python 3.10.2 (main, Feb 26 2022, 08:21:15) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> try: ... import setuptools ... print('ok') ... except ImportError as error: ... print('failed') ... ok >>>
But this same code fails when pip tries to install pathlib: rocko@ubuntu:~$ pip -v install pathlib 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 Collecting pathlib Using cached pathlib-1.0.1.tar.gz (49 kB) Running command python setup.py egg_info ERROR: Can not execute `setup.py` since setuptools is not available in the build environment. error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: /usr/bin/python3 -c ' exec(compile('"'"''"'"''"'"' # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py # # - It imports setuptools before invoking setup.py, to enable projects that directly # import from `distutils.core` to work with newer packaging standards. # - It provides a clear error message when setuptools is not installed. # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so # setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning: # manifest_maker: standard file '"'"'-c'"'"' not found". # - It generates a shim setup.py, for handling setup.cfg-only projects. import os, sys, tokenize try: import setuptools except ImportError as error: print( "ERROR: Can not execute `setup.py` since setuptools is not available in " "the build environment.", file=sys.stderr, ) sys.exit(1) __file__ = %r -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1962819 Title: pip fails to install pathlib in Ubuntu 22.04 with "setuptools is not available in the build environment" To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1962819/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs