Matlab python package. ModuleNotFoundError: No module named 'wheel'

9 次查看(过去 30 天)
Hi installing python packaged matlab function results in this error when running to create a wheel starting of pip version 24.
This works fine for pip 23, can anyone help solve this?
pip wheel --no-cache-dir --use-pep517 "wwd-celloutput-r2023a @ file:///home/sander/dev/calculators/model/matlab/WWD_calculator_package"
× Building wheel for wwd-celloutput-r2023a (pyproject.toml) did not run successfully.
exit code: 1
╰─> [18 lines of output]
bdist_wheel requires the 'wheel' module, which can be installed via pip.
Traceback (most recent call last):
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 415, in build_wheel
return self._build_with_temp_dir(
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-540icr8g/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 23, in <module>
ModuleNotFoundError: No module named 'wheel'
[end of output]

回答(3 个)

Umar
Umar 2024-6-30
Hi Sander,
The error message indicates that the 'wheel' module is missing, causing the build process to fail. To resolve this, you need to install the 'wheel' module using pip. You can do this by running the following command in your terminal:
pip install wheel
Once the 'wheel' module is installed, retry building the wheel for your Python package in MATLAB. This should resolve the 'No module named wheel' error and allow you to create the wheel successfully.
  1 个评论
Sander
Sander 2024-7-1
编辑:Sander 2024-7-1
Hi Umar,
Thanks for taking the time to check this issue.
Unfortunatly the wheel module is installed. When upgrading from pip 23 to pip 24, this stops working, same packages in the venv are present.
See below terminal output:
calculators-py3.10 calculators git:(dev) pip --version
pip 23.3.1 from /home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip (python 3.10)
calculators-py3.10 calculators git:(dev) pip wheel --no-cache-dir --use-pep517 "wwd-celloutput-r2023a @ file:///home/sander/dev/calculators/model/matlab/WWD_calculator_package"
Processing ./model/matlab/WWD_calculator_package
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: wwd-celloutput-r2023a
Building wheel for wwd-celloutput-r2023a (pyproject.toml) ... done
Created wheel for wwd-celloutput-r2023a: filename=WWD_celloutput_R2023a-9.14-py3-none-any.whl size=9075880 sha256=50545dd2eadeca05e62fb3e6b71969406ee1265ba72dc1cfb0667282110c33ba
Stored in directory: /tmp/pip-ephem-wheel-cache-nt8l06w6/wheels/7d/35/c2/b97ec25ce18c44b2c2fdd76f4bff55dd7116f89a0224d45f97
Successfully built wwd-celloutput-r2023a
[notice] A new release of pip is available: 23.3.1 -> 24.1.1
[notice] To update, run: pip install --upgrade pip
calculators-py3.10 calculators git:(dev) ✗ pip install --upgrade pip
Requirement already satisfied: pip in /home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages (23.3.1)
Collecting pip
Using cached pip-24.1.1-py3-none-any.whl.metadata (3.6 kB)
Using cached pip-24.1.1-py3-none-any.whl (1.8 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 23.3.1
Uninstalling pip-23.3.1:
Successfully uninstalled pip-23.3.1
Successfully installed pip-24.1.1
calculators-py3.10 calculators git:(dev) ✗ pip wheel --no-cache-dir --use-pep517 "wwd-celloutput-r2023a @ file:///home/sander/dev/calculators/model/matlab/WWD_calculator_package"
Processing ./model/matlab/WWD_calculator_package
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: wwd-celloutput-r2023a
Building wheel for wwd-celloutput-r2023a (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for wwd-celloutput-r2023a (pyproject.toml) did not run successfully.
exit code: 1
╰─> [18 lines of output]
bdist_wheel requires the 'wheel' module, which can be installed via pip.
Traceback (most recent call last):
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-l8a3y6gh/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 415, in build_wheel
return self._build_with_temp_dir(
File "/tmp/pip-build-env-l8a3y6gh/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-l8a3y6gh/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-l8a3y6gh/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 23, in <module>
ModuleNotFoundError: No module named 'wheel'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for wwd-celloutput-r2023a
Failed to build wwd-celloutput-r2023a
ERROR: Failed to build one or more wheels
calculators-py3.10 calculators git:(dev) ✗ pip install wheel
Requirement already satisfied: wheel in /home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages (0.43.0)
calculators-py3.10 calculators git:(dev) ✗ pip wheel --no-cache-dir --use-pep517 "wwd-celloutput-r2023a @ file:///home/sander/dev/calculators/model/matlab/WWD_calculator_package"
Processing ./model/matlab/WWD_calculator_package
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: wwd-celloutput-r2023a
Building wheel for wwd-celloutput-r2023a (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for wwd-celloutput-r2023a (pyproject.toml) did not run successfully.
exit code: 1
╰─> [18 lines of output]
bdist_wheel requires the 'wheel' module, which can be installed via pip.
Traceback (most recent call last):
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/sander/.cache/pypoetry/virtualenvs/calculators-4b8SRMwI-py3.10/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-2gj4zqsu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 415, in build_wheel
return self._build_with_temp_dir(
File "/tmp/pip-build-env-2gj4zqsu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 397, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-2gj4zqsu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-2gj4zqsu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 23, in <module>
ModuleNotFoundError: No module named 'wheel'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for wwd-celloutput-r2023a
Failed to build wwd-celloutput-r2023a
ERROR: Failed to build one or more wheels

请先登录,再进行评论。


Umar
Umar 2024-7-1
Hi Sander,
The only other option at this point that I can think about would be reinstalling the affected packages within the virtual environment. This can be achieved by running the following command in the terminal:
pip install --force-reinstall -r requirements.txt
By forcing a reinstallation of the packages, you can ensure that they are compatible with the updated pip version, potentially resolving the wheel module issue.
Hope this helps out resolve your problem.
  1 个评论
Sander
Sander 2024-7-1
Hi Umar,
Unfortunatly that does not help.
I bumped into this because the deployment pipeline did not want to complete anymore.
This one always starts from a new virtual environment using Poetry. Poetry uses pip 24 internally and this is causing the issue.
Do you know if the packaging to python has changed for Matlab 2023b or 2024a?

请先登录,再进行评论。


Umar
Umar 2024-7-1
Hi Sander,
As of Matlab 2023b and 2024a, there have not been any significant changes in the packaging of Python that would directly impact the use of Poetry or pip 24. While it is important to note that Matlab typically integrates with Python through the Python Engine API, which allows for seamless interaction between Matlab and Python environments.
Given that your deployment pipeline is encountering issues related to Poetry and pip 24, it may be beneficial to consider updating your dependencies or configurations within your virtual environment to ensure compatibility. Additionally, troubleshooting specific conflicts between Poetry and pip 24 could help resolve the issue you are facing.
Let me know if I can assist further.

类别

Help CenterFile Exchange 中查找有关 Python Package Integration 的更多信息

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by