Weird python errors after CAN upgrade

Basic Information:

Printer Model: Voron 0.1 upgraded to 0.2r1 with CAN
MCU / Printerboard: SKR mini E3 v2 with U2C v1.2 and EBB36 v1.2
Host / SBC: x86 mini PC with Lubuntu 24.04.1 LTS
klippy.log

My issue:

I’ve upgraded my V0 to a CAN setup and after updating my mcu config with the proper canbus_uuid’s I’m getting this error:

My setup is on a x86 mini PC with Lubuntu LTS installed, and Klipper/Moonraker/Mainsail installed via Kiauh v5.

After getting that I’ve tried this:

szafran@3DP:~$ sudo apt update ; sudo apt upgrade ; sudo apt dist-upgrade ; sudo apt autoremove ; sudo apt autoclean
Stary:1 http://ftp.vectranet.pl/ubuntu noble InRelease
Stary:2 https://download.docker.com/linux/ubuntu noble InRelease
Stary:3 http://ftp.vectranet.pl/ubuntu noble-updates InRelease
Stary:4 http://ftp.vectranet.pl/ubuntu noble-security InRelease
Stary:5 http://ftp.vectranet.pl/ubuntu noble-backports InRelease
Stary:6 https://dl.google.com/linux/chrome/deb stable InRelease
Czytanie list pakietów... Gotowe
Budowanie drzewa zależności... Gotowe
Odczyt informacji o stanie... Gotowe
5 pakietów może być zaktualizowanych. Można je zobaczyć wykonując 'apt list --upgradable'.
Czytanie list pakietów... Gotowe
Budowanie drzewa zależności... Gotowe
Odczyt informacji o stanie... Gotowe
Obliczanie aktualizacji... Gotowe
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libcjson1 libavdevice60 ffmpeg libpostproc57 libavcodec60 libavutil58
  libswscale7 libswresample4 libavformat60 libavfilter9
Learn more about Ubuntu Pro at https://ubuntu.com/pro
Aktualizacje odroczone, z powodu stopniowego wprowadzania przez dystrybucję:
  python3-distupgrade python3-update-manager ubuntu-release-upgrader-core ubuntu-release-upgrader-qt update-manager-core
0 aktualizowanych, 0 nowo instalowanych, 0 usuwanych i 5 nieaktualizowanych.
Czytanie list pakietów... Gotowe
Budowanie drzewa zależności... Gotowe
Odczyt informacji o stanie... Gotowe
Obliczanie aktualizacji... Gotowe
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libcjson1 libavdevice60 ffmpeg libpostproc57 libavcodec60 libavutil58
  libswscale7 libswresample4 libavformat60 libavfilter9
Learn more about Ubuntu Pro at https://ubuntu.com/pro
Aktualizacje odroczone, z powodu stopniowego wprowadzania przez dystrybucję:
  python3-distupgrade python3-update-manager ubuntu-release-upgrader-core ubuntu-release-upgrader-qt update-manager-core
0 aktualizowanych, 0 nowo instalowanych, 0 usuwanych i 5 nieaktualizowanych.
Czytanie list pakietów... Gotowe
Budowanie drzewa zależności... Gotowe
Odczyt informacji o stanie... Gotowe
0 aktualizowanych, 0 nowo instalowanych, 0 usuwanych i 5 nieaktualizowanych.
Czytanie list pakietów... Gotowe
Budowanie drzewa zależności... Gotowe
Odczyt informacji o stanie... Gotowe

Everything under kiauh is also up to date.

I’ve tried reinstalling Klipper/Moonraker via Kiauh - nothing changed.

I’ve tried this:

systemctl stop klipper-Mikrus
~/klippy-env/bin/pip install -r ~/klipper/scripts/klippy-requirements.txt
cd ~/klippy-env/bin
./pip install --upgrade python-can==4.3
systemctl start klipper-Mikrus

