Problem using upip and micropip.py

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Jim.S
Posts: 84
Joined: Fri Dec 18, 2015 7:36 pm

Problem using upip and micropip.py

Post by Jim.S » Thu Apr 19, 2018 6:37 am

I am trying to download the latest version of uasyncio using upip but keep running into the same error. I feel I am doing something obviously wrong but cant figure it out on my own. (What is really annoying is that I got this to work in March but can't figure out what I did correct!)

output from micropip
p $ ./micropip.py install micropython-uasyncio
Installing to:..../micropython-samples-master/micropip/
Warning: pypi.python.org SSL certificate is not validated
Error installing 'micropython-uasyncio': Package not found, packages may be partially installed

output from the unix build of micropython

>>> upip.install('https://pypi.python.org/pypi/','micropython-uasyncio')
Installing to: micropython-uasyncio/
Error installing 'https://pypi.python.org/pypi/': Package not found, packages may be partially installed
>>> upip.install("micropython-uasyncio")
Installing to: /home/skelton/.micropython/lib/
Error installing 'micropython-uasyncio': Package not found, packages may be partially installed
>>>

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Problem using upip and micropip.py

Post by pythoncoder » Thu Apr 19, 2018 7:20 am

It turns out there is an issue and the PyPi URL has changed.

I have modified micropip, so for the moment this is the only way to access PyPi library packages.

We'll have to wait for the maintainers to fix upip.

Example run of micropip:

Code: Select all

[adminpete@axolotl]: /mnt/qnap2/data/Projects/MicroPython/micropython-samples/micropip
$ ./micropip.py install -p ~/dummy micropython-uasyncio 
Installing to: /home/adminpete/dummy/
Warning: pypi.org SSL certificate is not validated
Installing micropython-uasyncio 2.0 from https://files.pythonhosted.org/packages/9d/a4/afaf98be714d3701d47c47b3b6aa3d5e52bf277fe8ceb9a2e3fdb05eaf86/micropython-uasyncio-2.0.tar.gz
Installing micropython-uasyncio.core 2.0 from https://files.pythonhosted.org/packages/66/45/372e657680a613ecb6d4d124157fa46f99d2072b4443476a20f39a82f961/micropython-uasyncio.core-2.0.tar.gz
[adminpete@axolotl]: /mnt/qnap2/data/Projects/MicroPython/micropython-samples/micropip
$ ./micropip.py install -p ~/dummy micropython-collections
Installing to: /home/adminpete/dummy/
Warning: pypi.org SSL certificate is not validated
Installing micropython-collections 0.1.2 from https://files.pythonhosted.org/packages/ec/eb/b120a57ae603bb4d78938a9161696f5ec213a9ef21957cd620ccc3c5226d/micropython-collections-0.1.2.tar.gz
[adminpete@axolotl]: /mnt/qnap2/data/Projects/MicroPython/micropython-samples/micropip

Code: Select all

$ ls -l  ~/dummy
total 8
drwxr-xr-x 2 adminpete adminpete 4096 Apr 19 08:26 collections
drwxr-xr-x 2 adminpete adminpete 4096 Apr 19 08:25 uasyncio
[adminpete@axolotl]: /mnt/qnap2/data/Projects/MicroPython/micropython-samples
Peter Hinch
Index to my micropython libraries.

User avatar
Bionaught
Posts: 5
Joined: Sun Apr 08, 2018 5:06 pm

Re: Problem using upip and micropip.py

Post by Bionaught » Thu Apr 19, 2018 8:15 am

Hope they get it sorted soon!

I tried using your micropip in the mean time and am getting this error shown below


graham@graham-SonyVaio ~/esp/images $ sudo python ./micropip.py install -p ~/ micropython-uasyncio
File "./micropip.py", line 211
pkg_spec, e), file=sys.stderr)
^
SyntaxError: invalid syntax

Jim.S
Posts: 84
Joined: Fri Dec 18, 2015 7:36 pm

Re: Problem using upip and micropip.py

Post by Jim.S » Thu Apr 19, 2018 4:03 pm

Thanks @Pythoncoder, that makes me feel a whole lot less stupid!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Problem using upip and micropip.py

Post by pythoncoder » Fri Apr 20, 2018 8:23 am

Bionaught wrote:
Thu Apr 19, 2018 8:15 am
...
I tried using your micropip in the mean time and am getting this error shown below


graham@graham-SonyVaio ~/esp/images $ sudo python ./micropip.py install -p ~/ micropython-uasyncio
File "./micropip.py", line 211
pkg_spec, e), file=sys.stderr)
^
SyntaxError: invalid syntax
micropip requires Python 3.2 or above. I think you're trying to run it under Python 2.x.

This invocation line works here when run from the directory holding micropip.py. (You can, of course, put micropip on your Python path).

Code: Select all

python3 -m micropip install -p ~/ micropython-uasyncio
If I'm wrong and you're running Python 3.2 or above please confirm: in which case there's a bug in micropip which I need to investigate.
Peter Hinch
Index to my micropython libraries.

User avatar
Bionaught
Posts: 5
Joined: Sun Apr 08, 2018 5:06 pm

Re: Problem using upip and micropip.py

Post by Bionaught » Sun Apr 22, 2018 6:59 am

Awesome, I'm able to drag myself a little further up my steep learning curve again.
You are right......python --version returns ->Python 2.7.6
Explicitly pointing at python3 and using micropip works. (python3 -m micropip install -p ~/esp/micropip/uasyncio/ micropython-uasyncio)
Thankyou again pythoncoder

Post Reply