Installing OctoPrint into the Raspberry Pi OS / Basic Operation..

In this guide we go over the initial setup and installation of Octoprint on a standard raspberry pi.

Installing OctoPrint into the Raspberry Pi OS / Basic Operation..

Octoprint is a very powerful remote web interface that can manage your 3D print jobs without needing to have a dedicated main computer.

  • It runs well on SBC (Single Board Computers) such as the Raspberry Pi.
  • Please note it has been found that running both the camera feature of Octoprint and Octoprint itself was overloading to a single raspberry pi - it was recommended one for each.

Lots of guides go over the pre-fabricated installation of the OctoPrint OS as an image.  We will go over it from the perspective of doing it from the Raspberry Pi OS itself. If you need a guide on a basic raspbery pi image install we have a really good basic one here. We hope that you have a good basic understanding of ssh (secure-shell)

We are shamelessly and fully recognizing this thread from foosel,

ssh into your raspbery pi, and update it:

ssh c@192.168.1.250
sudo apt update -y && sudo apt upgrade -y

Now we want to get python installed. Python has very many packages but we want at least 3.9. Most raspberry pi instances already have 3.11 so you should be gtg.

python --version
sudo apt install python3 python3-pip python3-dev python3-setuptools python3-venv git libyaml-dev build-essential libffi-dev libssl-dev
mkdir OctoPrint && cd OctoPrint
python3 -m venv venv
source venv/bin/activate
  • This is installing all the python3 / python3-modules
  • We setup a virtual environment with "python3 -m venv venv"
  • We activate the virtual environment with "source venv/bin/activate"
pip install --upgrade pip wheel

And then:

pip install octoprint
  • Python is using it's package manager to install package octoprint. Python has become so large that it really has it's own ecosystem. This command will take a considerable time to run as there are a number of packages it downloads and installs - stuff like numpy that are scientific packages!

Temporarily Serving a Octoprint Instance:

~/OctoPrint/venv/bin/octoprint serve
  • The fun part is because octoprint serves on port 5000 - it actually doesn't even need root because that port is above 1024!

Setting up an Octoprint Service to make it start on startup:

sudo systemctl edit --force --full octoprint.service

And put in it:

[Unit]
Description=The snappy web interface for your 3D printer
After=network-online.target
Wants=network-online.target

[Service]
Environment="LC_ALL=C.UTF-8"
Environment="LANG=C.UTF-8"
Type=exec
User=pi
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint serve
# Note  the user ^^ pi - if you did this under another user change it.
[Install]
WantedBy=multi-user.target

Then enable the systemctl service with:

sudo systemctl enable octoprint.service

Then start it with:

sudo systemctl start octoprint.service

It should reside at port 5000, and initial setup will allow you to configure your accesses.

BlackList Processing:

  • Octoprint has a plethora of plugins - some very powerful, some allowing you to access and view your print from the internet. This raised some security concerns of unverified plugins which may present a security concern.  
  • To remediate this - they made a Plugin Blacklist - that you can enabled.

WebCam - this requires its own guide which we will link to (here)

  • It has been experienced that having a raspberry pi 4 dedicated to octoprint, or dedicated to webcam, but it just cannot do both. For perspective a 4-core / 8 thread laptop I owned benchmarked about 2600 on cpu passmark, a raspberry pi 4 only benches about 100 in comparison if you do the math.

You can now hook up your printer or set it's configuration:

You can setup your management to restart octoprint, or the raspberry pi if required.

Once you get past this you will be presented with the main menu.

For a standard usb printer - you can usually find it with /dev/ttyUSB0

If you have outdated firmware you will get this warning - for the standard Creality Pro.

Linux Rocks Every Day