Octoprint on a Openwrt

Sounds like you might want to activate the virtual environment and then install this.

What I see:

# pip list            # The pound sign prompt should only be seen when you're root

What I should be seeing:

(oprint) $ pip freeze

In other words, you should be logged in as a non-root user having activated a virtual environment with Python 2.7 in it.

It's possible that it would run like you're trying to do it but it might end up running as the root user and that would give too much rights to OctoPrint itself and the plugins you run. It's probably a bad idea.

I have partly dealt with this question
I wanted to use openwrt as a simpler and faster alternative to raspbian. But everything is very difficult for me. Many python packages require to build shared libraries. I'm not always correct make on the host system.
here is the list
Package psutil builds the _psutil_linux.so and _psutil_posix.so
regex - _regex.so (this build is uncorrect)

2019-11-28 22:44:28,697 - octoprint.cli.server - ERROR - Uncaught exception
Traceback (most recent call last):
  File "/usr/bin/octoprint", line 11, in <module>
    load_entry_point('OctoPrint==1.3.12', 'console_scripts', 'octoprint')()
  File "/usr/lib/python2.7/site-packages/octoprint/__init__.py", line 609, in main
    octo(args=args, prog_name="octoprint", auto_envvar_prefix="OCTOPRINT")
  File "/usr/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/octoprint/cli/server.py", line 206, in serve_command
    ignore_blacklist)
  File "/usr/lib/python2.7/site-packages/octoprint/cli/server.py", line 105, in run_server
    from octoprint.server import Server
  File "/usr/lib/python2.7/site-packages/octoprint/server/__init__.py", line 66, in <module>
    from octoprint.printer.profile import PrinterProfileManager
  File "/usr/lib/python2.7/site-packages/octoprint/printer/__init__.py", line 28, in <module>
    from octoprint.filemanager import FileDestinations
  File "/usr/lib/python2.7/site-packages/octoprint/filemanager/__init__.py", line 18, in <module>
    from .storage import LocalFileStorage
  File "/usr/lib/python2.7/site-packages/octoprint/filemanager/storage.py", line 27, in <module>
    from slugify import Slugify
  File "/usr/lib/python2.7/site-packages/slugify/__init__.py", line 2, in <module>
    from slugify.main import Slugify, UniqueSlugify
  File "/usr/lib/python2.7/site-packages/slugify/main.py", line 6, in <module>
    import regex as re
  File "/usr/lib/python2.7/site-packages/regex/__init__.py", line 1, in <module>
    from .regex import *
  File "/usr/lib/python2.7/site-packages/regex/regex.py", line 391, in <module>
    import _regex_core
  File "/usr/lib/python2.7/site-packages/regex/_regex_core.py", line 21, in <module>
    import _regex
ImportError: Error relocating /usr/lib/python2.7/site-packages/regex/_regex.so: PyUnicodeUCS4_Join: symbol not found

and watchdog pakage is building his library, I haven't built it yet

Anything with a .so ending is something that is built. It's a binary object file. Like I said, I'm familiar with an install to the virtual environment rather than things installed at the global level.

mmfroebus_01636196

You can run openwrt on a Ryzen ...
It's just a distro. -> Software ...

Well yes. But why should you?
If you're building your own router you would use something like pfsense, opnsense or ipfire.
Also it's very unusal to keep your servers next to your 3D printer (at least in my mind) - so I figured he's using a something like a tp link router.
Then he said he's using it as an faster alternative to raspbian - which is an OS for a single board computer (like a tp link router). That confirmed my thought for me.
Of course you also could use raspbian on a pc - but again - why should you?

I want to use my old raspberrypi. Raspbian works very slowly in it. I thought if there was a python, that's not a problem. I was wrong, it has difficulties ...

That's ok :slight_smile:
I'm the last person who would stop anyone from tinkering :smiley:

I was just explaining my train of thoughts to @danielkrah :slight_smile:

Maybe you should search for other lightweight distros


Here a bit older list of raspberry compatible distros

@PrintedWeezl
some vpn clients need a huge singlecore performance.
but yeah on a raspberry it don't makes sense performance wise.

And on a bigger machine running it in a VM is maybe the better choice ...

I've worked with Yocto. It can be about as lean as you want to make it.

psutil and regex built, continue to run octoprint. Now he stopped to build netifaces....

