[entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Fragen zur Nutzung, Features, usw..
Antworten
Benutzeravatar
Thomas aus W
Beiträge: 1079
Registriert: Mi Apr 01, 2020 4:00 pm
Has thanked: 107 times
Been thanked: 42 times

[entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von Thomas aus W »

Da das Programmiern im Github-Webeditor doch recht mühselig ist versuche ich gerade, eine lokale Entwicklungsumgebung aufzusetzten.

Ich habe ein virtuelles Environment angelegt und versuche mit diesem gerade 'pip install -r requirements.txt' auszuführen. Dabei erhalte ich folgenden Fehler:

Code: Alles auswählen

$ python3 --version
Python 3.12.3
$pip install -r requirements.txt
Collecting setuptools<81 (from -r requirements.txt (line 1))
  Using cached setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB)
## mehr "Collecting..."
  Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)
Building wheels for collected packages: jq
  Building wheel for jq (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for jq (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [1290 lines of output]
      /tmp/pip-build-env-k5my46qc/overlay/lib/python3.12/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
## millionen Warnungen ...
      Executing: ./configure CFLAGS=-fPIC -pthread --disable-maintainer-mode --with-oniguruma=/tmp/pip-install-e9m5irik/jq_c4c7cb82c35d4042bff9b84e39768180/_deps/onig-install-6.9.4
      Executing: make
      building 'jq' extension
      creating build/temp.linux-x86_64-cpython-312
      x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/tmp/pip-install-e9m5irik/jq_c4c7cb82c35d4042bff9b84e39768180/_deps/jq-1.6/src -I/home/thomas/Dokumente/Haus/E-Auto/OWB/update/version-2.0/.venv/include -I/usr/include/python3.12 -c jq.c -o build/temp.linux-x86_64-cpython-312/jq.o
      jq.c:196:12: fatal error: longintrepr.h: Datei oder Verzeichnis nicht gefunden
        196 |   #include "longintrepr.h"
            |            ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for jq
Failed to build jq
ERROR: Could not build wheels for jq, which is required to install pyproject.toml-based projects
Die Lösungsvorschläge von ChatGPT habe ich erfolglos abgearbeitet.

Hat womöglich jemand einen funktionierenden Vorschlag?


PS: natürlich ist jq bereits installiert...

Code: Alles auswählen

$ jq --version
jq-1.7
bye
TW
gvz
Beiträge: 94
Registriert: So Sep 12, 2021 8:28 am
Wohnort: Grevenbroich
Has thanked: 9 times
Been thanked: 7 times

Re: [entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von gvz »

Ich habe es gerade mal auf dem Mac probiert:
Da moppert er über "aiohttp==3.12.14" - ich habe es auf "aiohttp==3.10.11" geändert.
Mach' doch ein ">=" aus dem "==" - dann sollte er mit Deinem jq 1.7 ja zufrieden sein. Auf der offiziellen SD-Karte ist übrigens 1.6 - insofern ist das "==" ohnehin offenbar nicht mission critical.
OpenWB S2 (Touchscreen, RFID, Zähler, 11kW), 10 kWp PV ohne Speicher, ID.3
Benutzeravatar
Thomas aus W
Beiträge: 1079
Registriert: Mi Apr 01, 2020 4:00 pm
Has thanked: 107 times
Been thanked: 42 times

Re: [entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von Thomas aus W »

gvz hat geschrieben: Do Okt 09, 2025 2:13 pm Da moppert er über "aiohttp==3.12.14" - ich habe es auf "aiohttp==3.10.11" geändert.
Mach' doch ein ">=" aus dem "=="
Ich habe aiohttp sogar ganz aus der requirements.txt geworfen, selbes Ergebnis...

bye
TW
Basti
Beiträge: 141
Registriert: Di Feb 21, 2023 3:28 pm
Has thanked: 1 time
Been thanked: 21 times

Re: [entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von Basti »

Das Problem ist : Python 3.12.3 geh auf 3.9 und installiere es wie in der Anleitung .
Benutzeravatar
Thomas aus W
Beiträge: 1079
Registriert: Mi Apr 01, 2020 4:00 pm
Has thanked: 107 times
Been thanked: 42 times

Re: [entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von Thomas aus W »

Basti hat geschrieben: Do Okt 09, 2025 7:02 pm Das Problem ist : Python 3.12.3 geh auf 3.9
Hab ich gemacht (hab jetzt nen docker container in dem python3.9 läuft und der das lokale Repository gemountet hat.)
Damit in pip install... durchgelaufen.


Aber wenn ich jetzt Flake8 starte bekomme ich haufenweise Fehlermeldungen wie diese:

Code: Alles auswählen

./packages/modules/smarthome/mqtt/watt.py:12:5: F824 `global devicenumber` is unused: name is never assigned in scope
./packages/modules/smarthome/mqtt/watt.py:17:5: F824 `global numberOfSupportedDevices` is unused: name is never assigned in scope
./packages/modules/vehicles/kia/api.py:133:5: F824 `global last_url` is unused: name is never assigned in scope
./packages/modules/vehicles/kia/api.py:220:5: F824 `global last_cookies` is unused: name is never assigned in scope
./packages/modules/vehicles/kia/api.py:455:5: F824 `global last_cookies` is unused: name is never assigned in scope
./packages/smarthome/smartcommon.py:47:5: F824 `global mqttcg` is unused: name is never assigned in scope

was genau stimmt denn jetzt noch nicht?

bye
TW
Basti
Beiträge: 141
Registriert: Di Feb 21, 2023 3:28 pm
Has thanked: 1 time
Been thanked: 21 times

Re: [entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von Basti »

per se würde ich nicht auf docker python gehen. Bleibe nah an der Basis und Version. Ich habe auf der openWB Trixie am laufen aber mit der Orginal PY Version. Das gleiche in der Build Umgebung:

der Fehler sagt folgendes:

Code: Alles auswählen

 Variablen sind als global deklariert, aber keine Werte zugewiesen sind .
Benutzeravatar
Thomas aus W
Beiträge: 1079
Registriert: Mi Apr 01, 2020 4:00 pm
Has thanked: 107 times
Been thanked: 42 times

Re: [entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von Thomas aus W »

Habs jetzt soweit am Laufen, dass ich mit arbeiten kann.

Was noch komisch ist: folgende Fehler wirft pytest bei mir aber auf github laufen auch diese Tests (offensichtlich):

Code: Alles auswählen

===================================== ERRORS ======================================
________________ ERROR collecting packages/control/bat_all_test.py ________________
ImportError while importing test module '/workspace/packages/control/bat_all_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
packages/control/bat_all_test.py:5: in <module>
    from packages.conftest import hierarchy_standard
E   ModuleNotFoundError: No module named 'packages'
_______ ERROR collecting packages/control/counter_home_consumption_test.py ________
ImportError while importing test module '/workspace/packages/control/counter_home_consumption_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
packages/control/counter_home_consumption_test.py:6: in <module>
    from packages.conftest import hierarchy_hc_counter, hierarchy_standard, hierarchy_hybrid, hierarchy_nested
E   ModuleNotFoundError: No module named 'packages'
_______________ ERROR collecting packages/control/hierarchy_test.py _______________
ImportError while importing test module '/workspace/packages/control/hierarchy_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
packages/control/hierarchy_test.py:4: in <module>
    from packages.conftest import hierarchy_hybrid, hierarchy_nested
E   ModuleNotFoundError: No module named 'packages'
____ ERROR collecting packages/modules/devices/generic/virtual/counter_test.py ____
ImportError while importing test module '/workspace/packages/modules/devices/generic/virtual/counter_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
packages/modules/devices/generic/virtual/counter_test.py:22: in <module>
    from packages.conftest import hierarchy_standard, hierarchy_hybrid, hierarchy_nested
E   ModuleNotFoundError: No module named 'packages'
bye
TW
Basti
Beiträge: 141
Registriert: Di Feb 21, 2023 3:28 pm
Has thanked: 1 time
Been thanked: 21 times

Re: [entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von Basti »

Python-Importpfad (sys.path) falsch gesetzt : pytest im Projekt root ausführen .
Benutzeravatar
Thomas aus W
Beiträge: 1079
Registriert: Mi Apr 01, 2020 4:00 pm
Has thanked: 107 times
Been thanked: 42 times

Re: [entwicklungsumgebung] 'pip install -r requirements.txt' schlägt fehl

Beitrag von Thomas aus W »

Basti hat geschrieben: Sa Okt 11, 2025 6:57 pm pytest im Projekt root ausführen .
das mache ich.
Basti hat geschrieben: Sa Okt 11, 2025 6:57 pm Python-Importpfad (sys.path) falsch gesetzt
Dann würde ich erwarten, dass nicht nur 4 Tests fehl schlagen...

bye
TW
Antworten