cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Having an empty setuptools directory under /lib/python/site-packages makes python misbehave

Open sshedi opened this issue 1 year ago • 1 comments

Bug report

Bug description:

I have a machine where there was a leftover setuptools-57.4.0.dist-info directory after package removal.

/lib/python3.10/site-packages/setuptools-57.4.0.dist-info --> this directory is empty

And newer setuptools /lib/python3.10/site-packages/setuptools-65.5.1-py3.10.egg-info/ is also present and this has content in it.

And I tried building a python project using python3 setup.py build For example, this project https://github.com/Supervisor/supervisor

And it throws error like below:

root@photon [ ~/supervisor-4.2.2 ]# python3 setup.py build
/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'extras_require'
  warnings.warn(msg)
/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'tests_require'
  warnings.warn(msg)
/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'include_package_data'
  warnings.warn(msg)
/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'zip_safe'
  warnings.warn(msg)
/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'test_suite'
  warnings.warn(msg)
/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'entry_points'
  warnings.warn(msg)
running build
running build_py

And if I do: rmdir /lib/python3.10/site-packages/setuptools-57.4.0.dist-info

And then try the build, it works fine.

root@photon [ ~/supervisor-4.2.2 ]# python3 setup.py build
running build
running build_py
running egg_info
writing supervisor.egg-info/PKG-INFO
writing dependency_links to supervisor.egg-info/dependency_links.txt
writing entry points to supervisor.egg-info/entry_points.txt
writing requirements to supervisor.egg-info/requires.txt
writing top-level names to supervisor.egg-info/top_level.txt
reading manifest file 'supervisor.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'docs/.build'
adding license file 'LICENSES.txt'
writing manifest file 'supervisor.egg-info/SOURCES.txt'
/usr/lib/python3.10/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'supervisor.scripts' as data is deprecated, please list it in `packages`.
    !!


    ############################
    # Package would be ignored #
    ############################
...
...

is there a known issue in python3 or a way to tell python to ignore such empty directories? This seems to be a regression.

PS: This issue is not seen in python-3.11.7

CPython versions tested on:

3.10

Operating systems tested on:

Linux

sshedi avatar May 02 '24 15:05 sshedi

This doesn't look like a cpython issue -- cpython has never distributed setuptools and cannot control what setuptools does in setup.py. It would be a different question if this was about distutils instead of setuptools (though it is only supported in 3.11).

You should probably ask for help at https://github.com/pypa/setuptools/ instead.

eli-schwartz avatar May 20 '24 21:05 eli-schwartz