Setting up OctoPrint on a Raspberry Pi running Raspberry Pi OS (Debian)

If anyone is looking for information about running OctoPrint with libcamera / Rasberry Pi Camera Module 3 as a webcam, I uploaded my setup instructions & scripts to GitHub

Just dropping a note of thanks for the devs and @foosel. I followed the guide and successfully set up OctoPrint on a 2012 Mac Mini running Ubuntu 22.04. Cheers!

The usb camera input file name does not always match /dev/video0 or /dev/video1. But it is possible to find out the device name using the v4l2-ctl utility, which can be installed with the apt install v4l2-ctl command. Once installed, you can query the list of video I/O devices using the v4l2-ctl --list-devices command. It will give you a list like this:

Video devices list (click me)
rockchip,rk3399-vpu-enc (platform: hantro-vpu):
        /dev/video3
        /dev/video4
        /dev/media1

rockchip-rga (platform:rga):
        /dev/video0

rkvdec (platform:rkvdec):
        /dev/video2
        /dev/media0

rockchip-iep (platform:rockchip-iep):
        /dev/video1

USB2.0 PC CAMERA: USB2.0 PC CAM (usb-xhci-hcd.0.auto-1):
        /dev/video6
        /dev/video7
        /dev/media2

In my case, in this list, I'm interested in a USB2.0 device that can be accessed through the file /dev/video6. I modified the webcamDaemon script a bit, adding to it requesting the webcam input file name:

# gets camera device name from v4l2-ctl output (search for USB devices in list and use first found)
camera_usb_device=$(v4l2-ctl --list-devices | grep "USB" -A 1 | tail -n 1 | sed -e 's/^[ \t]*//')
camera_usb_options="-r 640x480 -f 10 -d $camera_usb_device"

And also replace usb camera device existance check from: if [ -e "/dev/video0" ] to if [ -e "$camera_usb_device" ].
After reconnecting the USB camera, the file name changes and I just need to restart the webcamd service to restart streaming.

Hi. I have followed your guide and I'm not able to get the stream to function. I have moved the 2 files into their respective places after installing OctoPrint and did NOT use HAProxy. When I text my camera in a different OS it works fine and I can get a picture using libcamera-hello so I know it's not the camera. Any advice?
Using Pi4 4GB
Rasp Pi cam V3
Rasp Pi OS 32 bit lite (on PINN)
Thank you
Ruhel™

EDIT: I had to install picamera2 using

sudo apt install -y python3-picamera2

and it works perfectly.

Continuing the discussion from Setting up OctoPrint on a Raspberry Pi running Raspberry Pi OS (Debian):

