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

python: python3 urllib.request import error #8285

Closed
leonardpitzu opened this issue Feb 23, 2019 · 9 comments
Closed

python: python3 urllib.request import error #8285

leonardpitzu opened this issue Feb 23, 2019 · 9 comments

Comments

@leonardpitzu
Copy link

Maintainer: @commodo
Environment: ubuntu 18.04 64bit/openwrt main/latest - ath79

Description:
urllib (py3) is missing some dependencies

File "/request.py", line 86, in <module>
ModuleNotFoundError: No module named 'email'
@commodo
Copy link
Contributor

commodo commented Feb 24, 2019

Will take a look.

@BKPepe
Copy link
Member

BKPepe commented Feb 25, 2019

I have successfully flashed OpenWrt SNAPSHOT, r9420-c17a68c to my router to be able to reproduce your issue, then I install python3-urllib3 and it installed a lot of stuff including python3-email.

See my log here: https://pastebin.com/dqrFi5um also you can find there that I have followed https://urllib3.readthedocs.io/en/latest/

@leonardpitzu
Copy link
Author

I have not used urllib3 but the stock urllib that comes with py3. That one misses the email lib. Point was the default is unusable as it missses a critical dependency.

@commodo
Copy link
Contributor

commodo commented Feb 26, 2019

@leonardpitzu

try this:

opkg update
opkg install python3-email

this seems to work for me

python3-email is a separate package, in order to reduce the size of Python3; I know it's not a great thing; maybe we could split python3-urllib into it's own package and see;

the split of python3 & python packages was done arbitrary
first to create the python[3]-base packages which are the minimal packages required for python[3] to start, then python[3]-light, some generic libraries from core Python, and then others were split away into other packages

@leonardpitzu
Copy link
Author

sure, it works like this (already did it, works as expected). The idea was to 1) remove urllib entirely and make it a stand-alone package, or 2) add the necessary dependencies to make it work "out of the box". urllib currently is useless and if you build openwrt from scratch you'll notice that upon running py3 it fails so you need to build it again to add email and then a third time to add idna (encodings) :)

@commodo
Copy link
Contributor

commodo commented Feb 26, 2019

sure, it works like this (already did it, works as expected).

oh, ok ; that wasn't obvious to me the first time;

i prefer 1) if that's ok

@leonardpitzu
Copy link
Author

@commodo 1) is perfect. A stripped down py interpreter is great. Then everybody can add stuff as needed.
Guess you can close the issue whenever you have time to split urllib into a package.

commodo added a commit to commodo/packages that referenced this issue Feb 26, 2019
This is the result of this discussion:
  openwrt#8285

`urllib.request` requires the `email` module/lib, which was part of
python3-light.
This change moves the Lib/urllib folder from the python3-light into it's
own package, making it lighter. At least this way, users that want `urllib`
(on top of `python3-light`) will be forced to install it via opkg and this
will make sure `python3-email` gets installed as well.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
@jefferyto
Copy link
Member

@leonardpitzu @hnyman I think this can be closed?

@leonardpitzu
Copy link
Author

@jefferyto yes, thanks!

@hnyman hnyman closed this as completed Mar 11, 2019
thess pushed a commit to thess/OpenWrt-packages that referenced this issue Mar 12, 2019
This is the result of this discussion:
  openwrt#8285

`urllib.request` requires the `email` module/lib, which was part of
python3-light.
This change moves the Lib/urllib folder from the python3-light into it's
own package, making it lighter. At least this way, users that want `urllib`
(on top of `python3-light`) will be forced to install it via opkg and this
will make sure `python3-email` gets installed as well.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
thiagoricciardi pushed a commit to thiagoricciardi/packages that referenced this issue Apr 3, 2019
This is the result of this discussion:
  openwrt#8285

`urllib.request` requires the `email` module/lib, which was part of
python3-light.
This change moves the Lib/urllib folder from the python3-light into it's
own package, making it lighter. At least this way, users that want `urllib`
(on top of `python3-light`) will be forced to install it via opkg and this
will make sure `python3-email` gets installed as well.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
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

No branches or pull requests

5 participants