Okay, just get everything loaded.
After loading in Klipper, Moonraker, Mainsail and then Katapult onto the CB1 running Armbian, I try to run pip3 install pyserial
with the following results:
biqu@bigtreetech-cb1:~$ pip3 install pyserial
Command 'pip3' not found, but can be installed with:
sudo apt install python3-pip
Okay, then do sudo apt install python3-pip
and things seem to go okay:
sudo apt install python3-pip
biqu@bigtreetech-cb1:~$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
python3-setuptools python3-wheel
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
python3-pip python3-setuptools python3-wheel
0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded.
Need to get 1,877 kB of archives.
After this operation, 9,566 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bookworm/main arm64 python3-setuptools all 66.1.1-1 [521 kB]
Get:2 http://deb.debian.org/debian bookworm/main arm64 python3-wheel all 0.38.4-2 [30.8 kB]
Get:3 http://deb.debian.org/debian bookworm/main arm64 python3-pip all 23.0.1+dfsg-1 [1,325 kB]
Fetched 1,877 kB in 2s (1,182 kB/s)
Selecting previously unselected package python3-setuptools.
(Reading database ... 37662 files and directories currently installed.)
Preparing to unpack .../python3-setuptools_66.1.1-1_all.deb ...
Unpacking python3-setuptools (66.1.1-1) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../python3-wheel_0.38.4-2_all.deb ...
Unpacking python3-wheel (0.38.4-2) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../python3-pip_23.0.1+dfsg-1_all.deb ...
Unpacking python3-pip (23.0.1+dfsg-1) ...
Setting up python3-setuptools (66.1.1-1) ...
Setting up python3-wheel (0.38.4-2) ...
Setting up python3-pip (23.0.1+dfsg-1) ...
Processing triggers for man-db (2.11.2-2) ...
So with Python3-pip installed (which seems to match the instructions I get when I research the issue), I try pip3 install pyserial
again:
biqu@bigtreetech-cb1:~$ pip3 install pyserial
error: externally-managed-environment
× This environment is externally managed
mq> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
So, I take a gander at /usr/share/doc/python3.11/README.venv
which tells me to install the package using the instructions:
e.g. instead of running:
$ pip install --user foo
run:
$ mkdir -p ~/.venvs
$ python3 -m venv ~/.venvs/foo
$ ~/.venvs/foo/bin/python -m pip install foo
Okay, the first command goes okay, but the second (python3 -m venv ~/.venvs/pyserial
) fails and suggests that I run apt install python3.11-venv
which executes as:
biqu@bigtreetech-cb1:~$ apt install python3.11-venv
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
So, the obvious solution (to me) is to run sudo apt install python3.11-venv
which seems to run okay:
biqu@bigtreetech-cb1:~$ sudo apt install python3.11-venv
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
python3.11-venv
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 5,892 B of archives.
After this operation, 28.7 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main arm64 python3.11-venv arm64 3.11.2-6 [5,892 B]
Fetched 5,892 B in 0s (38.9 kB/s)
Selecting previously unselected package python3.11-venv.
(Reading database ... 38585 files and directories currently installed.)
Preparing to unpack .../python3.11-venv_3.11.2-6_arm64.deb ...
Unpacking python3.11-venv (3.11.2-6) ...
Setting up python3.11-venv (3.11.2-6) ...
So I go back to python3 -m venv ~/.venvs/pyserial
which seems to run (at least I don’t get any errors) followed by:
biqu@bigtreetech-cb1:~$ ~/.venvs/pyserial/bin/python -m pip install pyserial
Collecting pyserial
Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq 90.6/90.6 kB 566.5 kB/s eta 0:00:00
Installing collected packages: pyserial
Successfully installed pyserial-3.5
Looks good, so I go back and follow my process that I use to test Katapult load (this is the process I’ve used for testing Sineos’ bash script) and everything runs fine until I get to executing:
ls /dev/serial/by-id/
python3 ~/Katapult/scripts/flash_can.py -d /dev/serial/by-id/- MCU Serial from previous
At which point I get:
biqu@bigtreetech-cb1:~$ python3 ~/Katapult/scripts/flash_can.py -d /dev/serial/by-id/usb-katapult_stm32f446xx_30001A000A50315939343520-if00
ERROR:root:Flash Error
Traceback (most recent call last):
File "/home/biqu/Katapult/scripts/flash_can.py", line 538, in run
import serial
ModuleNotFoundError: No module named 'serial'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/biqu/Katapult/scripts/flash_can.py", line 635, in main
loop.run_until_complete(sock.run(args.device, args.baud, fpath))
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/biqu/Katapult/scripts/flash_can.py", line 540, in run
raise FlashCanError(
FlashCanError: The pyserial python package was not found. To install run the following command in a terminal:
pip3 install pyserial
So, I run pip3 install pyserial
again and get:
biqu@bigtreetech-cb1:~$ pip3 install pyserial
error: externally-managed-environment
× This environment is externally managed
mq> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
I’m not sure what to do next as I’m clearly stuck in a loop. It looked like pyserial was properly installed (above) but clearly it wasn’t.
Suggestions?