Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration installation fails in Home Assistant 2023.6: alexa_media: cannot import name 'formatargspec' from 'inspect' ( #1967

Closed
naumz opened this issue Jun 19, 2023 · 14 comments · Fixed by #2040
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@naumz
Copy link

naumz commented Jun 19, 2023

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug

After downloading the Alexa Media Player repository in HACS, restarting and clicking on the add integration button, an error pops up: "Config flow could not be loaded: {"message":"Invalid handler specified"}". Looking at the logs, the integration appears to fail to install due to this error: "ImportError: cannot import name 'formatargspec' from 'inspect'".

To Reproduce

  1. After adding the Alexa Media Player repository in HACS and restarting, go to 'Settings' -> 'Devices and Services'
  2. Click on 'Add Integration' and choose 'Alexa Media Player'
  3. See error.

Expected behavior

Integration would get installed.

Screenshots

N/A

System details

  • Home-assistant (version): 2023.6
  • alexa_media (version from const.py or HA startup): 4.6.4
  • alexapy (version from pip show alexapy or HA startup): 1.26.8
  • Amazon 2FA is enabled (y/n). <!---We will not debug login issues if unanswered--->: y

Logs
Please provide logs.

2023-06-18 21:06:37.852 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration alexa_media: cannot import name 'formatargspec' from 'inspect' (/usr/local/lib/python3.11/inspect.py)

Additional context

Home Assistant 2023.6 appears to have upgraded Python to 3.11. Could it be related?

@alandtse alandtse added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Jun 21, 2023
@tonygentry

This comment was marked as duplicate.

@github-actions github-actions bot removed the help wanted Extra attention is needed label Jun 28, 2023
@popy2k14

This comment was marked as off-topic.

@Leakopf1
Copy link

Leakopf1 commented Jul 2, 2023

Hello. Same issue on my side. HACS was installed from scratch. When trying to install the Alexa integration I'll get the following logs:

Logger: homeassistant.config_entries
Source: config_entries.py:863
First occurred: 16:35:01 (1 occurrences)
Last logged: 16:35:01

Error occurred loading flow for integration alexa_media: cannot import name 'formatargspec' from 'inspect' (/usr/local/lib/python3.11/inspect.py)

@jdserras
Copy link

jdserras commented Jul 3, 2023

Hello, same issue on my side after updating the HA:

Home Assistant 2023.6.3
Supervisor 2023.06.4
Operating System 10.3
Interface: 20230608.0 - latest

Log:
Logger: homeassistant.config_entries
Source: config_entries.py:863
First occurred: 16:07:21 (4 occurrences)
Last logged: 16:07:40

Error occurred loading flow for integration alexa_media: cannot import name 'formatargspec' from 'inspect' (/usr/local/lib/python3.11/inspect.py)

@JoseFerre
Copy link

Updated wrapt to the latest version and it fixed it for me.

@jojo01fr
Copy link

Similar issue not allowing installation because of alexapy 1.26.8, just modified that to 1.25.5 on
custom_components/alexa_media/manifest.json
Restarted HA and then installation went fine. Source:
#1579

@jdserras
Copy link

Tried the modification of manifest.json and didn't work.

@jojo01fr
Copy link

Tried the modification of manifest.json and didn't work.

On this line:
"requirements": ["alexapy==1.25.5", "packaging>=20.3", "wrapt>=1.12.1"],

@StuckInLoop
Copy link

just recently updated the everything from a very old version. its probably been about 2-3 years old. everything went fine except alexa media player. having similar issue, changed to 1.25.5. saved then rebooted but still does not work.

@mhenriquezschott
Copy link

same here..

@jdserras
Copy link

jdserras commented Aug 9, 2023

Yesterday I did the update of HA and I could reinstall it and now works good.

Supervisor 2023.08.1
Operating System 10.4

@mhenriquezschott
Copy link

still same issue...I think is something with my host OS or docker version..I bring my HA from an old 2021 version to this one, after a traumatic upgrade this damn integration is the only one missing!...I don't want to star over just because of this one...

core-2023.8.1
Frontend 20230802.0 - latest
Host Operating System Ubuntu 20.04.6 LTS
supervisor-2023.08.1
Docker Version 24.04

I can't remove the integration can someone explain me how?...even removing the folder inside custom_components and the integration still show up...anyway I manually delete the folder, reboot, reinstall the integration and the issue still persist, same message: cannot import name 'formatargspec' from 'inspect' (/usr/local/lib/python3.11/inspect.py)

Any ideas what else to check or what other folder/file/thing can I try to delete to "refresh" HA and allow this thing to install?

Thanks!!

@mhenriquezschott
Copy link

...in my case the fix was really weird, I leave it here in case someone else want to try it...
I think it was do to some requirement on the dock container that was not updated during the HA update..so the real problem was

It seems that the "formatargspec" thing that need to be in inspect.py is not..or something like that...after finding a simillar issue but with other project I found that it was somehow related to the "wrapt" library....I connect to the dock container and did an update:

pip install --upgrade wrapt

After that the integration aske me to re-configure the integration and they start working again...

P.S: to connect to the docker container:

docker exec -it $(docker ps -f name=homeassistant -q) bash

@github-actions
Copy link

github-actions bot commented Sep 1, 2023

This bug report has been labelled as help wanted since there has been no activity in the last 3 weeks. It will not be closed automatically.

@github-actions github-actions bot added the help wanted Extra attention is needed label Sep 1, 2023
@alandtse alandtse changed the title Integration installation fails in Home Assistant 2023.6 Integration installation fails in Home Assistant 2023.6: alexa_media: cannot import name 'formatargspec' from 'inspect' ( Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants