Skip to content

Component error: pyscript - No module named 'packaging' #90

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

Closed
dapuzz opened this issue Nov 16, 2020 · 9 comments · Fixed by #91
Closed

Component error: pyscript - No module named 'packaging' #90

dapuzz opened this issue Nov 16, 2020 · 9 comments · Fixed by #91

Comments

@dapuzz
Copy link

dapuzz commented Nov 16, 2020

Hi
Can you help me fixind this issue?
I have upgraded via HACS from 0,xx to 1.0.0 but now I am stuck with this log.

Running HA in virtual env python_version 3.7.3

Thanks

@dapuzz
Copy link
Author

dapuzz commented Nov 16, 2020

I reverted back to 0,32 and everything is working fine.

@dlashua
Copy link
Contributor

dlashua commented Nov 16, 2020

@raman325 I believe this is related to your requirements PR.

The "packaging" module seems to be already installed for me, so I don't have this issue. I run the latest version of HA in docker. However, it's not specified in pyscript's manifest.json so it won't be installed if it isn't already. Should it be added there?

@raman325
Copy link
Contributor

raman325 commented Nov 16, 2020

hmm @dapuzz what version of Home Assistant are you running? The latest version of Home Assistant requires Python 3.8 at a minimum. Home Assistant uses the packaging module internally but I can't find any references to installing it within the HA code so I assumed it was expected to always be there. I can build a fix for this, I just want to make sure that it is needed before getting too far into it.

@raman325
Copy link
Contributor

I stand corrected, latest can work on Python 3.7

@raman325
Copy link
Contributor

OK I stand corrected again, HA development uses packaging but the actual application does not. Will submit a fix soon.

@dapuzz
Copy link
Author

dapuzz commented Nov 16, 2020

I reported using 0.115 but now I am running ha 0.117.
The point is that “packaging” is a prerequisite when using pip, so I think pyscript is not using my venv for some reason, but some other python installation on my rpi

@raman325
Copy link
Contributor

pyscript uses HA's installation function for installing packages, so it would be installing packages using the same pip that HA is. I don't think pip needs packaging because I just created a new virtual environment and it wasn't there. Regardless, can you try cloning the following repo and moving the custom_components/pyscript folder into your HA custom_components folder? I can't write a test for this so just want to see if it resolves your issue (it installs packaging on demand)

https://github.com/raman325/pyscript/tree/install_packaging

@dapuzz
Copy link
Author

dapuzz commented Nov 17, 2020

I confirm this solution works. I was able to grab the installation process and everything has gone ok.
/srv/homeassistant/bin/python3 -m pip install --quiet packaging --upgrade --constraint /srv/homeassistant/lib/python3.7/site-packages/homeassistant/package_constraints.txt

Thanks again, you can merge and close this issue
Bye

@raman325
Copy link
Contributor

Thanks for confirming @dapuzz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants