BradenM / micropy-cli

Micropython Project Management Tool with VSCode support, Linting, Intellisense, Dependency Management, and more!
https://micropy-cli.readthedocs.io
MIT License
313 stars 25 forks source link

micropy install dependency issue #106

Open beerygaz opened 4 years ago

beerygaz commented 4 years ago

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?

askpatrickw commented 4 years ago

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.