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] No module named 'setuptools.command.build' on cross python environment #3560

Closed
raymanP opened this issue Aug 23, 2022 · 7 comments
Closed
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@raymanP
Copy link

raymanP commented Aug 23, 2022

setuptools version

65.2.0

Python version

3.9

OS

Ubuntu 20.04

Additional environment information

cross environment on docker messense/manylinux_2_24-cross:armv7l

Description

When running setup.py build_ext bdist_wheel I get exception: No module named 'setuptools.command.build'
When uninstalling setuptools it runs without that exception, however, failing at compiler.

On normal debian/ubuntu/macOS no problem with 65.2.0.

When listing setuptools/commands directory, in the problematic environments build.py is missing.

Hope you can help. It is an new problem, because it worked, before, however do not know if it ist setuptools related or maybe another module.

Kind regards
Reimund

Expected behavior

compiling cythonized code and building wheel

How to Reproduce

  1. integrate setuptools via setup.py
  2. run setup.py build_ext
  3. getting above error

Output

running build_ext
Traceback (most recent call last):
  File "/opt/ioddcom/python/setup.py", line 78, in <module>
    setup(
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
    self.run_command(cmd)
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 985, in run_command
    cmd_obj.ensure_finalized()
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 136, in finalize_options
    _build_ext.finalize_options(self)
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 134, in finalize_options
    self.set_undefined_options('build',
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 286, in set_undefined_options
    src_cmd_obj = self.distribution.get_command_obj(src_cmd)
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 858, in get_command_obj
    klass = self.get_command_class(command)
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools/dist.py", line 887, in get_command_class
    self.cmdclass[command] = cmdclass = ep.load()
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/opt/cross_env/py3.9/build/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'setuptools.command.build'
@raymanP raymanP added bug Needs Triage Issues that need to be evaluated for severity and status. labels Aug 23, 2022
@abravalheri
Copy link
Contributor

Hi @raymanP thank you very much for reporting this.

Could you please confirm the version of setuptools installed in these environments?
As you can see here, Setuptools 65.2.0 does contain the setuptools/command/build.py file. Therefore the 'setuptools.command.build' module should be available.

You should be able to see a /opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools-65.2.0.dist-info directory in your machine if the installed version is 65.2.0.

You should also be able to see a setuptools/command/build.py file listed in the /opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools-65.2.0.dist-info/setuptools-65.2.0.dist-info/RECORD file.

Can you confirm which installation method are you using to make setuptools 65.2.0 available in the /opt/cross_env/py3.9 environment?

@raymanP
Copy link
Author

raymanP commented Aug 24, 2022

I installed setuptools using: cross-python3.9 -m pip install -U setuptools

Is very strange: I get still this after installation (no change)
/opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools-58.1.0.dist-info

however at cross-python3.9 setuptools.__version__ gives 65.2.0
Now I see 65.2.0 is installed to /usr/local/lib/python3.9/dist-packages using pip, however, is not used somehow.
When using --user it gets to /root/.local/lib/python3.9/site-packages leading to same problem.
Maybe is something pip related.

@abravalheri
Copy link
Contributor

abravalheri commented Aug 24, 2022

Any chance there is a problem with the installation step?

If you are running cross-python3.9 -m pip install -U setuptools, this should give you /opt/cross_env/py3.9/build/lib/python3.9/site-packages/setuptools-65.2.0.dist-info/setuptools-65.2.0.dist-info, instead of a .../.../setuptools-58.1.0.dist-info, right?

Could you try to uninstall setuptools inside /opt/cross_env/py3.9/build and then reinstall the latest version?


however, is not used somehow.

I suppose that the directory /opt/cross_env/py3.9/build/lib/python3.9/site-packages/ should take priority over /usr/local/lib/python3.9/dist-packages... Isn't it the expected behaviour?

@raymanP
Copy link
Author

raymanP commented Aug 24, 2022

Yes, I expect it same as you

@abravalheri
Copy link
Contributor

This might be related to https://github.com/pypa/pip/issues/6264, but I am not 100% sure.

@raymanP
Copy link
Author

raymanP commented Aug 24, 2022

I now figured out how to get it right.
When installing setuptools using build-python3.9 instad of cross-python3.9 it works as expected.
Interesting is that some time before it worked without that change. Seems to be something cross_env or pip related I think.
However, now I can adapt my code to work again.

I think we can close this Issue.

Thank you very much @abravalheri

@abravalheri
Copy link
Contributor

Thank you very much for reporting the solution @raymanP. It is indeed very strange.

Please let us know if you find out something that relates this problem to setuptools, so we can reopen this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

2 participants