Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Installing Keras – ERROR: Failed building wheel for dm-tree

I’m trying to install keras on Windows with Python 3.12.1 and am unable to do so due to the error in th title. The full error is below:

https://stackoverflow.com/Traceback (most recent call last):
        File "C:\Users\Nate\PycharmProjects\first_flask\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, i
n <module>
          main()
        File "C:\Users\Nate\PycharmProjects\first_flask\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, i
n main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Nate\PycharmProjects\first_flask\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, i
n build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in build_wheel 
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\build_meta.py", line 389, in _build_with_
temp_dir
          self.run_setup()
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup   
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup   
          exec(code, locals())
        File "<string>", line 124, in <module>
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup  
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_com
mands
          dist.run_commands()
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_com
mands
          self.run_command(cmd)
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command       
          super().run_command(command)
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_com
mand
          cmd_obj.run()
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_comm
and
          self.distribution.run_command(command)
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command       
          super().run_command(command)
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_com
mand
          cmd_obj.run()
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, i
n run
          self.run_command(cmd_name)
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_comm
and
          self.distribution.run_command(command)
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command       
          super().run_command(command)
        File "C:\Users\Nate\AppData\Local\Temp\pip-build-env-hjzyqeky\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_com
mand
          cmd_obj.run()
        File "<string>", line 72, in run
        File "<string>", line 110, in build_extension
        File "C:\Users\Nate\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '-j16', '--config', 'Release']' returned non-zero exit status 1.
      [end of output]
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dm-tree
Failed to build dm-tree
ERROR: Could not build wheels for dm-tree, which is required to install pyproject.toml-based projects

In my enviroment variables PATH I have the C:\Users<user>\AppData\Local\Programs\Python\Python312 directory but am wondering if I should also have the C:\Users<user>\AppData\Local\Programs\Python\Python312\Scripts directory. Not sure if that’s a potential cause of this error. Any help getting the install to work is appreciated. ALso, I’d prefer not to have to install a different python version is possible as I’ve seen others suggest installing python 3.11.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Keras 3 is compatible with Linux and MacOS systems. It is not compatible with Windows. To use it on windows, use WSL2 to run Keras.

Also note that keras 3 currently supports python 3.9 – 3.11.

See https://pypi.org/project/keras/#description for more information.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading