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

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist #572

Open
rvernica opened this issue Jan 31, 2023 · 2 comments

Comments

@rvernica
Copy link

The build module fails for sdist or wheel. This is an existing project and this build step used to work properly.

> python3 -m build --sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools >= 40.8.0, wheel)
* Getting build dependencies for sdist...
Traceback (most recent call last):
  File "/root/.local/lib/python3.6/site-packages/pep517/in_process/_in_process.py", line 351, in <module>
    main()
  File "/root/.local/lib/python3.6/site-packages/pep517/in_process/_in_process.py", line 333, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/root/.local/lib/python3.6/site-packages/pep517/in_process/_in_process.py", line 285, in get_requires_for_build_sdist
    return hook(config_settings)
  File "/tmp/build-env-zul88ngt/lib64/python3.6/site-packages/setuptools/build_meta.py", line 167, in get_requires_for_build_sdist
    return self._get_build_requires(config_settings, requirements=[])
  File "/tmp/build-env-zul88ngt/lib64/python3.6/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
    self.run_setup()
  File "/tmp/build-env-zul88ngt/lib64/python3.6/site-packages/setuptools/build_meta.py", line 268, in run_setup
    self).run_setup(setup_script=setup_script)
  File "/tmp/build-env-zul88ngt/lib64/python3.6/site-packages/setuptools/build_meta.py", line 158, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 31, in <module>
    import scidbbridge
  File "/foo/__init__.py", line 24, in <module>
    import boto3
ModuleNotFoundError: No module named 'boto3'

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist

boto3 in listed in setup.py:

setup(
    name=NAME,
    version=VERSION,
    description=DESCRIPTION,
    long_description=LONG_DESCRIPTION,
    author=AUTHOR,
    author_email=AUTHOR_EMAIL,
    download_url=DOWNLOAD_URL,
    license=LICENSE,
    packages=['scidbbridge'],
    install_requires=[
        'boto3>=1.14.12',

This is the package source and here is the package on PyPI.

I tired the build on both Python 3.10.8 with build 0.10.0 and Python 3.6.8 with build 0.9.0. The boto3 package is installed on the host system.

@henryiii
Copy link
Contributor

You can't import boto3 inside the isolated environment unless you install it inside the isolated environment (in pyproject.toml). Though do you really need to? Usually, to make the SDist/wheel, you should not need the imports (which are only install requirements). Perhaps you are trying to import your own package inside setup.py? This is an antipattern; setuptools and most other backends provide ways to single-source the version without loading your package during the SDist/wheel build, which I'd guess is what you might be trying to do? Oh, yes, you linked the source, that's exactly why. I'd either use setuptool's setup.cfg version = attr: scridbbridge.__version__ option for version (and hope it can read the AST), or use a backend like hatchling that can read the version via regex.

@jmwoloso
Copy link

jmwoloso commented Jul 6, 2024

Thanks a million @henryiii

I was having a similar issue as we're moving from setup.py over to build for our project and....sure enough I was importing our library in setup.py. Problem solved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants