pyscript icon indicating copy to clipboard operation
pyscript copied to clipboard

Permission denied for pythin libs in default installation

Open Matyro opened this issue 8 months ago • 2 comments

Hi, I am currently trying to get some custom plots running for debugging purpose. To install Matplotlib I simply added it to my /config/pyscript/requirements/... and get following error:

Unable to install package matplotlib: × Failed to build matplotlib==3.10.1├─▶ The build backend returned an error ╰─▶ Call tomesonpy.build_wheel failed (exit status: 1) [stderr] Traceback (most recent call last): File "<string>", line 11, in <module> wheel_filename = backend.build_wheel("/tmp/.tmpksdQ7D/builds-v0/.tmpAbW3Oq", {}, None) File "/tmp/.tmpksdQ7D/builds-v0/.tmpvlQaLO/lib/python3.13/site-packages/mesonpy/__init__.py", line 1020, in wrapper return func(*args, **kwargs) File "/tmp/.tmpksdQ7D/builds-v0/.tmpvlQaLO/lib/python3.13/site-packages/mesonpy/__init__.py", line 1073, in build_wheel with _project(config_settings) as project: ~~~~~~~~^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/contextlib.py", line 141, in __enter__ return next(self.gen) File "/tmp/.tmpksdQ7D/builds-v0/.tmpvlQaLO/lib/python3.13/site-packages/mesonpy/__init__.py", line 947, in _project yield Project(source_dir, build_dir, meson_args, editable_verbose) ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.tmpksdQ7D/builds-v0/.tmpvlQaLO/lib/python3.13/site-packages/mesonpy/__init__.py", line 662, in __init__ self._meson = _get_meson_command(pyproject_config.get('meson')) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/.tmpksdQ7D/builds-v0/.tmpvlQaLO/lib/python3.13/site-packages/mesonpy/__init__.py", line 982, in _get_meson_command meson_version = subprocess.run(cmd + ['--version'], check=False, text=True, capture_output=True).stdout ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/subprocess.py", line 556, in run with Popen(*popenargs, **kwargs) as process: ~~~~~^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/subprocess.py", line 1038, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pass_fds, cwd, env, ^^^^^^^^^^^^^^^^^^^ ...<5 lines>... gid, gids, uid, umask, ^^^^^^^^^^^^^^^^^^^^^^ start_new_session, process_group) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/subprocess.py", line 1974, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) PermissionError: [Errno 13] Permission denied: 'meson' hint: This usually indicates a problem with the package or the build environment.

Is this a known issue and how to avoid this?

Cheers Dominik

Matyro avatar Apr 14 '25 17:04 Matyro

The error is permission denied. From pathnames like /usr/local/lib/python3.13/subprocess.py it appears that HASS is not running inside a venv, so it's not surprising that HASS can't write to the system directories. You need to configure or run HASS in a manner that allows packages to be installed. Perhaps you could manually install them in whatever environment HASS is running?

craigbarratt avatar Apr 14 '25 23:04 craigbarratt

This HASS is running on my test Pi 5 as default installation, pyscript was installed via HACS. Can the Installation process be modified to directly create a venv? Or can apps be automatically run in a specified venv (maybe defined in the yaml?

This would make things easier compared to patching it afterwards. If I have time I may be able to look into it.

Matyro avatar Apr 15 '25 05:04 Matyro