pyscript icon indicating copy to clipboard operation
pyscript copied to clipboard

Pyscript integration could not be installed

Open Roei639 opened this issue 2 years ago • 7 comments

Hello, When trying to install pyscript integration through the UI in HA an error: Could not load configuration flow: [object Object]

An attempt to install via yaml results in an error: Component error: pyscript - cannot import name 'DirModifiedEvent' from 'watchdog.events' (/usr/local/lib/python3.9/site-packages/watchdog/events.py)

Roei639 avatar Feb 26 '22 11:02 Roei639

It looks like you may have an error further up as well. Pyscript has "watchdog" in it's requirements (in the manifest.json file). Home Assistant should install this module when it installs Pyscript. However, it looks like yours didn't for some reason. You may want to just restart Home Assistant and then try to install pyscript again. Or, look higher in the logs and see what the error was. It might be something temporary (like your network or the pip servers being down) or it could be something more difficult (like permissions issues on the library install directories).

dlashua avatar Mar 03 '22 12:03 dlashua

Could it be incompatible versions of watchdog? The build-in integration folder_watcher used to require watchdog==2.0.3, which is the same as pyscript. But I noticed in 2022.3 that folder_watcher now requires watchdog==2.1.6, which creates a conflict with the pyscript requirement. I should update pyscript to require watchdog>=2.0.3.

What version of HA are you running? Can you check what version of watchdog is installed?

craigbarratt avatar Mar 06 '22 23:03 craigbarratt

I have a similar error:

Setup failed for custom integration pyscript: Requirements for pyscript not found: ['croniter==1.3.4', 'watchdog==2.1.6'].
10:49:57 PM – (ERROR) setup.py
Unable to install package croniter==1.3.4: ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/.local' Check the permissions.
10:49:57 PM – (ERROR) util/package.py - message first occurred at 10:47:21 PM and shows up 6 times

my HA is running inside a docker, which is running as the local user:

  # ha
  homeassistant:
    container_name: homeassistant
    restart: unless-stopped
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - ${HA_CONFIG_PATH}:/config
      - /etc/localtime:/etc/localtime:ro
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
    privileged: true
    network_mode: host
    user: "${LOCAL_USER}:${LOCAL_GROUP}"
    depends_on:
      - zigbee2mqtt
      ```

neuronflow avatar Feb 19 '23 22:02 neuronflow

when I try to add via GUI:

Config flow could not be loaded: Unknown error

neuronflow avatar Feb 20 '23 10:02 neuronflow

@Roei639 did you manage to find the solution to your problem? If you did, could you please update the ticket or close it? Thank you

ALERTua avatar Sep 25 '23 07:09 ALERTua

I have a similar error:

Setup failed for custom integration pyscript: Requirements for pyscript not found: ['croniter==1.3.4', 'watchdog==2.1.6'].
10:49:57 PM – (ERROR) setup.py
Unable to install package croniter==1.3.4: ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/.local' Check the permissions.
10:49:57 PM – (ERROR) util/package.py - message first occurred at 10:47:21 PM and shows up 6 times

my HA is running inside a docker, which is running as the local user:

  # ha
  homeassistant:
    container_name: homeassistant
    restart: unless-stopped
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - ${HA_CONFIG_PATH}:/config
      - /etc/localtime:/etc/localtime:ro
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
    privileged: true
    network_mode: host
    user: "${LOCAL_USER}:${LOCAL_GROUP}"
    depends_on:
      - zigbee2mqtt
      ```

I just migrated from HA in a Docker container on my Synology, to running HAOS on a MiniPC.

Pyscript was working fine in Docker, but on importing my backup into HAOS, I got that same message about Pyscript requirements with both croniter and watchdog.

Just confirming here that I changed the line in /config/custom_components/pyscript/manifest.json to "requirements": ["croniter>=1.3.8", "watchdog>=2.2.1"], and now I get a new error:

Logger: homeassistant.setup
Source: setup.py:185
First occurred: 14:53:27 (1 occurrences)
Last logged: 14:53:27

Setup failed for custom integration pyscript: Requirements for pyscript not found: ['croniter>=1.3.8'].

So it seems like the watchdog portion of the error was resolved by the change. I'm going to figure out how to manually install croniter next, and then I'll report back.

SRF-Audio avatar Oct 16 '23 20:10 SRF-Audio

For anyone also having this problem in a docker container, I've solved this with a workaround by mapping a docker volume to the /.local folder. My docker-compose looks something like this:

version: '3'
services:
  homeassistant:
    user: "1000:1000"
    container_name: homeassistant
    image: homeassistant/home-assistant:2024.3
    network_mode: host
    volumes:
      - /home/user/docker/homeAssistant/homeassistantData:/config
      - /home/user/docker/homeAssistant/pyscript_install_hack:/.local

cchaz003 avatar Mar 16 '24 02:03 cchaz003