# octoprint serve
2019-11-29 21:37:09,971 - octoprint.startup - INFO - ******************************************************************************
2019-11-29 21:37:09,985 - octoprint.startup - INFO - Starting OctoPrint 1.3.12
2019-11-29 21:37:09,989 - octoprint.startup - INFO - ******************************************************************************
2019-11-29 21:37:10,382 - octoprint.plugin.core - INFO - Loading plugins from /usr/lib/python2.7/site-packages/octoprint/plugins, /root/.octoprint/plugins and installed plugin packages...
2019-11-29 21:37:11,471 - octoprint.plugin.core - INFO - Found 1 plugin(s) providing 0 mixin implementations, 0 hook handlers
2019-11-29 21:37:28,049 - octoprint.cli.server - ERROR - Uncaught exception
Traceback (most recent call last):
  File "/usr/bin/octoprint", line 11, in <module>
    load_entry_point('OctoPrint==1.3.12', 'console_scripts', 'octoprint')()
  File "/usr/lib/python2.7/site-packages/octoprint/__init__.py", line 609, in main
    octo(args=args, prog_name="octoprint", auto_envvar_prefix="OCTOPRINT")
  File "/usr/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/octoprint/cli/server.py", line 206, in serve_command
    ignore_blacklist)
  File "/usr/lib/python2.7/site-packages/octoprint/cli/server.py", line 105, in run_server
    from octoprint.server import Server
  File "/usr/lib/python2.7/site-packages/octoprint/server/__init__.py", line 75, in <module>
    import octoprint.util.net
  File "/usr/lib/python2.7/site-packages/octoprint/util/net.py", line 10, in <module>
    import netifaces
ImportError: No module named netifaces

Activate the virtual environment then...

pip install netifaces

As I wrote above, everything is difficult. For the netifaces module, it is necessary to build netifaces.so ....

pip (and other programs like npm, yarn and brew) are package managers. It's their job to compile/build what you just asked for. In some cases they might find something ready to go and apply that for you. Otherwise they'll often make that happen.

What I guess that I'm saying is that you've chosen a platform other than the one described here for the OctoPi image. So then you get the responsibility of making that work. The usual expected behavior is for you to read the error, search the Internet for that error, see what's missing and to fill in the gaps. If you need to install netifaces in this case, install netifaces and then continue the process.

Ok, I know what to do ... I didn't just think that a python was so tightly bound to a code on a ั
Maybe without gัั nothing can be installed...

Yeah, you might need all kind of things, like setuptools, etc.

gcc comes with the standard Raspbian install. These "minimized" Linux installs are made small because they're missing many things. They assume that you're good at then building them up to the level you need.

I successfully installed Octoprint 1.5.0 on a Netgear WNDR3800. It's a wonderful thing - one flash device servicing all my network needs and driving my 3D prints at the same time, with the UI available from anywhere on my LAN. Is it a race car? No. The Octoprint UI is sluggish, but works fine. The 3D printer runs at rated speed (Ender 3D), with the router running at 50-70%. I do not try to use Octoprint's camera support.

I followed these instructions:

xxx://github.com/OctoPrint/OctoPrint/wiki/Setup-OctoPrint-on-OpenWrt

That was in May of 2020. Now in September of 2020, I want to do it again using a more powerful Netgear router (R7800). Unfortunately, the github wiki has been killed off, and I can't find the original wiki page any more. Hopefully my notes will be enough to carry me through.

It can be done, and it's worth doing!

A lot of that stuff was migrated from the wiki to the knowledgebase, but appears that one may have been left out. Not sure if that was intentional or not since it's a low powered device that could cause trouble.

Frankly it looked like it was outdated since it hadn't been touched since 2017, so I left it out. It's now here:

Thank you for finding the original guide. Turns out I didn't need it, as it's a pretty straight forward installation.

I've been running Octoprint 1.4.2 using python3 on OpenWRT 19.07.4 on a Netgear R7800 for over a year. It runs quite well - snappy interface and good overall performance. The camera interface works as well. As a flash-based system with limited file system space, I have avoided applying any updates, and 1.4.2 has been working fine.

That said, I'm now going to repeat the process using OpenWrt 19.07.9 and Octoprint 1.7.3 to bring both system up to date.

1 Like