MicroPico icon indicating copy to clipboard operation
MicroPico copied to clipboard

Package management/install

Open tompinnacle opened this issue 1 year ago • 6 comments

Maybe I'm missing something obvious, but how do you acquire and add a package when using VS Code and MicroPico?

In Thonny there is a package manager When using full Python you can use pip

But I haven't found anything about doing it in VS Code

tompinnacle avatar Oct 21 '23 16:10 tompinnacle

I had trouble learning and understanding how to deal with libraries too.

Libraries that are a single .py file are an easy drag and drop. Then I was trying to import this to my pico https://github.com/chrisb2/pi_ina219. Installing via pip3 installs it on the system I guess. There is an option to upload the whole project to the board but I guess it doesn't include the library because I don't know how to move it from the system pip packages to the project first.

lefixx avatar Oct 23 '23 12:10 lefixx

In MicroPython there is no pip available and of course pip installs packages locally. My understanding is that Thonny's package manager UI is only a GUI interface for pip on your local machine.

Like @lefixx mentioned, you can either include a library if it's a single file into your project or have a look at: https://docs.micropython.org/en/latest/reference/packages.html I may work on a GUI for installing mip packages via VSCode on your pico but that my take a while...

paulober avatar Oct 24 '23 09:10 paulober

I will take a look at mip, thanks. So installing libraries to the project and then uploading the whole project is not a thing?

lefixx avatar Oct 25 '23 06:10 lefixx

No, cause the files are install in your pip directory. Though you can install it with pip install --target <path/to/folder/in/project> <package-name> into your project directory and then upload it with the upload-project command.

paulober avatar Oct 25 '23 08:10 paulober

That sounds as an even better solution. many thanks

lefixx avatar Oct 25 '23 09:10 lefixx

I have started to use pipkin, it can upload directly to the board, but I download to my Mac and then upload to pico from VS Code. The Micropico documentation mentions a sync-button, but I haven't found one so I upload via the popup menu.

for example: pipkin -d ./lib install micropython-oled

lark-cig avatar Oct 31 '23 12:10 lark-cig