Package Details: octoprint-venv 1.5.3-1

Git Clone URL: https://aur.archlinux.org/octoprint-venv.git (read-only, click to copy)
Package Base: octoprint-venv
Description: Web interface for 3D printers (venv installation type)
Upstream URL: http://octoprint.org/
Licenses: AGPL3
Conflicts: octoprint
Provides: octoprint
Submitter: Jake
Maintainer: Jake
Last Packager: Jake
Votes: 22
Popularity: 0.75
First Submitted: 2017-01-15 12:46
Last Updated: 2021-01-20 10:35

Latest Comments

1 2 3 4 5 6 ... Next › Last »

wlhlm commented on 2020-12-15 19:44

OK, so I haven't really been satisfied with the current solution and have done some further investigating:

This problem seems to be with the setup.py script provided by OctoPrint. Everywhere I've looked for build instructions for OctoPrint they use pip to install it whereas octoprint-venv calls setup.py directly. Indeed, installing OctoPrint into the venv using pip correctly builds the netifaces module. No special casing required.

Not sure why pip works and plain setup.py doesn't as the former has to use the latter for build instructions. However, I do occasionally hear that python packaging is a sad story overall, so this doesn't surprise me.

The below patch should be a cleaner solution (taken from the octoprint package):

diff --git a/PKGBUILD b/PKGBUILD
index 129842a..abc51d7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -9,7 +9,8 @@ url="http://octoprint.org/"
 license=('AGPL3')
 depends=('python')
 optdepends=('ffmpeg: timelapse support'
-            'mjpg-streamer: stream images from webcam')
+            'mjpg-streamer: stream images from webcam'
+            'ustreamer: stream images from webcam')
 provides=('octoprint')
 conflicts=('octoprint')
 install=octoprint.install
@@ -27,10 +28,7 @@ package() {

     python3 -m venv "${pkgdir}/opt/$pkgname"

-    "${pkgdir}/opt/$pkgname/bin/pip3" install wheel
-    "${pkgdir}/opt/$pkgname/bin/pip3" install netifaces
-
-    "${pkgdir}/opt/$pkgname/bin/python3" setup.py install --optimize=1
+    "${pkgdir}/opt/$pkgname/bin/pip3" install . --install-option='--optimize=1'
     sed -i "s|${pkgdir}/opt/$pkgname|/opt/$pkgname|g" "${pkgdir}/opt/$pkgname/bin/"* # relocate without breaking plugin system

     install -Dm644 "${srcdir}/octoprint.service" "${pkgdir}/usr/lib/systemd/system/octoprint.service"

EDIT: Please note that this will generate a slightly different directory structure and will require manually intervention when upgrading.

Astroturf commented on 2020-12-15 18:52

@Jake Perfect! Working Netifaces module also with latest PKGBUILD changes. I'm running x86_64 indeed.

Jake commented on 2020-12-15 14:04

@wlhlm: True! It is changed now.

What confused me is that without wheel it still compiles the shared object and puts it in an egg. Then it even prints "Installed ...netifaces-0.10.9-py3.9-linux-x86_64.egg", but it is not unpacked and actually installed...

wlhlm commented on 2020-12-15 12:35

@Jake I think the arch check for x86_64 and i686 has to be dropped. @Astroturf's logs indicate that they are running on x86_64 and have the same problem with the netifaces module being empty. If you look at PyPI, you can see while netifaces provides x86 wheels, they are only available for older python versions (see below). So installing wheel regardless of architecture makes sense to me as this problem may crop up on the next python upgrade again or for other OctoPrint dependencies.

$ curl -Ls "https://pypi.python.org/pypi/netifaces/json" | jq '.releases."0.10.9"[].filename'
"netifaces-0.10.9-cp27-cp27m-macosx_10_13_x86_64.whl"
"netifaces-0.10.9-cp27-cp27m-manylinux1_i686.whl"
"netifaces-0.10.9-cp27-cp27m-manylinux1_x86_64.whl"
"netifaces-0.10.9-cp27-cp27mu-manylinux1_i686.whl"
"netifaces-0.10.9-cp27-cp27mu-manylinux1_x86_64.whl"
"netifaces-0.10.9-cp27-cp27m-win32.whl"
"netifaces-0.10.9-cp33-cp33m-manylinux1_i686.whl"
"netifaces-0.10.9-cp34-cp34m-manylinux1_i686.whl"
"netifaces-0.10.9-cp34-cp34m-manylinux1_x86_64.whl"
"netifaces-0.10.9-cp34-cp34m-win32.whl"
"netifaces-0.10.9-cp35-cp35m-manylinux1_i686.whl"
"netifaces-0.10.9-cp35-cp35m-manylinux1_x86_64.whl"
"netifaces-0.10.9-cp35-cp35m-win32.whl"
"netifaces-0.10.9-cp36-cp36m-macosx_10_13_x86_64.whl"
"netifaces-0.10.9-cp36-cp36m-manylinux1_i686.whl"
"netifaces-0.10.9-cp36-cp36m-manylinux1_x86_64.whl"
"netifaces-0.10.9-cp36-cp36m-win32.whl"
"netifaces-0.10.9-cp36-cp36m-win_amd64.whl"
"netifaces-0.10.9-cp37-cp37m-macosx_10_14_x86_64.whl"
"netifaces-0.10.9-cp37-cp37m-win32.whl"
"netifaces-0.10.9-cp37-cp37m-win_amd64.whl"
"netifaces-0.10.9.tar.gz"

wlhlm commented on 2020-12-15 12:02

@Jake Thanks! You forgot to bump pkgrel.

Jake commented on 2020-12-15 11:43

@wlhlm: You are correct, there are multiple is architecture-specific dependencies once built. I have changed the arch field to the specific values now. Also I have added the wheel and manual netifaces installation. Let me know if that works for you, because I don't have the hardware to test.

@Astroturf: Does this work for you as well, installing netifaces before the octoprint setup, or does it really require removing the dependency in setup.py? In theory it should just skip modules that are already there.

Astroturf commented on 2020-12-14 22:04

base-devel is installed indeed. The following patch builds a working Netifaces module for me. :)


