Click here to Skip to main content
15,878,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am new in using tensorflow keras using python.I am trying to run this statement in Jupter Notebook

Python
import matlab.engine

It is givng this error

  ModuleNotFoundError: No module named 'matlab.engine'; 'matlab' is<br />
not a package


For solving the above error I successfully installed

Python
pip install matlab

After that i executed this command from this link (matlab site)


Python
python -m pip install matlabengine
    or
    pip install matlabengine


Both are giving this error :

  (base) PS C:\Users\hp> pip install matlabengine<br />
Collecting matlabengine<br />
  Using cached matlabengine-9.14.2.tar.gz (18 kB)<br />
  Installing build dependencies ... done<br />
  Getting requirements to build wheel ... done<br />
  Preparing metadata (pyproject.toml) ... done<br />
Building wheels for collected packages: matlabengine<br />
  Building wheel for matlabengine (pyproject.toml) ... error<br />
  error: subprocess-exited-with-error<br />
<br />
  × Building wheel for matlabengine (pyproject.toml) did not run successfully.<br />
  │ exit code: 1<br />
  ╰─> [54 lines of output]<br />
      running bdist_wheel<br />
      running build<br />
      running build_py<br />
      Traceback (most recent call last):<br />
        File "<string>", line 212, in get_matlab_root_from_windows_reg<br />
      FileNotFoundError: [WinError 2] The system cannot find the file specified<br />
<br />
      During handling of the above exception, another exception occurred:<br />
<br />
      Traceback (most recent call last):<br />
        File "C:\Users\hp\anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module><br />
          main()<br />
        File "C:\Users\hp\anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main<br />
          json_out['return_val'] = hook(**hook_input['kwargs'])<br />
        File "C:\Users\hp\anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 261, in build_wheel<br />
          return _build_backend().build_wheel(wheel_directory, config_settings,<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\build_meta.py", line 416, in build_wheel<br />
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\build_meta.py", line 401, in _build_with_temp_dir<br />
          self.run_setup()<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup<br />
          exec(code, locals())<br />
        File "<string>", line 414, in <module><br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\__init__.py", line 107, in setup<br />
          return distutils.core.setup(**attrs)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup<br />
          return run_commands(dist)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands<br />
          dist.run_commands()<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands<br />
          self.run_command(cmd)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\dist.py", line 1244, in run_command<br />
          super().run_command(command)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command<br />
          cmd_obj.run()<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 343, in run<br />
          self.run_command("build")<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command<br />
          self.distribution.run_command(command)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\dist.py", line 1244, in run_command<br />
          super().run_command(command)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command<br />
          cmd_obj.run()<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run<br />
          self.run_command(cmd_name)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command<br />
          self.distribution.run_command(command)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\dist.py", line 1244, in run_command<br />
          super().run_command(command)<br />
        File "C:\Users\hp\AppData\Local\Temp\pip-build-env-uypwibie\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command<br />
          cmd_obj.run()<br />
        File "<string>", line 380, in run<br />
        File "<string>", line 214, in get_matlab_root_from_windows_reg<br />
      RuntimeError: MATLAB installation not found in Windows Registry: [WinError 2] The system cannot find the file specified<br />
      [end of output]<br />
<br />
  note: This error originates from a subprocess, and is likely not a problem with pip.<br />
  ERROR: Failed building wheel for matlabengine<br />
Failed to build matlabengine<br />
ERROR: Could not build wheels for matlabengine, which is required to install pyproject.toml-based projects


What I have tried:

How i can resolve this error ?
Posted
Updated 29-Apr-23 22:13pm

1 solution

The relevant messages are:
FileNotFoundError: [WinError 2] The system cannot find the file specified

// and

RuntimeError: MATLAB installation not found in Windows Registry: [WinError 2] The system cannot find the file specified

And the issue is related to the two packages. You need to go back to the mathworks help forum and ask them how to correct it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900