Octoprint fails to install plugins on fresh Pi4 installation

Creating a bug report/issue

Required Information

  • DietPi version | 9.18.1
  • Distro version | trixie 0
  • Kernel version | Linux OctoPi 6.12.47+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux
  • Architecture | arm64
  • SBC model | RPi 4 Model B (aarch64)
  • Power supply used | Pi4 official PSU 5V 3A
  • SD card used | SanDisk ultra 16GB

Additional Information (if applicable)

  • Software title | Octoprint
  • Was the software title installed freshly or updated/migrated? Freshly installed
  • Can this issue be replicated on a fresh installation of DietPi? I think so
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

  1. Freshly install DietPi
  2. Install Octoprint
  3. Try to install a plugin from the repository

Expected behaviour

  • Plugin installs

Actual behaviour

  • Plugin installation fails with this error:
Installing plugin "Bed Level Visualizer" from https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip...
/usr/bin/python3 -m pip --disable-pip-version-check install file:///tmp/tmpxcxa_gm5/OctoPrint-BedLevelVisualizer-master.zip --no-cache-dir --user
Processing /tmp/tmpxcxa_gm5/OctoPrint-BedLevelVisualizer-master.zip
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 255
╰─> [1 lines of output]
Could not import OctoPrint's setuptools, are you sure you are running that under the same python installation that OctoPrint is installed under?
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build 'file:///tmp/tmpxcxa_gm5/OctoPrint-BedLevelVisualizer-master.zip' when getting requirements to build wheel
Getting requirements to build wheel: finished with status 'error'
Error!
Could not parse output from pip, see plugin_pluginmanager_console.log for generated output

Extra details

  • This happens regardless of the plugin I choose. I tried sudo pip install wheel and sudo pip3 install wheel but it is already there.
  • Octoprint says: [Using pip of “/usr/bin/python3”, Version 25.3](javascript:void(0)) Installation directory: /usr/lib/python3/dist-packages (“–user” flag: yes)
  • Also happens with Bookworm

did you get it to work? Same issue here but using a laptop for dietpi

Can you try from CLI

sudo runuser -u octoprint -- /usr/bin/python3 -m pip install --user --no-warn-script-location https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip

@MichaIng we could modify the service file, so it uses the correct environment when isntalling plugins via octoprint webpanel. Modify this lines?

Environment="LC_ALL=C.UTF-8" "LANG=C.UTF-8" "PATH=/mnt/dietpi_userdata/octoprint/.local/bin:/usr/bin:/bin"
WorkingDirectory=/mnt/dietpi_userdata/octoprint

or we switch it to a virtual environment?

Thank you Jappe, running the command you mentioned gives the same error:

root@OctoPi:~# sudo runuser -u octoprint – /usr/bin/python3 -m pip install --user --no-warn-script-location https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip
Collecting https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip
Downloading https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip (5.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.1/5.1 MB 10.0 MB/s  0:00:00
Installing build dependencies … done
Getting requirements to build wheel … error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 255
╰─> [1 lines of output]
Could not import OctoPrint’s setuptools, are you sure you are running that under the same python installation that OctoPrint is installed under?
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build ‘https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip’ when getting requirements to build wheel

Which i think makes sense as Octoprint states:

Using pip of “/usr/bin/python3”, Version 25.3](javascript:void(0))Installation directory: /usr/lib/python3/dist-packages (“–user” flag: yes) 

Additional info if it helps:

Summary
root@OctoPi:~# python -m site
-bash: python: command not found

root@OctoPi:~# python3 -m site
sys.path = [
‘/root’,
‘/usr/lib/python311.zip’,
‘/usr/lib/python3.11’,
‘/usr/lib/python3.11/lib-dynload’,
‘/usr/local/lib/python3.11/dist-packages’,
‘/usr/lib/python3/dist-packages’,
]
USER_BASE: ‘/root/.local’ (doesn’t exist)
USER_SITE: ‘/root/.local/lib/python3.11/site-packages’ (doesn’t exist)
ENABLE_USER_SITE: True

root@OctoPi:~# sudo -u octoprint  python3 -m site
sys.path = [
‘/root’,
‘/usr/lib/python311.zip’,
‘/usr/lib/python3.11’,
‘/usr/lib/python3.11/lib-dynload’,
‘/mnt/dietpi_userdata/octoprint/.local/lib/python3.11/site-packages’,
‘/usr/local/lib/python3.11/dist-packages’,
‘/usr/lib/python3/dist-packages’,
]
USER_BASE: ‘/mnt/dietpi_userdata/octoprint/.local’ (exists)
USER_SITE: ‘/mnt/dietpi_userdata/octoprint/.local/lib/python3.11/site-packages’ (exists)
ENABLE_USER_SITE: True

In the global site-packages location /usr/local/lib/python3.11/dist-packages

I see “setuptools” and in the octoprint user’s:

