ja ist
(WATT_VENV) root@raspberrypi:~/wattpilot/WATT_VENV# python3 --version
Python 3.10.11
als voraussetzung steht ja bei der Anwendung:
python >= 3.10
ja ist
(WATT_VENV) root@raspberrypi:~/wattpilot/WATT_VENV# python3 --version
Python 3.10.11
als voraussetzung steht ja bei der Anwendung:
python >= 3.10
Was passiert wenn Du in dem venv ``python3`` aufrufst und ``import ssl`` eingibst?
Hallo,
was heißt eigentlich genau "Ich habe die 3.10.11 manuell installiert." - installiert als Paket aus Quelle? Oder manuell kompiliert?
Und welche Version von Raspberry Pi OS benutzt du bzw. welche Python-Version ist das in der Standardinstallation an Bord?
Lt. Ausgangspost hast du mit deiner manuell installierten Version des Default-Python des Systems überschrieben. Sollte man nie machen, dass kann unangenehme Nebeneffekte haben.
Gruß, noisefloor
Was passiert wenn Du in dem venv ``python3`` aufrufst und ``import ssl`` eingibst?
root@raspberrypi:~# source /root/wattpilot/WATT_VENV/bin/activate
(WATT_VENV) root@raspberrypi:~# ``python3``
Python 3.10.11 (main, May 26 2023, 10:59:03) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/ssl.py", line 99, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
>>> ``import ssl``
File "<stdin>", line 1
``import ssl``
^
SyntaxError: invalid syntax
>>>
Display MoreHallo,
was heißt eigentlich genau "Ich habe die 3.10.11 manuell installiert." - installiert als Paket aus Quelle? Oder manuell kompiliert?
Und welche Version von Raspberry Pi OS benutzt du bzw. welche Python-Version ist das in der Standardinstallation an Bord?
Lt. Ausgangspost hast du mit deiner manuell installierten Version des Default-Python des Systems überschrieben. Sollte man nie machen, dass kann unangenehme Nebeneffekte haben.
Gruß, noisefloor
manuell kompiliiert und zusätzlich zur bestehenden 3.9.x installiert. danach mit ln die python versionen umgelegt von 3.9.x auf 3.10.11
ich nutze rap OS mit standard pyhton 3.9.2
Hallo,
SyntaxError: invalid syntax
Das sollte so aussehen:
[dennis@dennis ~]$ source test/bin/activate
(test) [dennis@dennis ~]$ python
Python 3.11.3 (main, May 24 2023, 00:00:00) [GCC 12.3.1 20230508 (Red Hat 12.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>
Nur eben mit 'python3' falls 'python' bei dir auf Python2 zeigt.
Grüße
Dennis
Edit: Etwas zu langsam
Hallo,
manuell kompiliiert und...
ok, dann haben wohl Pakete gefehlt. Anleitung zum Kompilieren inkl. aller Module: https://wiki.ubuntuusers.de/Python/manuelle_Installation/ Ist zwar für Ubuntu geschrieben, sollte unter Raspberry Pi OS genau so funktionieren.
danach mit ln die python versionen umgelegt von 3.9.x auf 3.10.11
Macht man nicht. Kann gut gehen, muss aber nicht. Python ist für Raspberry Pi OS (und viele andere Distros) Bestandteil der Grundinstallation und ohne Python3 läuft das System erst gar nicht. Wenn man die Version, die zur Kerninstallation gehört ändert, kann das unerwünschte Nebeneffekte bis zu einem nicht funktionierenden System führen (kann, muss aber nicht). Also: nie machen.
Zumal es ohne Probleme möglich ist, mehrere Python-Version konfliktfrei parallel zu installieren und aufzurufen. Ist auch im oben genannten Artikel erklärt.
Gruß, noisefloor
Das ist das Problem, wenn man selbst baut, aber bestimmte Bibliotheken fehlen und deswegen die Funktionalität nicht integriert wird. Ein nachträgliches Installieren der Bibliothek bringt aber auch nichts, solange Python nicht neu kompiliert wird.
Hier sind für alle möglichen Distributionen die Abhängigkeiten gelistet: https://github.com/pyenv/pyenv…ggested-build-environment
Für Debian:
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
Das Paket libssl-dev ist die openssl Bibliothek + Header-Dateien. Nachdem die Abhängigkeiten installiert sind, kannst du ein vollwertiges Python kompilieren, bei dem nicht ein paar Features fehlen.
Falls du keinen Desktop nutzt und auch nicht die Abhängigkeiten installieren willst, dann lass das Paket tk-dev außen vor.
klaus1 Ohne die ``.
Darüber hat er es ohne die Backticks gemacht, _ssl fehlt immer noch.
Da ich pyenv nutze, habe ich noch ein paar Umgebungsvariablen gesetzt, dass der Vorgang zwar um einiges verlängert, dafür aber eine optimierte Python-Version kompiliert wird.
# takes long time
export PYTHON_CONFIGURE_OPTS='--enable-optimizations --with-lto --enable-shared'
export PYTHON_CFLAGS='-march=native -mtune=native'
Das braucht man nicht machen, ist aber sinnvoll, wenn man diese Python-Version ständig nutzt und andere Programme diese Version nutzen.
kann ich hier wieder aufsetzen ? muss ich das vorher deinstalileren = 3.10 ?
danke
root@raspberrypi:/usr/bin# cd /usr/local/bin
root@raspberrypi:/usr/local/bin# ls
2to3-3.10 idle3.10 pip3.10 pydoc3.10 python3.10 python3.10-config wattpilotshell
root@raspberrypi:/usr/local/bin# ls pyt*
python3.10 python3.10-config
root@raspberrypi:/usr/local/bin#
Solange ``python`` und ``python3`` keine Links zu ``python3.10`` sind, stört das nicht weiter. Unter ``python`` und ``python3`` sollte immer das Python angesprochen werden können, welches von der Linux-Distribution kommt. Also falls das nicht mehr der Fall sein sollte, würde ich die Links wieder ”geradebiegen”.
so.. hab nun libssl usw installiert, danach python 3.10.11 neu compiliert.
sodass ich danach auch mit import ssl das ganze durchführen konnte.
jetzt klappt der befehl: get-pip.py "pip==20.3.4", aber ich steh jetzt wieder beim installieren meiner software im VENV:
(WATT_VENV) root@raspberrypi:~/wattpilot/WATT_VENV# python3 get-pip.py "pip==20.3.4"
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pip==20.3.4
Downloading https://www.piwheels.org/simple/pip/pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 2.3 MB/s eta 0:00:00
Collecting setuptools
Using cached https://www.piwheels.org/simple/setuptools/setuptools-67.8.0-py3-none-any.whl (1.1 MB)
Collecting wheel
Using cached https://www.piwheels.org/simple/wheel/wheel-0.40.0-py3-none-any.whl (64 kB)
Installing collected packages: wheel, setuptools, pip
Successfully installed pip-20.3.4 setuptools-67.8.0 wheel-0.40.0
[notice] A new release of pip is available: 20.3.4 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
(WATT_VENV) root@raspberrypi:~/wattpilot/WATT_VENV# cd ..
(WATT_VENV) root@raspberrypi:~/wattpilot# pip install .
ERROR: Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.VersionConflict: (pip 23.0.1 (/usr/local/lib/python3.10/site-packages), Requirement.parse('pip==20.3.4'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 345, in run
session = self.get_default_session(options)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 98, in get_default_session
self._session = self.enter_context(self._build_session(options))
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 125, in _build_session
session = PipSession(
File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 343, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 175, in user_agent
setuptools_dist = get_default_environment().get_distribution("setuptools")
File "/usr/local/lib/python3.10/site-packages/pip/_internal/metadata/__init__.py", line 75, in get_default_environment
return select_backend().Environment.default()
File "/usr/local/lib/python3.10/site-packages/pip/_internal/metadata/__init__.py", line 63, in select_backend
from . import pkg_resources
File "/usr/local/lib/python3.10/site-packages/pip/_internal/metadata/pkg_resources.py", line 8, in <module>
from pip._vendor import pkg_resources
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3252, in <module>
def _initialize_master_working_set():
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pip._vendor.pkg_resources.DistributionNotFound: The 'pip==20.3.4' distribution was not found and is required by the application
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.VersionConflict: (pip 23.0.1 (/usr/local/lib/python3.10/site-packages), Requirement.parse('pip==20.3.4'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/pip", line 33, in <module>
sys.exit(load_entry_point('pip==20.3.4', 'console_scripts', 'pip')())
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/main.py", line 70, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 101, in main
return self._main(args)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
self.handle_pip_version_check(options)
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 179, in handle_pip_version_check
session = self._build_session(
File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 125, in _build_session
session = PipSession(
File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 343, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 175, in user_agent
setuptools_dist = get_default_environment().get_distribution("setuptools")
File "/usr/local/lib/python3.10/site-packages/pip/_internal/metadata/__init__.py", line 75, in get_default_environment
return select_backend().Environment.default()
File "/usr/local/lib/python3.10/site-packages/pip/_internal/metadata/__init__.py", line 63, in select_backend
from . import pkg_resources
File "/usr/local/lib/python3.10/site-packages/pip/_internal/metadata/pkg_resources.py", line 8, in <module>
from pip._vendor import pkg_resources
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3252, in <module>
def _initialize_master_working_set():
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pip._vendor.pkg_resources.DistributionNotFound: The 'pip==20.3.4' distribution was not found and is required by the application
(WATT_VENV) root@raspberrypi:~/wattpilot#
Display More
Ich würde mich da ja an die wattpilot-Entwickler wenden. Das die eine feste alte Version von ``pip`` haben wollen ist komisch bis falsch.
Wobei ich nicht sehe woher das kommt:
https://github.com/joscha82/wa…lob/main/requirements.txt
und Version 3.10 wird wohl nur aus einem kleinen speziellen Grund benötigt:
Actually, it's just wattpilotshell.py that's tied to 3.10 by using type hints "bool | None". Otherwise, wattpilot runs happily with 3.8 as well. The Wattpilot class works fine with 3.8.
Die Lösung ist ganz einfach. In jeder Python-Datei, wo inkompatible Typen-Annotationen genutzt werden, diesen Import hinzufügen:
Dann läuft es auch mit Python 3.9
Code zum Testen
Habe ich auch im issue geschrieben.
oh mann oh mann....
hab jetzt nichts weiters gemacht als nicht mit dem dämlichen pip install . gearbeitet, sondern:
python setup.py install
das hat mal geklappt.
dann beim starten von wattpilotshell gabs einen fehler in:
/usr/local/bin/wattpilotshell
da hab ich in erster Zeile dann
from __future__ import annotations
rein gegeben. fertig!
VIELEN VIELEN DANK an alle !
Dann nutzt du jetzt sehr wahrscheinlich Python 3.9, dass vom Betriebssystem bereitgestellt wird.
Der Maintainer des Projektes hat wahrscheinlich aus Unwissen heraus Python 3.10 vorausgesetzt, was sich aber mit dem Import umgehen lässt.
Andere neuere Funktionalitäten von Python 3.10 scheint er in seinem Projekt nicht zu verwenden.