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

Add virtual environment to the README setup instructions #175

Closed
thicknesss opened this issue May 19, 2024 · 5 comments
Closed

Add virtual environment to the README setup instructions #175

thicknesss opened this issue May 19, 2024 · 5 comments

Comments

@thicknesss
Copy link

thicknesss commented May 19, 2024

Hi,
I had to reinstall openhabian op rpi 3b, so choose the latest version based on debian12.
but now miflora doesn't run as should be.
the error in journalctl -u miflora:
mei 19 19:45:41 domoberry python3[867]: Traceback (most recent call last): mei 19 19:45:41 domoberry python3[867]: File "/opt/miflora-mqtt-daemon/miflora-mqtt-daemon.py", line 14, in <module> mei 19 19:45:41 domoberry python3[867]: from unidecode import unidecode mei 19 19:45:41 domoberry python3[867]: ModuleNotFoundError: No module named 'unidecode' mei 19 19:45:41 domoberry systemd[1]: miflora.service: Main process exited, code=exited, status=1/FAILURE mei 19 19:45:41 domoberry systemd[1]: miflora.service: Failed with result 'exit-code'. mei 19 19:45:41 domoberry systemd[1]: Failed to start miflora.service - Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon. mei 19 19:45:41 domoberry systemd[1]: miflora.service: Scheduled restart job, restart counter is at 3. mei 19 19:45:41 domoberry systemd[1]: Stopped miflora.service - Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon.
so I did run : pip3 install -r requirements.txt manualy (as per previous issues) and got:

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Should miflora be installed in a virtual enviroment so it doesn't conflict with any other package?

@thicknesss
Copy link
Author

I followed the link to http://rptl.io/venv and there it is stated clearly:

IMPORTANT
From Bookworm onwards, packages installed via pip must be installed into a Python Virtual Environment using venv. This has been introduced by the Python community, not by Raspberry Pi; see PEP 668 for more details.

@ThomDietrich
Copy link
Owner

Hey there! I myself am a big fan of python venvs and would support that change. Could you please provide a PR with the relevant steps in the README? Thanks!

@ThomDietrich ThomDietrich changed the title externally-managed-environment Add virtual environment to the README setup instructions May 21, 2024
@thicknesss
Copy link
Author

Hi Thom,
This is new to me.
Should I clone your repo, make changes is the readme and create a Pull Request?

The openhabian-config repo should be amended to, is this a separate action, or are taking care of that?

@ThomDietrich
Copy link
Owner

Hey! No worries.
Yes you simply go to https://github.com/ThomDietrich/miflora-mqtt-daemon/blob/master/README.md and click on the edit button. That will create a clone and you can commit changes in the next step. After that GitHub will offer you the function to create a Pull Request.

Openhabian is unrelated and you would need to provide the same steps to them. You can open a ticket in the same way and someone might help you to include those changes.

thicknesss added a commit to thicknesss/miflora-mqtt-daemon that referenced this issue May 23, 2024
thicknesss added a commit to thicknesss/miflora-mqtt-daemon that referenced this issue May 23, 2024
@thicknesss
Copy link
Author

PR #176 for README and #177 for template.service

thicknesss added a commit to thicknesss/openhabian that referenced this issue May 25, 2024
Debain 12 (Bookworm) forces the use of python virtual enviroments for some packages.
Installation script for miflora-mqtt-daemon is edited according to the proposed change in the README of miflora-mqtt-daemon.
See PR: ThomDietrich/miflora-mqtt-daemon#176.

PR ThomDietrich/miflora-mqtt-daemon#175 is made to update the systemd service file.
which will be used also when installing the package via openhabian-config.

Signed-off-by: thicknesss <[email protected]>
mstormi pushed a commit to openhab/openhabian that referenced this issue May 25, 2024
Debain 12 (Bookworm) forces the use of python virtual enviroments for some packages.
Installation script for miflora-mqtt-daemon is edited according to the proposed change in the README of miflora-mqtt-daemon.
See PR: ThomDietrich/miflora-mqtt-daemon#176.

PR ThomDietrich/miflora-mqtt-daemon#175 is made to update the systemd service file.
which will be used also when installing the package via openhabian-config.

Signed-off-by: thicknesss <[email protected]>
mstormi pushed a commit to mstormi/storm.house that referenced this issue Aug 11, 2024
Debain 12 (Bookworm) forces the use of python virtual enviroments for some packages.
Installation script for miflora-mqtt-daemon is edited according to the proposed change in the README of miflora-mqtt-daemon.
See PR: ThomDietrich/miflora-mqtt-daemon#176.

PR ThomDietrich/miflora-mqtt-daemon#175 is made to update the systemd service file.
which will be used also when installing the package via openhabian-config.

Signed-off-by: thicknesss <[email protected]>
mstormi pushed a commit to mstormi/storm.house that referenced this issue Nov 7, 2024
Debain 12 (Bookworm) forces the use of python virtual enviroments for some packages.
Installation script for miflora-mqtt-daemon is edited according to the proposed change in the README of miflora-mqtt-daemon.
See PR: ThomDietrich/miflora-mqtt-daemon#176.

PR ThomDietrich/miflora-mqtt-daemon#175 is made to update the systemd service file.
which will be used also when installing the package via openhabian-config.

Signed-off-by: thicknesss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants