micropy-cli icon indicating copy to clipboard operation
micropy-cli copied to clipboard

micropy install dependency issue

Open beerygaz opened this issue 5 years ago • 1 comments

I'm new to micropython, so this may well be the fault of inexperience but here goes:

I'm using your great tool under Windows and VS Code.

I'm trying to run some code that depends on urlli.parse and urllib.parse depends on a module called collections.

I have run 'micropy install micropython-urllib.parse' and 'micropy install micropython-collections'

However, once uploaded to my pycom fipy I keep getting the error

File "/flash/lib/parse.py", line 32, in <module>
ImportError: no module named 'collections'

However:

>>> os.listdir('lib')
['micropython-collections', 'micropython-hashlib', 'base64.py', 'defaultdict.py', 'hmac.py', 'mqtt_async.py', 'parse.py', 'urllib.py', 'warnings.py']

Any idea where I'm going wrong?

beerygaz avatar May 12 '20 12:05 beerygaz

This is mentioned in the docs, but its not intuitive given how Python development normally works AND I'm going through this exact same learning curve today. ;-)

micropy install only makes the stubs available to vscode. To install the package you need to use upip on your device (if it has network connectivity) use upip from your dev machine which you can then copy it over to your /src/lib or to use micropip.py.

To run upip locally, I think you need to compile MicroPython. I'm asking about that in the MP Forum: https://forum.micropython.org/viewtopic.php?f=2&t=8354

I hope that helps and if I got anything wrong please let me know.. I'm also just figuring this out.

askpatrickw avatar May 15 '20 20:05 askpatrickw