[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use --system-site-packages and install package to omit building 'netifaces' wheel [Calibre-Web] #3503

Merged
merged 3 commits into from
Apr 16, 2023

Conversation

jvonau
Copy link
Contributor
@jvonau jvonau commented Mar 22, 2023

Smaller subset of #3500 without optional-requirements.txt

This works because the wheel is provided by apt, the OS package manager, and with --system-site-packages has access to the system's preinstalled wheels when creating the virtual environment. Normally --system-site-packages would be omitted and the packages would be pulled down from pypi but 'netifaces' doesn't have the latest wheels for python3.10+ but the OS does.

@holta holta added this to the 8.1 milestone Mar 22, 2023
@holta holta changed the title use --system-site-packages and install package to omit building 'netifaces' wheel use --system-site-packages and install package to omit building 'netifaces' wheel [Calibre-Web] Mar 22, 2023
@jvonau
Copy link
Contributor Author
jvonau commented Mar 22, 2023

22.04 VM where the compilers were being pulled in due to python3.10 and no wheel.

@jvonau
Copy link
Contributor Author
jvonau commented Mar 22, 2023

Just a reminder from the provided documentation.

@jvonau
Copy link
Contributor Author
jvonau commented Mar 22, 2023

Going through requirements.txt one by one with a basic apt list *packagename came up with this list that could be included with the effect of preferring the OS supplied wheels over those from pypi at install time. I'll give that a quick test and report back.
python3-chardet
python3-lxml
python3-unidecode
python3-wand
python3-flask-sqlalchemy
python3-requests
python3-flask
python3-flask-principal
python3-flask-login
python3-flask-babel
python3-babel
python3-werkzeug
python3-apscheduler

@jvonau
Copy link
Contributor Author
jvonau commented Mar 22, 2023

Packages installed

ubuntu@box:~$ /usr/local/calibre-web-py3/bin/pip3 list
Package                Version
---------------------- -------------
advocate               1.0.0
APScheduler            3.10.1
attrs                  21.2.0
Automat                20.2.0
Babel                  2.8.0
backports-abc          0.5
bcrypt                 3.2.0
beautifulsoup4         4.10.0
blinker                1.4
certifi                2020.6.20
chardet                4.0.0
click                  8.0.3
cloud-init             22.4.2
colorama               0.4.4
command-not-found      0.3
configobj              5.0.6
constantly             15.1.0
cracklib               2.9.6
cryptography           3.4.8
dbus-python            1.2.18
Deprecated             1.2.13
distro                 1.7.0
distro-info            1.1build1
Flask                  2.0.1
Flask-Babel            2.0.0
Flask-Limiter          3.3.0
Flask-Login            0.5.0
Flask-Principal        0.4.0
Flask-SQLAlchemy       2.5.1
Flask-WTF              1.1.1
greenlet               1.1.2
html5lib               1.1
httplib2               0.20.2
hyperlink              21.0.0
idna                   3.3
importlib-metadata     4.6.4
importlib-resources    5.12.0
incremental            21.3.0
iso-639                0.4.5
itsdangerous           2.1.0
jeepney                0.7.1
Jinja2                 3.0.3
jsonpatch              1.32
jsonpointer            2.0
jsonschema             3.2.0
keyring                23.5.0
launchpadlib           1.10.16
lazr.restfulclient     0.14.4
lazr.uri               1.0.6
limits                 3.3.0
lxml                   4.8.0
markdown-it-py         2.2.0
MarkupSafe             2.0.1
mdurl                  0.1.2
more-itertools         8.10.0
ndg-httpsclient        0.5.1
netifaces              0.11.0
oauthlib               3.2.0
ordered-set            4.1.0
packaging              23.0
pexpect                4.8.0
pip                    22.0.2
psycopg2               2.9.2
ptyprocess             0.7.0
py                     1.10.0
pyasn1                 0.4.8
pyasn1-modules         0.2.1
Pygments               2.14.0
PyGObject              3.42.1
PyHamcrest             2.0.2
pyinotify              0.9.6
PyJWT                  2.3.0
PyMySQL                1.0.2
PyNaCl                 1.5.0
pyOpenSSL              21.0.0
pyparsing              2.4.7
pypdf                  3.5.2
pyrsistent             0.18.1
pyserial               3.5
python-apt             2.4.0+ubuntu1
python-debian          0.1.43ubuntu1
python-magic           0.4.24
pytz                   2022.1
PyYAML                 5.4.1
pyzmq                  22.3.0
requests               2.25.1
rich                   13.3.2
SecretStorage          3.3.1
service-identity       18.1.0
setuptools             59.6.0
simplejson             3.17.6
six                    1.16.0
sos                    4.4
soupsieve              2.3.1
SQLAlchemy             1.4.31
ssh-import-id          5.11
supervisor             4.2.1
systemd-python         234
tornado                6.2
Twisted                22.1.0
typing_extensions      4.5.0
tzlocal                2.1
ubuntu-advantage-tools 8001
ufw                    0.36.1
unattended-upgrades    0.1
Unidecode              1.3.3
urllib3                1.26.5
wadllib                1.3.6
Wand                   0.6.7
webencodings           0.5.1
Werkzeug               2.0.2
wrapt                  1.15.0
WTForms                3.0.1
zipp                   1.0.0
zope.interface         5.4.0

@holta
Copy link
Member
holta commented Mar 22, 2023

Going through requirements.txt one by one with a basic apt list *packagename came up with this list that could be included with the effect of preferring the OS supplied wheels over those from pypi

Interesting. And a huge amount of work.

And might be brittle if OS's / packages keep changing year by year.

One wonders if this kind of dependency analysis/validation might hopefully (with a few prayers ;) become partially automated with better tooling one day.

@jvonau
Copy link
Contributor Author
jvonau commented Mar 22, 2023

Going through requirements.txt one by one with a basic apt list *packagename came up with this list that could be included with the effect of preferring the OS supplied wheels over those from pypi

Interesting. And a huge amount of work.

Took about an hour, suppose I could of written a script to do the parsing.

And might be brittle if OS's / packages keep changing year by year.

If an apt package gets dropped in the future sure, could become a frivolous addition when the requirements.txt file calls for a newer version than what is provided by the OS or it might be a good thing when pypi falls behind compiling a package.

At any rate this is what was installed into isolated part of the install

ls /usr/local/calibre-web-py3/lib/python3.10/site-packages/`
APScheduler-3.10.1.dist-info          mdurl
Deprecated-1.2.13.dist-info           mdurl-0.1.2.dist-info
Flask_Limiter-3.3.0.dist-info         ndg
Flask_WTF-1.1.1.dist-info             ndg_httpsclient-0.5.1.dist-info
Pygments-2.14.0.dist-info             ordered_set
WTForms-3.0.1.dist-info               ordered_set-4.1.0.dist-info
__pycache__                           packaging
_distutils_hack                       packaging-23.0.dist-info
advocate                              pip
advocate-1.0.0.dist-info              pip-22.0.2.dist-info
apscheduler                           pkg_resources
backports_abc-0.5.dist-info           pygments
backports_abc.py                      pypdf
deprecated                            pypdf-3.5.2.dist-info
distutils-precedence.pth              rich
flask_limiter                         rich-13.3.2.dist-info
flask_wtf                             setuptools
importlib_resources                   setuptools-59.6.0.dist-info
importlib_resources-5.12.0.dist-info  tornado
iso639                                tornado-6.2.dist-info
iso_639-0.4.5.dist-info               typing_extensions-4.5.0.dist-info
limits                                typing_extensions.py
limits-3.3.0.dist-info                wrapt
markdown_it                           wrapt-1.15.0.dist-info
markdown_it_py-2.2.0.dist-info        wtforms

One wonders if this kind of dependency analysis/validation might hopefully (with a few prayers ;) become partially automated with better tooling one day.

Liking to OS deb packages might be a good idea when building a deb package that is going to be deployed by apt keeping the external python packages pulled in to a minimum. No further changes forthcoming, the above was just exploratory work that might help in the future.

@holta
Copy link
Member
holta commented Mar 22, 2023

Thanks @jvonau for the above explanations 🏗️

@holta
Copy link
Member
holta commented Mar 22, 2023

This should be tested on Raspberry Pi OS. Which I hope to do in the coming week. If nobody else does that first.

Just FYI on IIAB installed earlier on 64-bit RasPiOS Lite, python3-dev and gcc seem to always be installed, as a result of python3-picamera2:

root@box:~# aptitude why python3-dev
i   python3-picamera2 Depends  python3-numpy
i A python3-numpy     Suggests python3-dev
root@box:~# aptitude why gcc
i   python3-picamera2 Depends  python3-numpy
i A python3-numpy     Suggests gcc (>= 4:4.6.1-5)
root@box:~# python3 --version
Python 3.9.2

@holta
Copy link
Member
holta commented Mar 22, 2023

Oops it appears I was wrong above.

64-bit RasPiOS Lite includes apt package gcc but not python3-dev (out of the box) according to:
https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-02-22/2023-02-21-raspios-bullseye-arm64-lite.info

Lessons Learned:

  • while aptitude why <package> is an extremely useful command, it has to be interpreted in context
  • apt-mark showauto is a faster/better way to see what was installed by the OS
  • apt-mark showmanual is a faster/better way to see what was installed later on

@jvonau

This comment was marked as outdated.

@jvonau
Copy link
Contributor Author
jvonau commented Mar 23, 2023

Oops it appears I was wrong above.

64-bit RasPiOS Lite includes apt package gcc but not python3-dev (out of the box) according to: https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-02-22/2023-02-21-raspios-bullseye-arm64-lite.info

build-essential is preinstalled on RasPiOS and has been part of the image since pi-gen's inception in 2016. Why? I don't care, but it points to not using RasPiOS when bringing up a new role and figuring out the required dependencies for that role.

@jvonau jvonau closed this Mar 23, 2023
@jvonau jvonau reopened this Apr 1, 2023
@jvonau
Copy link
Contributor Author
jvonau commented Apr 1, 2023

22.04 VM where the compilers were being pulled in due to python3.10 and no wheel.

Not pulling in compilers is always a bonus and should be goal when packaging/shipping something that might be on the live internet and it might save some drive space too.

@jvonau
Copy link
Contributor Author
jvonau commented Apr 3, 2023

Related: janeczku/calibre-web#2725

@holta
Copy link
Member
holta commented Apr 16, 2023

I had hoped this PR might solve recent IIAB failures to install Calibre-Web (since about 3 days ago?)

But it turns out this PR doesn't quite do the job. Manually installing python3-dev onto RasPiOS's Python 3.9 does work, and should possibly be considered during the period while Python 3.9 OS's stick around.

FYI this PR fails with Running setup.py install for netifaces: finished with status 'error'\n\n:stderr: ERROR: Command errored out with exit status 1 and netifaces.c:1:10: fatal error: Python.h: No such file or directory\n 1 | #include <Python.h> below on 64-bit RasPiOS (11) Lite:

TASK [calibre-web : Download Calibre-Web dependencies from 'requirements.txt' into python3 virtual environment /usr/local/calibre-web-py3] **************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": ["/usr/local/calibre-web-py3/bin/pip3", "install", "-r", "/usr/local/calibre-web-py3/requirements.txt"], "msg": "stdout: Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple\nCollecting APScheduler<3.11.0,>=3.6.3\n Using cached https://www.piwheels.org/simple/apscheduler/APScheduler-3.10.1-py3-none-any.whl (59 kB)\nRequirement already satisfied: werkzeug<2.1.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from -r /usr/local/calibre-web-py3/requirements.txt (line 2)) (2.0.3)\nCollecting Babel<3.0,>=1.3\n Using cached https://www.piwheels.org/simple/babel/Babel-2.12.1-py3-none-any.whl (10.1 MB)\nCollecting Flask-Babel<3.1.0,>=0.11.1\n Using cached https://www.piwheels.org/simple/flask-babel/flask_babel-3.0.1-py3-none-any.whl (11 kB)\nCollecting Flask-Login<0.6.3,>=0.3.2\n Using cached Flask_Login-0.6.2-py3-none-any.whl (17 kB)\nCollecting Flask-Principal<0.5.1,>=0.3.2\n Using cached https://www.piwheels.org/simple/flask-principal/Flask_Principal-0.4.0-py3-none-any.whl (6.7 kB)\nCollecting Flask<2.3.0,>=1.0.2\n Using cached https://www.piwheels.org/simple/flask/Flask-2.2.3-py3-none-any.whl (101 kB)\nCollecting iso-639<0.5.0,>=0.4.5\n Using cached https://www.piwheels.org/simple/iso-639/iso_639-0.4.5-py3-none-any.whl (171 kB)\nCollecting PyPDF<3.8.0,>=3.0.0\n Using cached https://www.piwheels.org/simple/pypdf/pypdf-3.7.1-py3-none-any.whl (248 kB)\nRequirement already satisfied: pytz>=2016.10 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from -r /usr/local/calibre-web-py3/requirements.txt (line 10)) (2022.7.1)\nRequirement already satisfied: requests<2.29.0,>=2.11.1 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from -r /usr/local/calibre-web-py3/requirements.txt (line 11)) (2.28.2)\nCollecting SQLAlchemy<2.0.0,>=1.3.0\n Using cached SQLAlchemy-1.4.47-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB)\nCollecting tornado<6.3,>=4.1\n Using cached tornado-6.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (424 kB)\nCollecting Wand<0.7.0,>=0.4.4\n Using cached https://www.piwheels.org/simple/wand/Wand-0.6.11-py3-none-any.whl (143 kB)\nCollecting unidecode<1.4.0,>=0.04.19\n Using cached https://www.piwheels.org/simple/unidecode/Unidecode-1.3.6-py3-none-any.whl (235 kB)\nCollecting lxml<5.0.0,>=3.8.0\n Using cached lxml-4.9.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (6.8 MB)\nCollecting flask-wtf<1.2.0,>=0.14.2\n Using cached https://www.piwheels.org/simple/flask-wtf/Flask_WTF-1.1.1-py3-none-any.whl (12 kB)\nCollecting chardet<4.1.0,>=3.0.0\n Using cached https://www.piwheels.org/simple/chardet/chardet-4.0.0-py2.py3-none-any.whl (178 kB)\nCollecting advocate<1.1.0,>=1.0.0\n Using cached https://www.piwheels.org/simple/advocate/advocate-1.0.0-py2.py3-none-any.whl (38 kB)\nCollecting Flask-Limiter<3.4.0,>=2.3.0\n Using cached https://www.piwheels.org/simple/flask-limiter/Flask_Limiter-3.3.0-py3-none-any.whl (27 kB)\nCollecting ndg-httpsclient\n Using cached https://www.piwheels.org/simple/ndg-httpsclient/ndg_httpsclient-0.5.1-py3-none-any.whl (34 kB)\nCollecting netifaces>=0.10.5\n Using cached netifaces-0.11.0.tar.gz (30 kB)\nRequirement already satisfied: pyopenssl in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from advocate<1.1.0,>=1.0.0->-r /usr/local/calibre-web-py3/requirements.txt (line 19)) (23.1.1)\nRequirement already satisfied: pyasn1 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from advocate<1.1.0,>=1.0.0->-r /usr/local/calibre-web-py3/requirements.txt (line 19)) (0.4.8)\nRequirement already satisfied: six in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from advocate<1.1.0,>=1.0.0->-r /usr/local/calibre-web-py3/requirements.txt (line 19)) (1.16.0)\nRequirement already satisfied: urllib3<2.0,>=1.22 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from advocate<1.1.0,>=1.0.0->-r /usr/local/calibre-web-py3/requirements.txt (line 19)) (1.26.15)\nRequirement already satisfied: tzlocal!=3.,>=2.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from APScheduler<3.11.0,>=3.6.3->-r /usr/local/calibre-web-py3/requirements.txt (line 1)) (4.3)\nRequirement already satisfied: setuptools>=0.7 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from APScheduler<3.11.0,>=3.6.3->-r /usr/local/calibre-web-py3/requirements.txt (line 1)) (44.1.1)\nRequirement already satisfied: Jinja2>=3.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from Flask<2.3.0,>=1.0.2->-r /usr/local/calibre-web-py3/requirements.txt (line 7)) (3.1.2)\nCollecting Flask<2.3.0,>=1.0.2\n Using cached https://www.piwheels.org/simple/flask/Flask-2.2.2-py3-none-any.whl (101 kB)\n Using cached https://www.piwheels.org/simple/flask/Flask-2.2.1-py3-none-any.whl (101 kB)\n Using cached https://www.piwheels.org/simple/flask/Flask-2.2.0-py3-none-any.whl (101 kB)\n Using cached https://www.piwheels.org/simple/flask/Flask-2.1.3-py3-none-any.whl (95 kB)\nRequirement already satisfied: itsdangerous>=2.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from Flask<2.3.0,>=1.0.2->-r /usr/local/calibre-web-py3/requirements.txt (line 7)) (2.1.2)\nRequirement already satisfied: importlib-metadata>=3.6.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from Flask<2.3.0,>=1.0.2->-r /usr/local/calibre-web-py3/requirements.txt (line 7)) (6.4.1)\nRequirement already satisfied: click>=8.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from Flask<2.3.0,>=1.0.2->-r /usr/local/calibre-web-py3/requirements.txt (line 7)) (8.1.3)\nRequirement already satisfied: typing-extensions>=4 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (4.5.0)\nRequirement already satisfied: ordered-set<5,>4 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (4.1.0)\nRequirement already satisfied: rich<14,>=12 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (13.3.4)\nCollecting limits>=2.8\n Using cached https://www.piwheels.org/simple/limits/limits-3.3.1-py3-none-any.whl (43 kB)\nCollecting blinker\n Using cached https://www.piwheels.org/simple/blinker/blinker-1.6.2-py3-none-any.whl (13 kB)\nRequirement already satisfied: WTForms in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from flask-wtf<1.2.0,>=0.14.2->-r /usr/local/calibre-web-py3/requirements.txt (line 17)) (3.0.1)\nRequirement already satisfied: idna<4,>=2.5 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from requests<2.29.0,>=2.11.1->-r /usr/local/calibre-web-py3/requirements.txt (line 11)) (3.4)\nRequirement already satisfied: charset-normalizer<4,>=2 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from requests<2.29.0,>=2.11.1->-r /usr/local/calibre-web-py3/requirements.txt (line 11)) (3.1.0)\nRequirement already satisfied: certifi>=2017.4.17 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from requests<2.29.0,>=2.11.1->-r /usr/local/calibre-web-py3/requirements.txt (line 11)) (2022.12.7)\nCollecting greenlet!=0.4.17\n Using cached greenlet-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (607 kB)\nRequirement already satisfied: zipp>=0.5 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from importlib-metadata>=3.6.0->Flask<2.3.0,>=1.0.2->-r /usr/local/calibre-web-py3/requirements.txt (line 7)) (3.15.0)\nRequirement already satisfied: MarkupSafe>=2.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from Jinja2>=3.0->Flask<2.3.0,>=1.0.2->-r /usr/local/calibre-web-py3/requirements.txt (line 7)) (2.1.2)\nRequirement already satisfied: deprecated>=1.2 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from limits>=2.8->Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (1.2.13)\nRequirement already satisfied: packaging<24,>=21 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from limits>=2.8->Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (23.1)\nRequirement already satisfied: importlib-resources>=1.3 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from limits>=2.8->Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (5.12.0)\nRequirement already satisfied: wrapt<2,>=1.10 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from deprecated>=1.2->limits>=2.8->Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (1.15.0)\nRequirement already satisfied: markdown-it-py<3.0.0,>=2.2.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from rich<14,>=12->Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (2.2.0)\nRequirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from rich<14,>=12->Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (2.15.0)\nRequirement already satisfied: mdurl~=0.1 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from markdown-it-py<3.0.0,>=2.2.0->rich<14,>=12->Flask-Limiter<3.4.0,>=2.3.0->-r /usr/local/calibre-web-py3/requirements.txt (line 20)) (0.1.2)\nRequirement already satisfied: pytz-deprecation-shim in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from tzlocal!=3.,>=2.0->APScheduler<3.11.0,>=3.6.3->-r /usr/local/calibre-web-py3/requirements.txt (line 1)) (0.1.0.post0)\nRequirement already satisfied: cryptography<41,>=38.0.0 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from pyopenssl->advocate<1.1.0,>=1.0.0->-r /usr/local/calibre-web-py3/requirements.txt (line 19)) (40.0.2)\nRequirement already satisfied: cffi>=1.12 in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from cryptography<41,>=38.0.0->pyopenssl->advocate<1.1.0,>=1.0.0->-r /usr/local/calibre-web-py3/requirements.txt (line 19)) (1.15.1)\nRequirement already satisfied: pycparser in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from cffi>=1.12->cryptography<41,>=38.0.0->pyopenssl->advocate<1.1.0,>=1.0.0->-r /usr/local/calibre-web-py3/requirements.txt (line 19)) (2.21)\nRequirement already satisfied: tzdata in /usr/local/calibre-web-py3/lib/python3.9/site-packages (from pytz-deprecation-shim->tzlocal!=3.*,>=2.0->APScheduler<3.11.0,>=3.6.3->-r /usr/local/calibre-web-py3/requirements.txt (line 1)) (2023.3)\nUsing legacy 'setup.py install' for netifaces, since package 'wheel' is not installed.\nInstalling collected packages: netifaces, ndg-httpsclient, limits, greenlet, Flask, blinker, Babel, Wand, unidecode, tornado, SQLAlchemy, PyPDF, lxml, iso-639, flask-wtf, Flask-Principal, Flask-Login, Flask-Limiter, Flask-Babel, chardet, APScheduler, advocate\n Running setup.py install for netifaces: started\n Running setup.py install for netifaces: finished with status 'error'\n\n:stderr: ERROR: Command errored out with exit status 1:\n command: /usr/local/calibre-web-py3/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7bicyb68/netifaces_f88ad97ee5b840c1acb07e54ff2b45e5/setup.py'"'"'; file='"'"'/tmp/pip-install-7bicyb68/netifaces_f88ad97ee5b840c1acb07e54ff2b45e5/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-mqlr4t1y/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/calibre-web-py3/include/site/python3.9/netifaces\n cwd: /tmp/pip-install-7bicyb68/netifaces_f88ad97ee5b840c1acb07e54ff2b45e5/\n Complete output (20 lines):\n running install\n running build\n running build_ext\n checking for getifaddrs...found.\n checking for getnameinfo...found.\n checking for IPv6 socket IOCTLs...not found.\n checking for optional header files...netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h netrose/rose.h linux/atm.h linux/llc.h linux/tipc.h.\n checking whether struct sockaddr has a length field...no.\n checking which sockaddr_xxx structs are defined...at ax25 in in6 ipx un rose ash ec ll atmpvc atmsvc llc.\n checking for routing socket support...no.\n checking for sysctl(CTL_NET...) support...no.\n checking for netlink support...yes.\n will use netlink to read routing table\n building 'netifaces' extension\n aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DNETIFACES_VERSION=0.11.0 -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_NETROSE_ROSE_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_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_ROSE=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/usr/local/calibre-web-py3/include -I/usr/include/python3.9 -c netifaces.c -o build/temp.linux-aarch64-3.9/netifaces.o\n netifaces.c:1:10: fatal error: Python.h: No such file or directory\n 1 | #include <Python.h>\n | ^~~~~~~~~~\n compilation terminated.\n error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1\n ----------------------------------------\nERROR: Command errored out with exit status 1: /usr/local/calibre-web-py3/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7bicyb68/netifaces_f88ad97ee5b840c1acb07e54ff2b45e5/setup.py'"'"'; file='"'"'/tmp/pip-install-7bicyb68/netifaces_f88ad97ee5b840c1acb07e54ff2b45e5/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-mqlr4t1y/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/calibre-web-py3/include/site/python3.9/netifaces Check the logs for full command output.\n"}

Related:

@jvonau
Copy link
Contributor Author
jvonau commented Apr 16, 2023

I had hoped this PR might solve recent IIAB failures to install Calibre-Web (since about 3 days ago?)

But it turns out this PR doesn't quite do the job. Manually installing python3-dev onto RasPiOS's Python 3.9 does work, and should possibly be considered during the period while Python 3.9 OS's stick around.

FYI this PR fails with Running setup.py install for netifaces: finished with status 'error'\n\n:stderr: ERROR: Command errored out with exit status 1 and netifaces.c:1:10: fatal error: Python.h: No such file or directory\n 1 | #include <Python.h> below on 64-bit RasPiOS (11) Lite:

Using cached netifaces-0.11.0.tar.gz (30 kB)\n

Your testing is flawed, you are trying to reuse the previously created virtual environment, please remove /usr/local/calibre-web-py3 first.

@jvonau
Copy link
Contributor Author
jvonau commented Apr 16, 2023

added stanza to always remove calibreweb_venv_path shouln't need to manually remove /usr/local/calibre-web-py3 first now.

@jvonau
Copy link
Contributor Author
jvonau commented Apr 16, 2023

runrole --reinstall will now really be a reinstall from scratch.

@holta
Copy link
Member
holta commented Apr 16, 2023

added stanza to always remove calibreweb_venv_path shouln't need to manually remove /usr/local/calibre-web-py3 first now.

The automated deletion of directory /usr/local/calibre-web-py3 works but then it fails (every time) shortly afterwards:

TASK [calibre-web : Download Calibre-Web dependencies from 'requirements.txt' into python3 virtual environment /usr/local/calibre-web-py3] **************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": ["/usr/bin/python3", "-m", "venv", "/usr/local/calibre-web-py3", "--system-site-packages", "/usr/local/calibre-web-py3"], "msg": "\n:stderr: usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\n ENV_DIR [ENV_DIR ...]\nvenv: error: unrecognized arguments: /usr/local/calibre-web-py3\n"}

@jvonau
Copy link
Contributor Author
jvonau commented Apr 16, 2023

Had an un-pushed edit on my U22.04 test vm, should work correctly now

@holta
Copy link
Member
holta commented Apr 16, 2023

The latest version of this PR completes on 64-bit RasPiOS Lite on RPi 4.

(Is that likely safe enough to cover most all mainline OS's / architectures?)

@jvonau
Copy link
Contributor Author
jvonau commented Apr 16, 2023

All other Ubuntu and Debian variants should behave in the same manner, all would be lacking a compiled netiface wheel for their respective version of Python3.XX.

@holta
Copy link
Member
holta commented Apr 16, 2023

Great.

And as we have far too many ever-evolving OS's and architectures, let's just ask all to keep an eye on Calibre-Web installs over coming weeks, asking everyone to test mainline/favorites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants