Why do I receive a "subproces​s-exited-w​ith-error" error message when installing "matlabengine"?

128 次查看(过去 30 天)
Does someone have a fix for this?
>pip install matlabengine
Collecting matlabengine
Using cached matlabengine-9.15.2.tar.gz (18 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: matlabengine
Building wheel for matlabengine (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for matlabengine (pyproject.toml) did not run successfully.
exit code: 1
╰─> [56 lines of output]
running bdist_wheel
running build
running build_py
_get_engine_ver_major_minor returned: ('9', '15')
_get_engine_ver_major_minor returned: ('9', '15')
Traceback (most recent call last):
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\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 "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\build_meta.py", line 434, in build_wheel
return self._build_with_temp_dir(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\build_meta.py", line 419, in _build_with_temp_dir
self.run_setup()
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
exec(code, locals())
File "<string>", line 415, in <module>
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
self.run_command(cmd)
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command
super().run_command(command)
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 364, in run
self.run_command("build")
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command
super().run_command(command)
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
self.run_command(cmd_name)
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command
super().run_command(command)
File "C:\Users\<username>\AppData\Local\Temp\pip-build-env-5xd8bphw\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "<string>", line 381, in run
File "<string>", line 217, in get_matlab_root_from_windows_reg
File "<string>", line 260, in _find_matlab_key_from_windows_registry
RuntimeError: No compatible MATLAB installation found in Windows Registry. This release of MATLAB Engine API for Python is compatible with version 9.15. The found versions were 9.14.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for matlabengine
Failed to build matlabengine
ERROR: Could not build wheels for matlabengine, which is required to install pyproject.toml-based projects
  1 个评论
Harald
Harald 2023-9-22
Hi,
far down the error stack, it tells the underlying problem:
This release of MATLAB Engine API for Python is compatible with version 9.15. The found versions were 9.14.
Best wishes,
Harald

请先登录,再进行评论。

采纳的回答

Shivani
Shivani 2024-10-21
编辑:MathWorks Support Team 2024-10-21,16:51
MATLAB Engine API for Python is returning an error because the command you are using to download it does not specify a download version.
You are currently using the command, “pip install matlabengine”, which installs the version of Python Engine API that is compatible with the latest MATLAB release. This means that if you are not using the latest release of MATLAB, you will need to specify the version of Python Engine API that is compatible with your release.
For example, if you are using MATLAB R2023a, you would first need to determine what version of Python Engine API is compatible with MATLAB R2023a. You can do this by visiting the following link and reading the “Required MathWorks Products” section for each release.
The newest release of MATLAB Engine API for Python that is compatible with MATLAB R2023a is 9.14.7. To install MATLAB Engine API for Python version 9.14.7, run the following command.
python -m pip install matlabengine==9.14.7
You can find more information about MATLAB Engine API for Python version 9.14.7 at the following link.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call MATLAB from Python 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by