result:

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Wymagane jest uwierzytelnienie, aby zatrzymać jednostkę „klipper-Mikrus.service”.
Authenticating as: Szafran (szafran)
Password:
==== AUTHENTICATION COMPLETE ====
Ignoring greenlet: markers 'python_version < "3.12"' don't match your environment
Requirement already satisfied: cffi==1.14.6 in ./klippy-env/lib/python3.12/site-packages (from -r /home/szafran/klipper/scripts/klippy-requirements.txt (line 5)) (1.14.6)
Requirement already satisfied: pyserial==3.4 in ./klippy-env/lib/python3.12/site-packages (from -r /home/szafran/klipper/scripts/klippy-requirements.txt (line 6)) (3.4)
Requirement already satisfied: greenlet==3.0.3 in ./klippy-env/lib/python3.12/site-packages (from -r /home/szafran/klipper/scripts/klippy-requirements.txt (line 8)) (3.0.3)
Requirement already satisfied: Jinja2==2.11.3 in ./klippy-env/lib/python3.12/site-packages (from -r /home/szafran/klipper/scripts/klippy-requirements.txt (line 9)) (2.11.3)
Requirement already satisfied: python-can==3.3.4 in ./klippy-env/lib/python3.12/site-packages (from -r /home/szafran/klipper/scripts/klippy-requirements.txt (line 10)) (3.3.4)
Requirement already satisfied: markupsafe==1.1.1 in ./klippy-env/lib/python3.12/site-packages (from -r /home/szafran/klipper/scripts/klippy-requirements.txt (line 11)) (1.1.1)
Requirement already satisfied: pycparser in ./klippy-env/lib/python3.12/site-packages (from cffi==1.14.6->-r /home/szafran/klipper/scripts/klippy-requirements.txt (line 5)) (2.22)
Requirement already satisfied: wrapt~=1.10 in ./klippy-env/lib/python3.12/site-packages (from python-can==3.3.4->-r /home/szafran/klipper/scripts/klippy-requirements.txt (line 10)) (1.16.0)
Requirement already satisfied: aenum in ./klippy-env/lib/python3.12/site-packages (from python-can==3.3.4->-r /home/szafran/klipper/scripts/klippy-requirements.txt (line 10)) (3.1.15)
Collecting python-can==4.3
  Using cached python_can-4.3.0-py3-none-any.whl.metadata (8.7 kB)
Requirement already satisfied: wrapt~=1.10 in /home/szafran/klippy-env/lib/python3.12/site-packages (from python-can==4.3) (1.16.0)
Requirement already satisfied: packaging>=23.1 in /home/szafran/klippy-env/lib/python3.12/site-packages (from python-can==4.3) (24.1)
Requirement already satisfied: typing-extensions>=3.10.0.0 in /home/szafran/klippy-env/lib/python3.12/site-packages (from python-can==4.3) (4.12.2)
Requirement already satisfied: msgpack~=1.0.0 in /home/szafran/klippy-env/lib/python3.12/site-packages (from python-can==4.3) (1.0.8)
Using cached python_can-4.3.0-py3-none-any.whl (262 kB)
Installing collected packages: python-can
  Attempting uninstall: python-can
    Found existing installation: python-can 3.3.4
    Uninstalling python-can-3.3.4:
      Successfully uninstalled python-can-3.3.4
Successfully installed python-can-4.3.0
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Wymagane jest uwierzytelnienie, aby uruchomić jednostkę „klipper-Mikrus.service”.
Authenticating as: Szafran (szafran)
Password:
==== AUTHENTICATION COMPLETE ====

and now I’m getting this error:
image

Don’t really know what to do next, and would love some pointers on how to fix it.

And now after a reboot I’m stuck on:
image

klippy.log (75.9 KB)

This seems a bit convoluted. In the first place, you have an error in your Klipper config:

[delayed_gcode _set_led_lcd]
initial_duration = 1
gcode = 
	SET_LED LED=_led_lcd RED=0.25 GREEN=0 BLUE=0 INDEX=1 TRANSMIT=0
	SET_LED LED=_led_lcd RED=0.25 GREEN=0 BLUE=0 INDEX=2 TRANSMIT=0
	SET_LED LED=_led_lcd RED=1 GREEN=1 BLUE=0.2 INDEX=3
	M117      Mikrus
	SET_SERVO SERVO=probeServo WIDTH=0

The _led_lcd is not defined.

Thank you for that, but that changes nothing with the errors I’m getting.

Fix the Klipper error and provide a new klippy.log and potentially a moonraker.log

Here you go… Fresh - just after reboot…

klippy.log (19.3 KB)
moonraker.log (22.3 KB)

Try following approach:

sudo service klipper stop

# remove current klippy-env environment
cd ~
rm -rf klippy-env

# create new venv
virtualenv -p python3 klippy-env

#install new Klipper venv
cd ~/klippy-env
bin/pip install -r ../klipper/scripts/klippy-requirements.txt