/mnt/dietpi_userdata/octoprint/.local/lib/python3.11/site-packages/

I see “octoprint-setuptools”

PS. thank you very much for helping and for all the incredible work!

The problem still is, that OctoPrint’s setuptools are not in the global sys path but in /mnt/dietpi_userdata/octoprint/.local/lib/.

Can you try this:

sudo runuser -u octoprint -- env PYTHONPATH=/mnt/dietpi_userdata/octoprint/.local/lib/python3.11/site-packages /usr/bin/python3 -m pip install --user --no-warn-script-location https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip

I see, I tried but it is still failing, same error.

Ok, I installed octoprint now to test it properly :sweat_smile:
The setuptools are here:

root@TestPi3B:~# ls -la /mnt/dietpi_userdata/octoprint/.local/lib/python3.13/site-packages/ |grep setup
drwxr-xr-x   3 octoprint octoprint   4096 Nov  2 21:06 octoprint_setuptools

So this command is working:

sudo -u octoprint env \
  PYTHONPATH=/mnt/dietpi_userdata/octoprint/.local/lib/python3.13/site-packages \
  /usr/bin/python3 -m pip install --user --no-warn-script-location --no-build-isolation \
  https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/archive/master.zip

But to make it happen with the webinterface we need to change some stuff in the service file, I think.
I will test this and report back. But for now you can use the command to install the plugin.

screenshot

1 Like

I found a solution without fiddling with the service file (but maybe it would be a good idea to install it in it’s own virtual environment in the future)

You need to set the --no-build-isolation flag in the plugin manager settings.

With this settings you can install it via the web panel.
Unfortunately, if you wanna delete it via web panel, it also uses --no-build-isolation for the removal, but this will not work. So before deinstallation you need to clear the Additional arguments field. All of this hassle can be avoided when using a virtual enviroment, I will have a look into that, but not today :slight_smile:

1 Like

Thank you very very much! This works :slight_smile:

Interesting that the --user flag alone is not enough, since this should point to the correct Python site already. It seems that OctoPrint itself does not enforce build isolation, but some plugins do? Or is there another flag used by OctoPrint when installing plugins? Though you tested the same from console, so obviously not. Other explanation, is that build isolation allows to install only into “empty” sites, i.e. if there was no other package installed already, or otherwise merges with existing sites only within a venv?

However, regardless, maybe we should take this as encouragement to start migrating Python software into venv’s now. Needed anyway to prevent collisions between APT packages an pip.

EDIT: Read a bit, and funnily, --no-build-isolation should only break cases which otherwise work, not “fix” then, as far as I understand: It forces pip to install dependencies needed only temporarily for the wheel build, not for runtime, into the permanent Python site. Otherwise they are installed to and made available from a temporary isolated site, to reduce interference and possible dependency conflicts with runtime dependencies. However, setuptools might be a special case: it is a build dependency, bit still needs to be available in the runtime site. Probably the version installed in the OctoPrint site is incompatible with the one needed for the plugin, so it requires the correct version to be installed ar the bare OctoPrint site instead of within the isolated one, which it only does with the flag. But not sure how a venv would fix it in that case.

Checking the plugin: It uses old standards indeed, and the error is not coming from setuptools but some dedicated octoprint_setuptools indeed:

There were some issues around this in the past:

So right now, OctoPrint itself provides it internally:

For now to me it looks like an issue with the particular plugin, trying to load octoprint_setuptools without declaring it as build dependency. Makes sense that it is not available in the isolated build environment then. Let’s see how other OctoPrint plugins handle this.

Does installing the MfaTotp plugin work without --no-build-isolation?

1 Like

Seems like the bug with the BedLevelVizualizer plugin is fixed with the new Release, just 3 horus ago.
Ah yes, it is:
https://github.com/OctoPrint/OctoPrint/issues/5204
https://octoprint.org/blog/2025/11/04/new-release-1.11.4/?utm_source=octoprint&utm_medium=announcements&utm_content=1.11.4

So TOTP plugin also works, of.

Yes, I recognized the very same just now, not being able to replicate the issue, foosel said v1.12 will fix it, and then I saw that 1.11.4 did already.

So using an isolated environment by default for build dependencies, which does not make use of the runtime site at all, but installs every (build) dependency freshly, is new in recent pip, though I could not find a related changelog entry (“constraints” are not used here): Changelog - pip documentation v25.3

Hence to everyone else: Remove --no-build-isolation from your settings and, just update to latest OctoPrint … wtf our docs are missing how to do that :thinking::

sudo -u octoprint pip3 install -U --user octoprint

EDIT: Ah, it can be updated via web UI as well, right? My test VM has been reset already :sweat_smile:.
Anyway, does not hurt to know how to update from console: Update OctoPrint docs · MichaIng/DietPi-Docs@1f3fd56 · GitHub

Yes, I just updated it via the web panel.

1 Like