diff --git a/PKGBUILD b/PKGBUILD
index 15b05b6..c1cda62 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -26,7 +26,13 @@ package() {
     cd "${srcdir}/OctoPrint-${pkgver}"

     python3 -m venv "${pkgdir}/opt/$pkgname"
+    "${pkgdir}/opt/$pkgname/bin/pip3" install wheel
+    # Remove Netifaces
+    sed -e '/netifaces/s/^/#/g' -i setup.py
     "${pkgdir}/opt/$pkgname/bin/python3" setup.py install --optimize=1
+    # Install Netifaces manually
+    "${pkgdir}/opt/$pkgname/bin/pip3" install netifaces
+
     sed -i "s|${pkgdir}/opt/$pkgname|/opt/$pkgname|g" "${pkgdir}/opt/$pkgname/bin/"* # relocate without breaking plugin system

     install -Dm644 "${srcdir}/octoprint.service" "${pkgdir}/usr/lib/systemd/system/octoprint.service"
$ /opt/octoprint-venv/bin/python
Python 3.9.0 (default, Oct  7 2020, 23:09:01) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import netifaces
>>> print(netifaces.__file__)
/opt/octoprint-venv/lib/python3.9/site-packages/netifaces.cpython-39-x86_64-linux-gnu.so
>>> netifaces.interfaces()
['lo', 'eno1', 'eno2', 'enp2s0', 'enp2s0d1', 'docker0']
>>> 

wlhlm commented on 2020-12-14 21:09

@Astroturf Just to make sure: Did you install the base-devel group?

wlhlm commented on 2020-12-14 21:04

@Astroturf Bummer. For me, manually running /opt/octoprint-venv/bin/pip install wheel and /opt/octoprint-venv/bin/pip install netifaces --force after that fixed the problem. So I assumed the patch you provided fixes the package...

Btw, the python-netifaces [...] does install correctly. [...]

Surprising that this works since the octoprint virtualenv is setup using python -m venv which should ignore the system installed python packages. I thought you'd need python -m venv --system-site-packages in order to access them inside the virtualenv...

Astroturf commented on 2020-12-14 20:47

@wlhlm This still does not generate a working netifaces module for me.

diff --git a/PKGBUILD b/PKGBUILD
index 15b05b6..4ea697d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -26,6 +26,7 @@ package() {
     cd "${srcdir}/OctoPrint-${pkgver}"

     python3 -m venv "${pkgdir}/opt/$pkgname"
+    "${pkgdir}/opt/$pkgname/bin/pip3" install wheel
     "${pkgdir}/opt/$pkgname/bin/python3" setup.py install --optimize=1
     sed -i "s|${pkgdir}/opt/$pkgname|/opt/$pkgname|g" "${pkgdir}/opt/$pkgname/bin/"* # relocate without breaking plugin system

Btw, the python-netifaces https://www.archlinux.org/packages/community/x86_64/python-netifaces/) does install correctly. Only change I noticed is that it installs netifaces.cpython-39-x86_64-linux-gnu.so in /site-packages instead of an .egg.