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

Built wheel but No model ModuleNotFoundError: No module named 'setuptools' #1201

Closed
bfokin opened this issue Jul 28, 2022 · 12 comments
Closed

Comments

@bfokin
Copy link

bfokin commented Jul 28, 2022

Description

Running
cibuildwheel --platform linux --arch aarch64
with the following pyproject.toml file:
image
I got to the point where cppyy-cling's wheel was created

Building wheel for cppyy-cling (pyproject.toml): finished with status 'done'
    Created wheel for cppyy-cling: filename=cppyy_cling-6.21.5-py2.py3-none-linux_aarch64.whl size=58774215 sha256=16e9091ecb2027f68e54261c6144c1e25ac26961c9d8377b32fea7863a88af2d
    Stored in directory: /root/.cache/pip/wheels/5b/05/12/e8b923bda507432b0c6492bef035042aa760629f39a3922450
  Successfully built cppyy-cling
  Installing collected packages: cppyy-cling
    Creating /tmp/pip-build-env-q6m2ut2v/overlay/bin
    changing mode of /tmp/pip-build-env-q6m2ut2v/overlay/bin/cling-config to 755
    changing mode of /tmp/pip-build-env-q6m2ut2v/overlay/bin/cppyy-generator to 755
    changing mode of /tmp/pip-build-env-q6m2ut2v/overlay/bin/genreflex to 755
    changing mode of /tmp/pip-build-env-q6m2ut2v/overlay/bin/rootcling to 755
  Successfully installed cppyy-cling-6.21.5

However, I cannot find it at this location.

After the above text, cibuildwheel fails with the following

  WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
  Running command /opt/python/cp36-cp36m/bin/python /opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmp8_c9bnaj
ERROR: Exception:
Traceback (most recent call last):
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
    status = run_func(*args)
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/commands/wheel.py", line 144, in run
    requirement_set = resolver.resolve(reqs, check_supported_wheels=True)
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 73, in resolve
    collected = self.factory.collect_root_requirements(root_reqs)
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 470, in collect_root_requirements
    requested_extras=(),
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 435, in _make_requirement_from_install_req
    version=None,
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link
    version=version,
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 287, in __init__
    version=version,
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__
    self.dist = self._prepare()
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 225, in _prepare
    dist = self._prepare_distribution()
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 292, in _prepare_distribution
    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 482, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 550, in _prepare_linked_requirement
    self.build_isolation,
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 58, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/distributions/sdist.py", line 47, in prepare_distribution_metadata
    self._install_build_reqs(finder)
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/distributions/sdist.py", line 106, in _install_build_reqs
    build_reqs = self._get_build_requires_wheel()
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_internal/distributions/sdist.py", line 83, in _get_build_requires_wheel
    return backend.get_requires_for_build_wheel()
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_vendor/pep517/wrappers.py", line 173, in get_requires_for_build_wheel
    'config_settings': config_settings
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_vendor/pep517/wrappers.py", line 332, in _call_hook
    raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
  File "/opt/python/cp36-cp36m/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 89, in _build_backend
    obj = import_module(mod_path)
  File "/opt/python/cp36-cp36m/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'setuptools'

Created temporary directory: /tmp/pip-ephem-wheel-cache-5yn736k8
Created temporary directory: /tmp/pip-req-tracker-_frsowib
Initialized build tracking at /tmp/pip-req-tracker-_frsowib
Created build tracker: /tmp/pip-req-tracker-_frsowib
Entered build tracker: /tmp/pip-req-tracker-_frsowib
Created temporary directory: /tmp/pip-wheel-364z85u9
Processing /project
  Added file:///project to build tracker '/tmp/pip-req-tracker-_frsowib'
  Created temporary directory: /tmp/pip-build-env-q6m2ut2v
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
Removed file:///project from build tracker '/tmp/pip-req-tracker-_frsowib'
Removed build tracker: '/tmp/pip-req-tracker-_frsowib'

                                                           ✕ 9363.93s
Error: Command ['python', '-m', 'pip', 'wheel', PurePosixPath('/project'), '--wheel-dir=/tmp/cibuildwheel/built_wheel', '--no-deps', '-vvv'] failed with code 2.

Even though setuptools exists already
running python -m pip show setuptools

Name: setuptools
Version: 63.2.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: None
Location: /<path to python venv>/wheel3_8/lib/python3.8/site-packages
Requires: 
Required-by:

Does the wheel exist on the device because I cannot find it.
Also, do I need to do something to not get this module not found 'setuptools'? Let me know, thank you!

Using a python 3.8 Virtenv

Build log

No response

CI config

No response

@Czaki
Copy link
Contributor

Czaki commented Jul 28, 2022

add "setuptools" to requires list.

@bfokin
Copy link
Author

bfokin commented Jul 28, 2022

I will test that out, thank you for your help! :)

@bfokin
Copy link
Author

bfokin commented Jul 28, 2022

@Czaki The issue seemed to go away. However, cibuildwheel failed due to a pure python wheel was generated
image

@Czaki
Copy link
Contributor

Czaki commented Jul 28, 2022

I'm sorry. But without seeing the code, I cannot help you. Did your package contain any compiled extensions?

@bfokin
Copy link
Author

bfokin commented Jul 28, 2022

@Czaki Are you capable of just running cibuildwheel within a directory only containing a pyproject.toml file or do you need to run cibuildwheel within your project's directory containing the pyproject.toml file?

I was just trying to generate wheels locally for packages that need to be compiled for the aarch64 architecture.

@Czaki
Copy link
Contributor

Czaki commented Jul 28, 2022

pyproject.toml need to be on the same level as setup.py.

@bfokin
Copy link
Author

bfokin commented Jul 28, 2022

@Czaki So I am unable to just build python library wheels and just be able to access them? Is it required to have setup.py?

@Czaki
Copy link
Contributor

Czaki commented Jul 28, 2022

But from what you would like to build a wheel. To build a wheel you need to have sources. In screenshot, you use setuptools.build_meta as build backend. Then setup.py is required to declare how to build binary extensions.

@bfokin
Copy link
Author

bfokin commented Jul 28, 2022

Oh wait, I believe I have misunderstood the use-case for cibuildwheel.
I thought that you could build wheels and have access to them based on the list of requirements from the .toml file, something similar to how poetry works with installing dependencies when you run poetry install.

Correct me if I am wrong, but say I want to cross compile cppyy. I could run cibuildwheel within the cppyy source code directory and it will generate the wheel for that library.

@Czaki
Copy link
Contributor

Czaki commented Jul 28, 2022

There is an option to build wheel from sdist I do not familiar with it, but here is PR introducing this feature: #1096

If I correctly understand, you need to download cppyy sdist from pypi and call cibuildwheel cppyy-2.4.0.tar.gz

@bfokin
Copy link
Author

bfokin commented Jul 28, 2022

wonderful, thank you so much for the help! You're awesome!

@bfokin bfokin closed this as completed Jul 28, 2022
@henryiii
Copy link
Contributor

cibuildwheel builds wheels for your project. So you should, in theory, be able to produce the list of wheel files here for cppyy-cling: https://pypi.org/project/cppyy-cling/#files. You can also use it to build wheels for another project, if as you said, you pointed it at the source dir or SDist for that library. Though you'd then need to distribute the wheels somehow too, I'd assume in that case it's not common that you'd have permission to upload them to PyPI.

Guessing since you have wheels for cppyy-cling already, you want to build wheels for cppyy, so yes, you'd point cibuildwheel at a checkout of the source or an SDist for cppyy.

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