I am fairly new to home assistant intigration development and i am trying to create my own intigration to use Scikit-learn, but i am having trouble actually getting home assistant to install the pakage. To my understanding any requirments for the intigrations should be put in the manifest.json file under “requirements”. As stated on the home assistant developers page:
Requirements is an array of strings. Each entry is a
pip
compatible string
So i added:
"requirements": ["scikit-learn==1.0"],
to my manifest.json. However its giving me some kind of installation error:
2023-02-18 15:36:32.413 ERROR (SyncWorker_0) [homeassistant.util.package] Unable to install package scikit-learn==1.0: error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [81 lines of output]
Looking in links: https://wheels.home-assistant.io/musllinux/
Ignoring numpy: markers 'python_version == "3.7" and platform_machine != "aarch64" and platform_system != "AIX" and platform_python_implementation != "PyPy"' don't match your environment
Collecting setuptools
Downloading setuptools-67.3.2-py3-none-any.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 5.2 MB/s eta 0:00:00
Collecting wheel
Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Collecting Cython>=0.28.5
Using cached Cython-0.29.33-py2.py3-none-any.whl (987 kB)
Collecting oldest-supported-numpy
Using cached oldest_supported_numpy-2022.11.19-py3-none-any.whl (4.9 kB)
Collecting scipy>=1.1.0
Using cached scipy-1.10.0.tar.gz (42.4 MB)
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'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [42 lines of output]
+ meson setup --prefix=/usr/local /tmp/pip-install-ythtwkvh/scipy_6deab88ebfa44e318aefb73ba313d71a /tmp/pip-install-ythtwkvh/scipy_6deab88ebfa44e318aefb73ba313d71a/.mesonpy-5nqcsz3s/build --native-file=/tmp/pip-install-ythtwkvh/scipy_6deab88ebfa44e318aefb73ba313d71a/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 144, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'mesonpy' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
main()
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 148, in prepare_metadata_for_build_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/tmp/pip-build-env-3rgaalnr/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 1060, in build_wheel
with _project(config_settings) as project:
File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/tmp/pip-build-env-3rgaalnr/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 975, in _project
with Project.with_temp_working_dir(
File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/tmp/pip-build-env-3rgaalnr/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 750, in with_temp_working_dir
yield cls(source_dir, tmpdir, build_dir, meson_args)
File "/tmp/pip-build-env-3rgaalnr/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 632, in __init__
self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
File "/tmp/pip-build-env-3rgaalnr/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 680, in _configure
self._meson('setup', *setup_args)
File "/tmp/pip-build-env-3rgaalnr/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 657, in _meson
return self._proc('meson', *args)
File "/tmp/pip-build-env-3rgaalnr/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 652, in _proc
subprocess.check_call(list(args), env=self._env)
File "/usr/local/lib/python3.10/subprocess.py", line 364, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/local/lib/python3.10/subprocess.py", line 345, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/local/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.10/subprocess.py", line 1845, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'meson'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[notice] A new release of pip available: 22.3 -> 23.0.1
[notice] To update, run: pip install --upgrade pip
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[notice] A new release of pip available: 22.3 -> 23.0.1
[notice] To update, run: pip install --upgrade pip
I am getting basicly the same error if i simply use “scikit-learn” without any version number.
Clearly there is something i am missing and i dont understand the error. I am guessing it has something to do with Home assistant and what python version its using. I have no problem installing it with pip on my computer using python 3.10.
Could someone point me in the rigth direction of how to think when using pakages for intigrations. Are there some pakages that wont work with home assistant? If so how do i know which ones ? If scikit is not a viable option are there alternativs I can using machine learning ?