Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ModuleNotFoundError: No module named 'setuptools' #589

Open
timhoffm opened this issue Nov 27, 2024 · 5 comments
Open

[BUG] ModuleNotFoundError: No module named 'setuptools' #589

timhoffm opened this issue Nov 27, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@timhoffm
Copy link

Describe the bug
grayskull creates by-default non-working recipe for packages that still use setuptools.

For python 3.13 setuptools is no longer a dependency of pip https://conda-forge.org/news/2024/08/21/sunsetting-pip-deps/ and needs explicit installation.

To Reproduce
Noted when trying to create a conda package for types-pika-ts (grayskull pypi types-pika-ts) . The created meta.yaml contains

requirements:
  host:
    - python >=3.8
    - pip

conda build then creates a host envionment with python 3.13 and pip but without setuptools.

Expected behavior
The recipe work without additional modification. I haven't looked into the internals of grayskull and therefore don't know whether it can detect if setuptools is required. If so, it should put it into the host requirements explicitly. That is necessary for python 3.13 and doesn't hurt for python versions < 3.13.

Workaround
In case somebody stumbles across this as well, you can manually add setuptools to your host dependencies.

@timhoffm timhoffm added the bug Something isn't working label Nov 27, 2024
@ocefpaf
Copy link
Contributor

ocefpaf commented Nov 27, 2024

In a way grayskull is doing the right thing, unless setuptools is specified in the package metadata and grayskull is missing it. While you can add it manually, ideally you should report that upstream and ask the package author to declare setutptools as its backend.

@timhoffm
Copy link
Author

Thanks for the answer. Upstream is https://github.com/python/typeshed. They build packages via https://github.com/typeshed-internal/stub_uploader, which currently still creates packages with setup.py only. I‘m not a build expert, but thought build backend configuration is a PEP 517 thing and only possible via pyproject.toml. Is that correct? AFAICS, the requirement to specify the build backend explicitly then means that grayskull does not support legacy setup.py-based projects anymore.

@ocefpaf
Copy link
Contributor

ocefpaf commented Nov 27, 2024

It does support and I believe it checks the import. However, this project does have a pyproject.toml, and that is probably the cause of the confusion as grayskull cannot find setuptools in it.

@timhoffm
Copy link
Author

Thanks. Nevertheless a setuptools fallback would be reasonable if no build system is specified. This would be in line with the specification. From https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-build-system-dependencies-the-build-system-table

Tools should not require the existence of the [build-system] table. A pyproject.toml file may be used to store configuration details other than build-related data and thus lack a [build-system] table legitimately. If the file exists but is lacking the [build-system] table then the default values as specified above [i.e. setuptools] should be used.

I suspect that the setuptools assumption may have been made implicitly by the inclusion of pip so far, but now needs to be made explicitly since pip does not depend on setuptools anymore.

@amgcc
Copy link

amgcc commented Dec 10, 2024

I too have been having this problem as a new grayskull user. Might be worth making some adjustments to how this is handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants