Ubuntu Mate Octoprint installation failed

Hi,
I have BananaPi M3 board, which was succesfully running OctoPrint since 2 years. However some time ago I was able to update neither any plugin nor Octoprint's version itself.That's why decided to completly reinstall entire system +Octoprint to the latest one (currently 1.4.0). Previous version was runing under python 2.7 which those days is a not good choice.

System spec:
Operating System: Ubuntu 16.04.6 LTS
Kernel: Linux 3.4.39-BPI-M3-Kernel
Architecture: arm

Unfortunatelly it's the freshest one..

System is updated and upgrated. I have installed python 3.7.7 as well as pip3:

pi@bpi-iot-ros-ai:~ python -V Python 2.7.12 pi@bpi-iot-ros-ai:~ python3 -V
Python 3.7.7
pi@bpi-iot-ros-ai:~ pip -V pip 20.0.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7) pi@bpi-iot-ros-ai:~ pip3 -V
pip 20.0.2 from /home/pi/.local/lib/python3.7/site-packages/pip (python 3.7)
pi@bpi-iot-ros-ai:~$ update-alternatives --list python3
/usr/bin/python3.5
/usr/bin/python3.7

For pip3 I have had to implement a work around with alias (alias pip3='python3 -m pip'). Without that I received a following warning:

pi@bpi-iot-ros-ai:~$ pip3 -V
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 20.0.2 from /home/pi/.local/lib/python3.7/site-packages/pip (python 3.7)

Virtualenv is already installed.

According to Octoprint installation guide from

  1. Checkout OctoPrint: git clone https://github.com/OctoPrint/OctoPrint.git
  2. Change into the OctoPrint folder: cd OctoPrint
  3. Create a user-owned virtual environment therein: virtualenv venv if your system default python version is python 2.7, otherwise you need to specify the version explicitly, e.g. virtualenv --python=python2.7 venv .
  4. Install OctoPrint into that virtual environment : ./venv/bin/pip install .

ed 3) While my default python version is 3.7 both:
virtualenv --python=python3.7 venv
virtualenv venv
are equal.

pi@bpi-iot-ros-ai:~/octoprint/OctoPrint$ virtualenv --python=python3.7 venv
created virtual environment CPython3.7.7.final.0-32 in 2334ms
creator CPython3Posix(dest=/home/pi/octoprint/OctoPrint/venv, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/home/pi/.local/share/virtualenv/seed-app-data/v1.0.1)
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

pi@bpi-iot-ros-ai:~/octoprint/OctoPrint$ source venv/bin/activate
(venv) pi@bpi-iot-ros-ai:~/octoprint/OctoPrint$

So far so good.
ed 4) But here is a tricky part for me. How to solve following:

(venv) pi@bpi-iot-ros-ai:~/octoprint/OctoPrint$ ./venv/bin/pip install .
Processing /home/pi/octoprint/OctoPrint
Collecting flask<0.13,>=0.12
Using cached Flask-0.12.5-py2.py3-none-any.whl (81 kB)
Collecting Jinja2<2.9,>=2.8.1
Using cached Jinja2-2.8.1-py2.py3-none-any.whl (264 kB)
Processing /home/pi/.cache/pip/wheels/a2/45/43/36ec7a893e16c1212a6b1505ded0a2d73cf8e863a0227c8e04/tornado-4.5.3-cp37-cp37m-linux_armv7l.whl
Collecting regex!=2018.11.6
Using cached regex-2020.4.4.tar.gz (695 kB)
Processing /home/pi/.cache/pip/wheels/6b/b8/33/1da5a5d39e093a68d81848aa44fd70e3cd0193e6f2d5641052/Flask_Login-0.4.1-py2.py3-none-any.whl
Processing /home/pi/.cache/pip/wheels/4b/84/b6/a63a6e1b865e36aa4fcc9b6da4a7859608d89520d655012bfc/Flask_Babel-0.12.2-py3-none-any.whl
Processing /home/pi/.cache/pip/wheels/b1/5a/e3/5da3305348f63e71e5e5256c928bd72f53bdcefc9ec82139f6/Flask_Assets-0.12-py3-none-any.whl
Processing /home/pi/.cache/pip/wheels/22/f5/18/df711b66eb25b21325c132757d4314db9ac5e8dabeaf196eab/blinker-1.4-py3-none-any.whl
Collecting werkzeug<0.17,>=0.16
Using cached Werkzeug-0.16.1-py2.py3-none-any.whl (327 kB)
Collecting cachelib<0.2,>=0.1
Using cached cachelib-0.1-py3-none-any.whl (12 kB)
Processing /home/pi/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653/PyYAML-5.3.1-cp37-cp37m-linux_armv7l.whl
Collecting markdown<3.2,>=3.1
Using cached Markdown-3.1.1-py2.py3-none-any.whl (87 kB)
Collecting pyserial<3.5,>=3.4
Using cached pyserial-3.4-py2.py3-none-any.whl (193 kB)
Collecting netaddr<0.8,>=0.7.19
Using cached netaddr-0.7.19-py2.py3-none-any.whl (1.6 MB)
Processing /home/pi/.cache/pip/wheels/11/13/28/f1224b6031ddfaf72de630b6369c7ea0c59f1e3c3ce600d365/watchdog-0.9.0-py3-none-any.whl
Processing /home/pi/.cache/pip/wheels/84/11/b1/f064fa3c4d3cfa260926c057953e50d1249f12608297e0e0fa/sarge-0.1.5.post0-py3-none-any.whl
Collecting netifaces<0.11,>=0.10.9
Using cached netifaces-0.10.9.tar.gz (28 kB)
Processing /home/pi/.cache/pip/wheels/22/7d/12/2516ce8e4bf89664efdb91dee7c1162c874dca21dfd429ddfb/pylru-1.2.0-py3-none-any.whl
Collecting rsa<5,>=4.0
Using cached rsa-4.0-py2.py3-none-any.whl (38 kB)
Collecting pkginfo<1.6,>=1.5.0.1
Using cached pkginfo-1.5.0.1-py2.py3-none-any.whl (25 kB)
Collecting requests<3,>=2.22.0
Using cached requests-2.23.0-py2.py3-none-any.whl (58 kB)
Collecting semantic_version<2.9,>=2.8
Using cached semantic_version-2.8.4-py2.py3-none-any.whl (15 kB)
Collecting psutil<5.7,>=5.6.5
Using cached psutil-5.6.7.tar.gz (448 kB)
Collecting Click<8,>=7
Using cached click-7.1.1-py2.py3-none-any.whl (82 kB)
Processing /home/pi/.cache/pip/wheels/b3/66/bb/6379b15148128db97f0b59708ba1d767bf751a86ddf0c8e479/awesome_slugify-1.6.5-py3-none-any.whl
Processing /home/pi/.cache/pip/wheels/4a/87/a9/ef99b7b68f9816d5ef1262dc11ce31a93a844eb69e68c1a031/feedparser-5.2.1-py3-none-any.whl
Processing /home/pi/.cache/pip/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0/future-0.18.2-py3-none-any.whl
Collecting websocket-client<0.57,>=0.56
Using cached websocket_client-0.56.0-py2.py3-none-any.whl (200 kB)
Processing /home/pi/.cache/pip/wheels/23/5f/62/304b411f20be41821465a82bc98baabc5e68c3cdd1eb99db71/wrapt-1.11.2-py3-none-any.whl
Processing /home/pi/.cache/pip/wheels/f6/65/82/d742fe456cd8aa21ffe6c4c1eaeedf3c2d430689811bf328e1/emoji-0.5.4-py3-none-any.whl
Processing /home/pi/.cache/pip/wheels/68/17/69/ac196dd181e620bba5fae5488e4fd6366a7316dce13cf88776/frozendict-1.2-py3-none-any.whl
Collecting sentry-sdk==0.13.2
Using cached sentry_sdk-0.13.2-py2.py3-none-any.whl (91 kB)
Collecting filetype<2,>=1.0.5
Using cached filetype-1.0.6-py2.py3-none-any.whl (15 kB)
Collecting itsdangerous>=0.21
Using cached itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Processing /home/pi/.cache/pip/wheels/b9/d9/ae/63bf9056b0a22b13ade9f6b9e08187c1bb71c47ef21a8c9924/MarkupSafe-1.1.1-py3-none-any.whl
Collecting Babel>=2.3
Using cached Babel-2.8.0-py2.py3-none-any.whl (8.6 MB)
Collecting webassets>=0.11.1
Using cached webassets-2.0-py3-none-any.whl (142 kB)
Requirement already satisfied: setuptools>=36 in ./venv/lib/python3.7/site-packages (from markdown<3.2,>=3.1->OctoPrint==1.4.0) (46.1.3)
Processing /home/pi/.cache/pip/wheels/3e/31/09/fa59cef12cdcfecc627b3d24273699f390e71828921b2cbba2/pathtools-0.1.2-py3-none-any.whl
Collecting argh>=0.24.1
Using cached argh-0.26.2-py2.py3-none-any.whl (30 kB)
Collecting pyasn1>=0.1.3
Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Collecting chardet<4,>=3.0.2
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
Using cached urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
Collecting idna<3,>=2.5
Using cached idna-2.9-py2.py3-none-any.whl (58 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2020.4.5.1-py2.py3-none-any.whl (157 kB)
Collecting Unidecode<0.05,>=0.04.14
Using cached Unidecode-0.04.21-py2.py3-none-any.whl (228 kB)
Collecting six
Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting pytz>=2015.7
Using cached pytz-2019.3-py2.py3-none-any.whl (509 kB)
Building wheels for collected packages: OctoPrint, regex, netifaces, psutil
Building wheel for OctoPrint (setup.py) ... done
Created wheel for OctoPrint: filename=OctoPrint-1.4.0-py2.py3-none-any.whl size=3114118 sha256=b1193131ba187c22072942a49cc04ec2e42611e1594fb8e669cdee351653f3b2
Stored in directory: /tmp/pip-ephem-wheel-cache-5x5_zg1e/wheels/f7/84/0f/35bfd3b71a3ed985eef521216c1e017668e928880f4862f5a9
Building wheel for regex (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/pi/octoprint/OctoPrint/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9m4sze3w/regex/setup.py'"'"'; file='"'"'/tmp/pip-install-9m4sze3w/regex/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-9vmnl956
cwd: /tmp/pip-install-9m4sze3w/regex/
Complete output (18 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/regex
copying regex_3/init.py -> build/lib.linux-armv7l-3.7/regex
copying regex_3/regex.py -> build/lib.linux-armv7l-3.7/regex
copying regex_3/_regex_core.py -> build/lib.linux-armv7l-3.7/regex
copying regex_3/test_regex.py -> build/lib.linux-armv7l-3.7/regex
running build_ext
building 'regex._regex' extension
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/regex_3
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/pi/octoprint/OctoPrint/venv/include -I/usr/include/python3.7m -c regex_3/_regex.c -o build/temp.linux-armv7l-3.7/regex_3/_regex.o
regex_3/_regex.c:48:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

ERROR: Failed building wheel for regex
Running setup.py clean for regex
Building wheel for netifaces (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/pi/octoprint/OctoPrint/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9m4sze3w/netifaces/setup.py'"'"'; file='"'"'/tmp/pip-install-9m4sze3w/netifaces/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-3e1g1i5_
cwd: /tmp/pip-install-9m4sze3w/netifaces/
Complete output (18 lines):
running bdist_wheel
running build
running build_ext
checking for getifaddrs...found.
checking for getnameinfo...found.
checking for IPv6 socket IOCTLs...not found.
checking for optional header files...netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h.
checking whether struct sockaddr has a length field...no.
checking which sockaddr_xxx structs are defined...at ax25 in in6 ipx un ash ec ll atmpvc atmsvc dn irda llc.
checking for routing socket support...no.
checking for sysctl(CTL_NET...) support...no.
checking for netlink support...yes.
will use netlink to read routing table
building 'netifaces' extension
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DNETIFACES_VERSION=0.10.9 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/home/pi/octoprint/OctoPrint/venv/include -I/usr/include/python3.7m -c netifaces.c -o build/temp.linux-armv7l-3.7/netifaces.o
netifaces.c:1:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

ERROR: Failed building wheel for netifaces
Running setup.py clean for netifaces
Building wheel for psutil (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/pi/octoprint/OctoPrint/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9m4sze3w/psutil/setup.py'"'"'; file='"'"'/tmp/pip-install-9m4sze3w/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-duqznice
cwd: /tmp/pip-install-9m4sze3w/psutil/
Complete output (42 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/psutil
copying psutil/_psposix.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/init.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/_psaix.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/_compat.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/_psosx.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-armv7l-3.7/psutil
copying psutil/_common.py -> build/lib.linux-armv7l-3.7/psutil
creating build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/init.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/main.py -> build/lib.linux-armv7l-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-armv7l-3.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/psutil
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=567 -DPSUTIL_LINUX=1 -I/home/pi/octoprint/OctoPrint/venv/include -I/usr/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-armv7l-3.7/psutil/_psutil_common.o
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

ERROR: Failed building wheel for psutil
Running setup.py clean for psutil
Successfully built OctoPrint
Failed to build regex netifaces psutil
Installing collected packages: Click, itsdangerous, MarkupSafe, Jinja2, werkzeug, flask, tornado, regex, Flask-Login, pytz, Babel, Flask-Babel, webassets, Flask-Assets, blinker, cachelib, PyYAML, markdown, pyserial, netaddr, pathtools, argh, watchdog, sarge, netifaces, pylru, pyasn1, rsa, pkginfo, chardet, urllib3, idna, certifi, requests, semantic-version, psutil, Unidecode, awesome-slugify, feedparser, future, six, websocket-client, wrapt, emoji, frozendict, sentry-sdk, filetype, OctoPrint
Running setup.py install for regex ... error
ERROR: Command errored out with exit status 1:
command: /home/pi/octoprint/OctoPrint/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9m4sze3w/regex/setup.py'"'"'; file='"'"'/tmp/pip-install-9m4sze3w/regex/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-euq2_a8h/install-record.txt --single-version-externally-managed --compile --install-headers /home/pi/octoprint/OctoPrint/venv/include/site/python3.7/regex
cwd: /tmp/pip-install-9m4sze3w/regex/
Complete output (18 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.7
creating build/lib.linux-armv7l-3.7/regex
copying regex_3/init.py -> build/lib.linux-armv7l-3.7/regex
copying regex_3/regex.py -> build/lib.linux-armv7l-3.7/regex
copying regex_3/_regex_core.py -> build/lib.linux-armv7l-3.7/regex
copying regex_3/test_regex.py -> build/lib.linux-armv7l-3.7/regex
running build_ext
building 'regex._regex' extension
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/regex_3
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/pi/octoprint/OctoPrint/venv/include -I/usr/include/python3.7m -c regex_3/_regex.c -o build/temp.linux-armv7l-3.7/regex_3/_regex.o
regex_3/_regex.c:48:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/pi/octoprint/OctoPrint/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9m4sze3w/regex/setup.py'"'"'; file='"'"'/tmp/pip-install-9m4sze3w/regex/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-euq2_a8h/install-record.txt --single-version-externally-managed --compile --install-headers /home/pi/octoprint/OctoPrint/venv/include/site/python3.7/regex Check the logs for full command output.

Seems like the python headers need to be installed for the particular version of python you are using.

Thank you so much my friend for that perfect hint! I own you a beer :wink: You saved my work, one more time big thanks!

What I was missing here indeed was:
sudo apt-get install python3.7-dev

BTW: is there any possibility to run Octoprint's plugin from python 2.7 under lastes Octoprint?

Python 2.7 is still supported and remains the default in pre-built images such as OctoPi. Plugins listed in the repo will list which version of python they are compatible with.

Ok, I incorrectly specyfied a question. What I've meant was situation while I have got installed Octoprint 1.4.0 using python 3.7 as default (so plugins wrote in 2.7 are not compatible). Is there any work around to use it with a such setup?

You would have to run py2.7 to use any plugins that haven't been updated for py3. If you are ambitious you can likely fork the unsupported plugin and update it to py3 compat then submit a PR to the maintainer. :slight_smile:

Most of the time these are dependency-issues. Python.h is used by GNU Compiler Collection (gcc) to build applications. You need to install a package called python-dev for building Python modules, extending the Python interpreter or embedding Python in applications. You encounter "Python.h: No such file or directory" error while trying to build a shared library using the file extension of another language ( e.g. 'C' ). If you are trying to build a shared library using the file extension of another language, you need to install the correct development version of Python.

Reason for this error:

  • You haven't properly installed the header files and static libraries for python dev.
  • Also, sometimes include files might not be default in the include path.

How to solve this error:

  • Install the missing files and libraries.
  • Include Path and Library.
  • Finally, Compile it.