There is no octopi.txt file if you install all of this manually, not sure what the equivalent would be. (running on a BTT cb1/pi4b if that's any help)

I have been through all the previous steps before this and everything works up until now.

Thank you for your very detailed and thorough explanation on how to install and run this app but I have no idea what you are saying. Can this app run on a chromebook and is it worth looking at if I have zero experience in programming and networking etc?

Ich kann leider kein gutes English und hoffe das man mir hier auch auf Deutsch helfen kann.

Meine Systemvoraussetzung ist ein Proxmox Server mit Debian 11 Bulseye, unter eine entsprechendem Debian VM.

Ich habe diese Anleitung schritt für schritt genaustens verfolg und eingegeben. Es hat auch soweit alles geklappt Octoprint läuft aber nur zum Teil als erstes der Drucker wird erkannt und kann ihn steuern die Webcam wir erkannt aber ich kann nur ein Snapshot machen und leider keinen Stream und ich kann Plugins weder über Respository noch über Download installieren. Es bricht mit folgendem Log ab.

*Installiere Plugin "Octolapse" von https://github.com/FormerLurker/Octolapse/archive/master.zip...
/home/pi/OctoPrint/venv/bin/python3 -m pip --disable-pip-version-check install file:///tmp/tmpjl37nyvw/Octolapse-master.zip --no-cache-dir
Processing /tmp/tmpjl37nyvw/Octolapse-master.zip
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
likely tags: v0.4.2
picking v0.4.2
got version from expanded keyword {'version': 'v0.4.2', 'full-revisionid': 'c6c86782cdbfc3590fa4b1bf2e63064eb459b16b', 'dirty': False, 'error': None, 'date': '2023-04-02T10:23:21-0500'}
Traceback (most recent call last):
File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
main()
File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(*hook_input['kwargs'])
File "/home/pi/OctoPrint/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-o49s97rt/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/tmp/pip-build-env-o49s97rt/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-o49s97rt/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 484, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-o49s97rt/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "", line 57, in
ModuleNotFoundError: No module named 'octoprint'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Fehler!
Could not parse output from pip, see plugin_pluginmanager_console.log for generated output

In deinem octoprint python venv "pip install wheel" ausführen und dann nochmal versuchen.

Hat nicht geklappt, immer noch der selbe Fehler. Kann keine Plugins installieren.

Wie schaut's aus mit einen systeminfo bundle?

Nur nochmal zu Sicherheit, du hast schon das "oprint" pip für "pip install whee"l verwendet und nicht das vom OS, oder? Hatte letztens ein ziemlich ähnliches Problem. Konnte octoklipper über das entpackte Package und setup.py installieren, aber nicht über den package manager und auch nicht mit pip. siehe Setuptools error while installing plugin (octoklipper) on manual OP installation

Everything was going well until HAProxy. I'm totally lost now.
Perhaps I am trying to do something that is not possible.
I purchased a BTT Pad7 that includes a CB1 (Pi substitute). and a 7" touch screen. It's shipped with Klipper installed. I am underwhelmed by Klipper and figured I would try to use the hardware to run Octoprint so I could use it with my Marlin printer. It would be convenient to since the touchscreen and fake Pi are in a nice compact package.
Hopefully someone a lot smarter than me will figure it out and make a video.

This makes it as simple as possible: OctoPrint.org - Download & Setup OctoPrint

I have worked through this setup on a BTT Pi v1.2 without much trouble, but a couple of the command line bits puzzle me. I was thinking about doing some edits to help sort out the puzzles, but I thought I'd check to see if I've made the correct assumptions:

Under Optional: Webcam I found this:

I guessed that what was intended was this:

export LD_LIBRARY_PATH=`pwd`

If I'm in the ballpark, let me know, and I'll proceed with the edits. There are also a couple of other path items, and a clarification, but this is the tricky one.

By the way, it's working fantastically well. Great little board for Octoprint.

hi how do i uninstall octoprint . i want to reinstall using octoprint_deploy
thanks
martin

@paukstelis

1 Like

This works great on the OrangePi as well all you have to do is change pi to orangepi and that worked for me!

1 Like

Hello all - I'm fairly new to Raspberry Pi's, Linux, and Python, and was trying to set up OctoPrint when I ran into some issues. Everything was going smoothly up until pip install octoprint.

The download/installation was going swimmingly until it hit Babel (v. 2.12.1):

Collecting Babel<2.13,>=2.12.1 (from octoprint)
  Downloading https://www.piwheels.org/simple/babel/Babel-2.12.1-py3-none-any.whl (10.1 MB)
     ━━━━━━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/10.1 MB 254.5 kB/s eta 0:00:27
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    Babel<2.13,>=2.12.1 from https://www.piwheels.org/simple/babel/Babel-2.12.1-py3-none-any.whl#sha256=7d4b39b8f00d62b71bf643d554db2e99e2845fbdb69da9577dd7cb512e1da053 (from octoprint):
        Expected sha256 7d4b39b8f00d62b71bf643d554db2e99e2845fbdb69da9577dd7cb512e1da053
             Got        99a0e146b77343d833ef44a6b518b4e82be91b9c66ec244c9efd879085f21d56

It seems that the hashes don't match. Is this due to some sort of mismatched version? I can't figure it out. Hoping for a pro to help me out, and in the mean time I'm going to try and persuade ChatGPT to work it out :rofl:

That means something is wrong with the downloaded file.
Could be a transmission error or a failing SD card.
Delete it and try again

pinkrose@raspberrypi:~ $ /etc/systemd/system/octoprint.service
bash: /etc/systemd/system/octoprint.service: Permission denied

I've tried many different variations trying to give myself permission.
I can't get it. I'm the only user. Why can't I get to admin status?

The comment you've quoted is literally just typing in the file path, this will not do anything as it is not an executable command. To edit a file, you'd have to open a file editor such as nano with sudo nano /etc/.... You can't just type the file path in the console and expect it to know what to do with it.