Installing pyserial: ImportError: No module named serial

I am trying to install pyserial module on Pololu 3pi+ 2040 robot. Is there any guide from where I can install this? I tried installing using pip (but it got installed in my local machine, but not on the robot). Is there any way to install it on the robot? Also I am unable to get access to the OS of the robot on the terminal on my local machine, I can get access to a python interface through thonny.

The guide here says to install pyserial on the robot, but does not guide about how to go about installing it on the robot.


The pySerial library was designed for Python, not MicroPython. If you want to connect a serial device to your 3pi+ 2040, I recommend using MicroPython’s machine.UART class.

Also, what do you mean by “access to the OS of the robot”? MicroPython does not come with a shell like Bash, but it does provide a Python REPL via its virtual serial port and you can use that to run Python commands.