Open akamensky opened 4 years ago
In UI logs:
Installing plugin from https://github.com/charleswillis3/OctoPrint-MarlinBft/archive/master.zip...
/opt/octoprint/bin/python -m pip --disable-pip-version-check install file:///tmp/tmpccx1lwex/OctoPrint-MarlinBft-master.zip --no-cache-dir
Processing /tmp/tmpccx1lwex/OctoPrint-MarlinBft-master.zip
Requirement already satisfied: OctoPrint in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint-MarlinBft==0.1.4) (1.4.2)
Collecting marlin-binary-protocol>=0.0.7
Downloading marlin_binary_protocol-0.0.7-py3-none-any.whl (7.2 kB)
Collecting backports.time-perf-counter>=0.0.4
Downloading backports.time_perf_counter-0.0.4-py2.py3-none-any.whl (4.7 kB)
Requirement already satisfied: flask<2,>=1.1.2 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.1.2)
Requirement already satisfied: blinker<2,>=1.4 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.4)
Requirement already satisfied: Jinja2<3,>=2.11.2 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (2.11.2)
Requirement already satisfied: rsa==4.0 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (4.0)
Requirement already satisfied: wrapt<2,>=1.12.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.12.1)
Requirement already satisfied: semantic-version<3,>=2.8.5 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (2.8.5)
Requirement already satisfied: sentry-sdk<1,>=0.15.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.16.5)
Requirement already satisfied: markdown<3.2,>=3.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (3.1.1)
Requirement already satisfied: Flask-Babel<2,>=1.0 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.0.0)
Requirement already satisfied: regex!=2018.11.6 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (2020.7.14)
Requirement already satisfied: requests<3,>=2.23.0 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (2.24.0)
Requirement already satisfied: emoji<1,>=0.5.4 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.6.0)
Requirement already satisfied: websocket-client<1,>=0.57 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.57.0)
Requirement already satisfied: future<1,>=0.18.2 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.18.2)
Requirement already satisfied: OctoPrint-FirmwareCheck>=2020.06.22 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (2020.6.22)
Requirement already satisfied: cachelib<1,>=0.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.1.1)
Requirement already satisfied: markupsafe<2.0,>=1.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.1.1)
Requirement already satisfied: feedparser<6,>=5.2.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (5.2.1)
Requirement already satisfied: pyserial<4,>=3.4 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (3.4)
Requirement already satisfied: netaddr<1,>=0.7.19 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.8.0)
Requirement already satisfied: unidecode<0.05,>=0.04.14 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.4.21)
Requirement already satisfied: tornado==5.1.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (5.1.1)
Requirement already satisfied: pkginfo<2,>=1.5.0.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.5.0.1)
Requirement already satisfied: pylru<2,>=1.2 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.2.0)
Requirement already satisfied: werkzeug<2,>=1.0.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.0.1)
Requirement already satisfied: netifaces<1,>=0.10.9 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.10.9)
Requirement already satisfied: psutil<6,>=5.7 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (5.7.2)
Requirement already satisfied: PyYAML<6,>=5.3.1 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (5.3.1)
Requirement already satisfied: filetype<2,>=1.0.7 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.0.7)
Requirement already satisfied: sarge==0.1.5post0 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.1.5.post0)
Requirement already satisfied: Flask-Login<0.6,>=0.5 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.5.0)
Requirement already satisfied: frozendict<2,>=1.2 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.2)
Requirement already satisfied: OctoPrint-FileCheck>=2020.07.06 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (2020.8.7)
Requirement already satisfied: Click<8,>=7.1.2 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (7.1.2)
Requirement already satisfied: watchdog<1,>=0.10.2 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.10.3)
Requirement already satisfied: Flask-Assets<3,>=2.0 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (2.0)
Requirement already satisfied: itsdangerous<2,>=1.1.0 in /opt/octoprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.1.0)
Collecting heatshrink>=0.3.2
Downloading Heatshrink-0.3.2.tar.gz (280 kB)
Collecting heatshrink2>=0.9
Downloading heatshrink2-0.9.0.tar.gz (107 kB)
Requirement already satisfied: setuptools in /opt/octoprint/lib/python3.7/site-packages (from backports.time-perf-counter>=0.0.4->OctoPrint-MarlinBft==0.1.4) (49.6.0)
Requirement already satisfied: pyasn1>=0.1.3 in /opt/octoprint/lib/python3.7/site-packages (from rsa==4.0->OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.4.8)
Requirement already satisfied: certifi in /opt/octoprint/lib/python3.7/site-packages (from sentry-sdk<1,>=0.15.1->OctoPrint->OctoPrint-MarlinBft==0.1.4) (2020.6.20)
Requirement already satisfied: urllib3>=1.10.0 in /opt/octoprint/lib/python3.7/site-packages (from sentry-sdk<1,>=0.15.1->OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.25.10)
Requirement already satisfied: Babel>=2.3 in /opt/octoprint/lib/python3.7/site-packages (from Flask-Babel<2,>=1.0->OctoPrint->OctoPrint-MarlinBft==0.1.4) (2.8.0)
Requirement already satisfied: pytz in /opt/octoprint/lib/python3.7/site-packages (from Flask-Babel<2,>=1.0->OctoPrint->OctoPrint-MarlinBft==0.1.4) (2020.1)
Requirement already satisfied: idna<3,>=2.5 in /opt/octoprint/lib/python3.7/site-packages (from requests<3,>=2.23.0->OctoPrint->OctoPrint-MarlinBft==0.1.4) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /opt/octoprint/lib/python3.7/site-packages (from requests<3,>=2.23.0->OctoPrint->OctoPrint-MarlinBft==0.1.4) (3.0.4)
Requirement already satisfied: six in /opt/octoprint/lib/python3.7/site-packages (from websocket-client<1,>=0.57->OctoPrint->OctoPrint-MarlinBft==0.1.4) (1.15.0)
Requirement already satisfied: pathtools>=0.1.1 in /opt/octoprint/lib/python3.7/site-packages (from watchdog<1,>=0.10.2->OctoPrint->OctoPrint-MarlinBft==0.1.4) (0.1.2)
Requirement already satisfied: webassets>=2.0 in /opt/octoprint/lib/python3.7/site-packages (from Flask-Assets<3,>=2.0->OctoPrint->OctoPrint-MarlinBft==0.1.4) (2.0)
Building wheels for collected packages: OctoPrint-MarlinBft, heatshrink, heatshrink2
Building wheel for OctoPrint-MarlinBft (setup.py): started
Building wheel for OctoPrint-MarlinBft (setup.py): finished with status 'done'
Created wheel for OctoPrint-MarlinBft: filename=OctoPrint_MarlinBft-0.1.4-py3-none-any.whl size=12681 sha256=e8247e6b1d29a8d2ad63dac6ed2c4500a39f5c7579ebe82e92d5b619d96065db
Stored in directory: /tmp/pip-ephem-wheel-cache-imr5126r/wheels/5a/ee/15/72dca76994fa724bd7b1dfb2286a6e94bf3c62d4751abf0b7a
Building wheel for heatshrink (setup.py): started
Error!
Could not install plugin, unknown error, please consult octoprint.log for details
Yep, it is a heatshrink dependency that relies on Python2 header files (which are of course N/A on Python3 only system):
ERROR: Command errored out with exit status 1:
command: /opt/octoprint/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zr7uusro/heatshrink/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zr7uusro/heatshrink/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-qd3qufk5/install-record.txt --single-version-externally-managed --compile --install-headers /opt/octoprint/include/site/python3.7/heatshrink
cwd: /tmp/pip-install-zr7uusro/heatshrink/
Complete output (107 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.7
creating build/lib.linux-aarch64-3.7/heatshrink
copying heatshrink/streams.py -> build/lib.linux-aarch64-3.7/heatshrink
copying heatshrink/__init__.py -> build/lib.linux-aarch64-3.7/heatshrink
running build_ext
building 'heatshrink.core' extension
creating build/temp.linux-aarch64-3.7
creating build/temp.linux-aarch64-3.7/heatshrink
creating build/temp.linux-aarch64-3.7/heatshrink/_heatshrink
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I. -I./heatshrink/_heatshrink -I/opt/octoprint/include -I/usr/local/include/python3.7m -c heatshrink/core.c -o build/temp.linux-aarch64-3.7/heatshrink/core.o -std=c99
heatshrink/core.c: In function ‘__pyx_pf_10heatshrink_4core_7Encoder_7fill’:
heatshrink/core.c:4508:38: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘Py_ssize_t’ {aka ‘long int’} [-Wsign-compare]
__pyx_t_5 = ((__pyx_v_total_sunk < __pyx_t_9) != 0);
^
heatshrink/core.c: In function ‘__Pyx__ExceptionSave’:
heatshrink/core.c:8219:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
*type = tstate->exc_type;
^~~~~~~~
curexc_type
heatshrink/core.c:8220:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
heatshrink/core.c:8221:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
heatshrink/core.c: In function ‘__Pyx__ExceptionReset’:
heatshrink/core.c:8228:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
heatshrink/core.c:8229:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
heatshrink/core.c:8230:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
heatshrink/core.c:8231:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = type;
^~~~~~~~
curexc_type
heatshrink/core.c:8232:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
heatshrink/core.c:8233:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
heatshrink/core.c: In function ‘__Pyx__GetException’:
heatshrink/core.c:8288:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
heatshrink/core.c:8289:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
heatshrink/core.c:8290:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
heatshrink/core.c:8291:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = local_type;
^~~~~~~~
curexc_type
heatshrink/core.c:8292:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
heatshrink/core.c:8293:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
heatshrink/core.c: In function ‘__Pyx__ExceptionSwap’:
heatshrink/core.c:11165:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
heatshrink/core.c:11166:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
heatshrink/core.c:11167:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
heatshrink/core.c:11168:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = *type;
^~~~~~~~
curexc_type
heatshrink/core.c:11169:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = *value;
^~~~~~~~~
curexc_value
heatshrink/core.c:11170:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = *tb;
^~~~~~~~~~~~~
curexc_traceback
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/octoprint/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zr7uusro/heatshrink/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zr7uusro/heatshrink/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-qd3qufk5/install-record.txt --single-version-externally-managed --compile --install-headers /opt/octoprint/include/site/python3.7/heatshrink Check the logs for full command output.
FWIW, it looks like heatshrink is not well maintained: https://github.com/johan-sports/pyheatshrink/issues/17
Rebuilding my setup on Python2 makes this plugin work. But breaks a few other.
I think it should be considered for a fix.
An undocumented assumption is that a system has both python2 and python3. The plugin will run in python3, if python2 is also present. We may need a python3 only fork of the plugin, or perhaps the dependencies can be re-written to use only heathsrink2 or heatshrink depending on the env. I'm not normally a python dev, so will need some research on using environment-specific dependencies.
When uploading to pypi you should be able to upload two variants one for Python2 and another one for Python3. I think that could also be an option with each variant using its own library, then selectively importing one or the other (try...except with import in them), so that the only difference between variants is requirements.txt.
FWIW Python2 is legacy now. There is not going to be any new releases and support for it is stopped. Pip support of Python2 will end pretty soon (if not yet). Which means people won't even be able to pip install packages in Python2 anymore. I really don't see why people still create libraries and tools for a dead platform.
Is this going to get fixed soon? I'm trying to test the new 64bit version of OctoPi 0.18.0rc1 and my restore fails because of this error.
@akamensky I'd love this to be python3 only, but while the default OctoPi image defaults to python2, it makes sense to continue supporting it. I'm open to being convinved otherwise.
@Taomyn This is currently a one-person rep. I'm happy to accept contributions, or even add contributors to the repo if there's enough interest. The Marlin Binary Protocol II is provisional and being replaced, so I'm limiting my personal investment in this plugin for now.
@CharlesWillis3 fair enough, but OctoPi 0.18.0 is dropping Python2 so it's going to break all plug-ins that cannot use Python3 https://octoprint.org/blog/2020/11/05/octopi-release-candidate-0-18-0rc1/
That's awesome @Taomyn. Currently, by accident, the plugin requires python2 to install, but will run in a python3 environment.
To make it install for python3 env only, just need to drop references to heatshrink and only use heathsrink2, plus some fixes in the setup files. I don't have the time to test it, but if you want to push a dev branch for python3 only and do the testing, we can arrange a release to PyPi with an updated version range, and I'll happily drop python2 support when OctoPi 0.18.0 drops.
Sorry, I misspoke. The changes need to happen primarily in the core library repo: https://github.com/CharlesWillis3/marlin-binary-protocol. But same offer applies.
I can give it a go once I can get the new 0.18.0 RC running - I tried the 64bit version and once I had sorted out bypassing this plugin in my backup as it kept failing, I discovered that the Pi-4 could no longer stream my camera except with the default settings. It's odd because I was running an older 32bit 0.18.0 nightly so I reverted back to it and it's fine, so I'm going to try again tomorrow with the newer 32bit version to see if that's the problem.
Is Python 3 supported? (seen these errors in python code written for 2.x exclusively)