I’ve allready tried recreating the venv… results are exactly the same.
I’ve also reinstalled Klipper/Moonraker which also removes and recreates venv.

This seems to be some compatibility issue with Python 3.12 and CAN.

Try modifying the requirements.txt file and replace

python-can==3.3.4

with

python-can~=4.3

then delete and recreate the venv. Likely not the best solution but it might work.

szafran@3DP:~$ sudo service klipper-Mikrus stop
szafran@3DP:~$ sudo service klipper-Kolos stop
szafran@3DP:~$ cd ~
rm -rf klippy-env
szafran@3DP:~$ virtualenv -p python3 klippy-env
created virtual environment CPython3.12.3.final.0-64 in 318ms
  creator CPython3Posix(dest=/home/szafran/klippy-env, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/home/szafran/.local/share/virtualenv)
    added seed packages: pip==24.0
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
szafran@3DP:~$
szafran@3DP:~/klippy-env$ bin/pip install -r ../klipper/scripts/klippy-requirements.txt
Ignoring greenlet: markers 'python_version < "3.12"' don't match your environment
Collecting cffi==1.14.6 (from -r ../klipper/scripts/klippy-requirements.txt (line 5))
  Using cached cffi-1.14.6-cp312-cp312-linux_x86_64.whl
Collecting pyserial==3.4 (from -r ../klipper/scripts/klippy-requirements.txt (line 6))
  Using cached pyserial-3.4-py2.py3-none-any.whl.metadata (1.6 kB)
Collecting greenlet==3.0.3 (from -r ../klipper/scripts/klippy-requirements.txt (line 8))
  Using cached greenlet-3.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.metadata (3.8 kB)
Collecting Jinja2==2.11.3 (from -r ../klipper/scripts/klippy-requirements.txt (line 9))
  Using cached Jinja2-2.11.3-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting python-can==4.3 (from -r ../klipper/scripts/klippy-requirements.txt (line 10))
  Using cached python_can-4.3.0-py3-none-any.whl.metadata (8.7 kB)
Collecting markupsafe==1.1.1 (from -r ../klipper/scripts/klippy-requirements.txt (line 11))
  Using cached MarkupSafe-1.1.1-cp312-cp312-linux_x86_64.whl
Collecting pycparser (from cffi==1.14.6->-r ../klipper/scripts/klippy-requirements.txt (line 5))
  Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Collecting wrapt~=1.10 (from python-can==4.3->-r ../klipper/scripts/klippy-requirements.txt (line 10))
  Using cached wrapt-1.16.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)
Collecting packaging>=23.1 (from python-can==4.3->-r ../klipper/scripts/klippy-requirements.txt (line 10))
  Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting typing-extensions>=3.10.0.0 (from python-can==4.3->-r ../klipper/scripts/klippy-requirements.txt (line 10))
  Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting msgpack~=1.0.0 (from python-can==4.3->-r ../klipper/scripts/klippy-requirements.txt (line 10))
  Using cached msgpack-1.0.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (9.1 kB)
Using cached pyserial-3.4-py2.py3-none-any.whl (193 kB)
Using cached greenlet-3.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (625 kB)
Using cached Jinja2-2.11.3-py2.py3-none-any.whl (125 kB)
Using cached python_can-4.3.0-py3-none-any.whl (262 kB)
Using cached msgpack-1.0.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (408 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Using cached wrapt-1.16.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (87 kB)
Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Installing collected packages: pyserial, wrapt, typing-extensions, pycparser, packaging, msgpack, markupsafe, greenlet, python-can, Jinja2, cffi
Successfully installed Jinja2-2.11.3 cffi-1.14.6 greenlet-3.0.3 markupsafe-1.1.1 msgpack-1.0.8 packaging-24.1 pycparser-2.22 pyserial-3.4 python-can-4.3.0 typing-extensions-4.12.2 wrapt-1.16.0
szafran@3DP:~/klippy-env$ sudo service klipper-Kolos start
szafran@3DP:~/klippy-env$ sudo service klipper-Mikrus start
szafran@3DP:~/klippy-env$ sudo reboot

result:
image
for infinity

klippy.log (60.3 KB)
moonraker.log (23.1 KB)

In addition try upgrading

setuptools==69.2.0

Your last log would indicate that Klipper started successfully?

We are victorius!
Thank you very much for your help.