Arksine / moonraker

Web API Server for Klipper
https://moonraker.readthedocs.io
GNU General Public License v3.0
1.02k stars 392 forks source link

power function not working #777

Closed mironfs closed 5 months ago

mironfs commented 6 months ago

What happened

i updated klipper/moonraker/fluidd/os and now my button for powering on my printer from sidebar is missing

Client

Fluidd

Browser

Other or N/A

How to reproduce

turn on printer

Additional information

moonraker (3).log what i found: my button in fluidd went missing, later found fluidd hides it when there is not power option available what i tried: i read log found this: ModuleNotFoundError: No module named 'periphery' tried install/update periphery but didnt work for me in the end i just replaced gpio.py with older version that doesnt call periphery in the start and now it works

i dont know if its somewhat related to issue #772 im not programmer

Arksine commented 6 months ago

For some reason pip failed to install Moonraker's requirements during the update. From your log:

2023-12-25 17:34:58,517 [shell_command.py:_check_proc_success()] - Command (/home/pi/moonraker-env/bin/pip install -r /home/pi/moonraker/scripts/moonraker-requirements.txt) exited with return code 1
2023-12-25 17:35:00,944 [shell_command.py:_check_proc_success()] - Command (/home/pi/moonraker-env/bin/pip install -r /home/pi/moonraker/scripts/moonraker-requirements.txt) exited with return code 1
2023-12-25 17:35:03,373 [shell_command.py:_check_proc_success()] - Command (/home/pi/moonraker-env/bin/pip install -r /home/pi/moonraker/scripts/moonraker-requirements.txt) exited with return code 1
2023-12-25 17:35:03,373 [base_deploy.py:log_exc()] - Application moonraker: Error updating python requirements
Traceback (most recent call last):
  File "/home/pi/moonraker/moonraker/components/update_manager/app_deploy.py", line 294, in _update_virtualenv
    return dep_info[distro_id]
  File "/home/pi/moonraker/moonraker/components/update_manager/update_manager.py", line 565, in run_cmd
    def needs_service_restart(self, svc_name: str) -> bool:
utils.ServerError: Shell Command Error

The first 3 lines are the attempts to install the updated requirements file, which includes python-periphery. Two things could have happened:

You can try to install it manually via SSH:

~/moonraker-env/bin/pip install -r ~/moonraker/scripts/moonraker-requirements.txt

If there is an error, copy and paste it here. If the requirements are successfully installed you can do a hard reset to restore gpio.py and restart moonraker:

cd ~/moonraker
git reset --hard origin/master
sudo service moonraker restart
ikonis commented 6 months ago

I too lost GPIO control. the above steps did not fix it, nor throw any error

Arksine commented 6 months ago

You will need to provide moonraker.log reproducing the issue.

ikonis commented 6 months ago

Here it is. moonraker (2).log

Arksine commented 6 months ago

The log shows that python-periphery is still not installed. Try the following again:

export SKIP_CYTHON=1
~/moonraker-env/bin/pip install -r ~/moonraker/scripts/moonraker-requirements.txt
sudo service moonraker restart

Copy and paste the output from the pip install command.

ikonis commented 6 months ago

pi@klipper:~/moonraker/scripts $ sudo pip install -r ~/moonraker/scripts/moonraker-requirements.txt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Ignoring tornado: markers 'python_version == "3.7"' don't match your environment Ignoring pillow: markers 'python_version == "3.7"' don't match your environment Ignoring streaming-form-data: markers 'python_version == "3.7"' don't match your environment Collecting tornado==6.3.3 Downloading https://www.piwheels.org/simple/tornado/tornado-6.3.3-cp38-abi3-linux_armv7l.whl (426 kB) |████████████████████████████████| 426 kB 273 kB/s Collecting pyserial==3.4 Downloading https://www.piwheels.org/simple/pyserial/pyserial-3.4-py2.py3-none-any.whl (193 kB) |████████████████████████████████| 193 kB 136 kB/s Collecting pyserial-asyncio==0.6 Downloading https://www.piwheels.org/simple/pyserial-asyncio/pyserial_asyncio-0.6-py3-none-any.whl (7.5 kB) Collecting pillow==10.0.1 Downloading https://www.piwheels.org/simple/pillow/Pillow-10.0.1-cp39-cp39-linux_armv7l.whl (1.1 MB) |████████████████████████████████| 1.1 MB 113 kB/s Collecting lmdb==1.4.1 Downloading https://www.piwheels.org/simple/lmdb/lmdb-1.4.1-cp39-cp39-linux_armv7l.whl (249 kB) |████████████████████████████████| 249 kB 278 kB/s Collecting streaming-form-data==1.13.0 Downloading https://www.piwheels.org/simple/streaming-form-data/streaming_form_data-1.13.0-cp39-cp39-linux_armv7l.whl (337 kB) |████████████████████████████████| 337 kB 349 kB/s Collecting distro==1.8.0 Downloading https://www.piwheels.org/simple/distro/distro-1.8.0-py3-none-any.whl (20 kB) Collecting inotify-simple==1.3.5 Downloading https://www.piwheels.org/simple/inotify-simple/inotify_simple-1.3.5-py3-none-any.whl (9.4 kB) Collecting libnacl==1.8.0 Downloading https://www.piwheels.org/simple/libnacl/libnacl-1.8.0-py2.py3-none-any.whl (20 kB) Collecting paho-mqtt==1.6.1 Downloading https://www.piwheels.org/simple/paho-mqtt/paho_mqtt-1.6.1-py3-none-any.whl (75 kB) |████████████████████████████████| 75 kB 197 kB/s Collecting zeroconf==0.69.0 Downloading https://www.piwheels.org/simple/zeroconf/zeroconf-0.69.0-cp39-cp39-manylinux_2_31_armv7l.whl (2.0 MB) |████████████████████████████████| 2.0 MB 45 kB/s Collecting preprocess-cancellation==0.2.0 Downloading https://www.piwheels.org/simple/preprocess-cancellation/preprocess_cancellation-0.2.0-py3-none-any.whl (18 kB) Collecting jinja2==3.1.2 Downloading https://www.piwheels.org/simple/jinja2/Jinja2-3.1.2-py3-none-any.whl (133 kB) |████████████████████████████████| 133 kB 253 kB/s Collecting dbus-next==0.2.3 Downloading https://www.piwheels.org/simple/dbus-next/dbus_next-0.2.3-py3-none-any.whl (57 kB) |████████████████████████████████| 57 kB 150 kB/s Collecting apprise==1.3.0 Downloading https://www.piwheels.org/simple/apprise/apprise-1.3.0-py2.py3-none-any.whl (1.1 MB) |████████████████████████████████| 1.1 MB 100 kB/s Collecting ldap3==2.9.1 Downloading https://www.piwheels.org/simple/ldap3/ldap3-2.9.1-py3-none-any.whl (419 kB) |████████████████████████████████| 419 kB 273 kB/s Collecting python-periphery==2.4.1 Downloading https://www.piwheels.org/simple/python-periphery/python_periphery-2.4.1-py2.py3-none-any.whl (36 kB) Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from apprise==1.3.0->-r /home/pi/moonraker/scripts/moonraker-requirements.txt (line 19)) (2020.6.20) Collecting requests-oauthlib Downloading https://www.piwheels.org/simple/requests-oauthlib/requests_oauthlib-1.3.1-py2.py3-none-any.whl (28 kB) Collecting PyYAML Downloading https://www.piwheels.org/simple/pyyaml/PyYAML-6.0.1-cp39-cp39-linux_armv7l.whl (45 kB) |████████████████████████████████| 45 kB 185 kB/s Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from apprise==1.3.0->-r /home/pi/moonraker/scripts/moonraker-requirements.txt (line 19)) (2.25.1) Collecting click>=5.0 Downloading https://www.piwheels.org/simple/click/click-8.1.7-py3-none-any.whl (97 kB) |████████████████████████████████| 97 kB 156 kB/s Collecting markdown Downloading https://www.piwheels.org/simple/markdown/Markdown-3.5.1-py3-none-any.whl (102 kB) |████████████████████████████████| 102 kB 132 kB/s Collecting MarkupSafe>=2.0 Downloading https://www.piwheels.org/simple/markupsafe/MarkupSafe-2.1.3-cp39-cp39-linux_armv7l.whl (23 kB) Collecting pyasn1>=0.4.6 Downloading https://www.piwheels.org/simple/pyasn1/pyasn1-0.5.1-py2.py3-none-any.whl (84 kB) |████████████████████████████████| 84 kB 167 kB/s Collecting smart-open>=6.0 Downloading https://www.piwheels.org/simple/smart-open/smart_open-6.4.0-py3-none-any.whl (57 kB) |████████████████████████████████| 57 kB 69 kB/s Collecting ifaddr>=0.1.7 Downloading https://www.piwheels.org/simple/ifaddr/ifaddr-0.2.0-py3-none-any.whl (12 kB) Collecting async-timeout>=3.0.0 Downloading https://www.piwheels.org/simple/async-timeout/async_timeout-4.0.3-py3-none-any.whl (5.7 kB) Collecting importlib-metadata>=4.4 Downloading importlib_metadata-7.0.1-py3-none-any.whl (23 kB) Requirement already satisfied: zipp>=0.5 in /usr/lib/python3/dist-packages (from importlib-metadata>=4.4->markdown->apprise==1.3.0->-r /home/pi/moonraker/scripts/moonraker-requirements.txt (line 19)) (1.0.0) Collecting oauthlib>=3.0.0 Downloading https://www.piwheels.org/simple/oauthlib/oauthlib-3.2.2-py3-none-any.whl (151 kB) |████████████████████████████████| 151 kB 102 kB/s Installing collected packages: oauthlib, importlib-metadata, smart-open, requests-oauthlib, PyYAML, pyserial, pyasn1, MarkupSafe, markdown, ifaddr, click, async-timeout, zeroconf, tornado, streaming-form-data, python-periphery, pyserial-asyncio, preprocess-cancellation, pillow, paho-mqtt, lmdb, libnacl, ldap3, jinja2, inotify-simple, distro, dbus-next, apprise Attempting uninstall: importlib-metadata Found existing installation: importlib-metadata 1.6.0 Not uninstalling importlib-metadata at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'importlib-metadata'. No files were found to uninstall. Attempting uninstall: pyserial Found existing installation: pyserial 3.5b0 Not uninstalling pyserial at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'pyserial'. No files were found to uninstall. Attempting uninstall: pillow Found existing installation: Pillow 8.1.2 Not uninstalling pillow at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'Pillow'. No files were found to uninstall. Attempting uninstall: distro Found existing installation: distro 1.5.0 Not uninstalling distro at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'distro'. No files were found to uninstall. Successfully installed MarkupSafe-2.1.3 PyYAML-6.0.1 apprise-1.3.0 async-timeout-4.0.3 click-8.1.7 dbus-next-0.2.3 distro-1.8.0 ifaddr-0.2.0 importlib-metadata-7.0.1 inotify-simple-1.3.5 jinja2-3.1.2 ldap3-2.9.1 libnacl-1.8.0 lmdb-1.4.1 markdown-3.5.1 oauthlib-3.2.2 paho-mqtt-1.6.1 pillow-10.0.1 preprocess-cancellation-0.2.0 pyasn1-0.5.1 pyserial-3.4 pyserial-asyncio-0.6 python-periphery-2.4.1 requests-oauthlib-1.3.1 smart-open-6.4.0 streaming-form-data-1.13.0 tornado-6.3.3 zeroconf-0.69.0

Arksine commented 6 months ago

sudo pip install is not the correct command. Please run the exact pip command:

~/moonraker-env/bin/pip install -r ~/moonraker/scripts/moonraker-requirements.txt
ikonis commented 6 months ago

running it ANY way else produces nothing

Arksine commented 6 months ago

Sounds like the virtualenv is corrupted. Try the following:

cd ~
rm -rf moonraker-env
~/moonraker/scripts/install-moonraker.sh
ikonis commented 6 months ago

That did it!

mironfs commented 6 months ago

that worked for me too. weird thing is after restart it broke again. tried ~/moonraker/scripts/install-moonraker.sh second time and now it works even after restart. thanks. now im going to try update second printer

edit: second printer same problers after update, did fix it same way. funny thing is on first printer we had to dig through logs to find errors on second it display error in fluidd interface

Arksine commented 6 months ago

@mironfs Can you provide logs for the second printer? Commit 54dc887 should have fixed dependency update issues due to the zeroconf build. Its possible that something else caused it to fail depending on the system.

mironfs commented 6 months ago

moonraker (4).log

Arakon commented 6 months ago

Just installed a fresh SD Card with MainsailOS, used kiauh to install Fluidd etc. After updating Moonraker to latest, power button is grayed out, same error. Ran this and it fixed it.

moonraker.log

Arksine commented 6 months ago

Thanks. The version of Moonraker that ships with the last release of MainsailOS will need to be manually updated. The pip updater in that version cannot correctly install Moonraker's requirements due to changes made to accommodate the now end-of-life Python 3.7. The pip updater has since been fixed to handle this, and I plan to drop support for Python 3.7 later this year, likely when Python 3.8 is also EOL.

It shouldn't be necessary to remove the entire virtualenv in this case. The following commands should perform a manual update:

cd ~/moonraker
git pull
./scripts/install-moonraker.sh
Arksine commented 5 months ago

This should now be resolved. Moonraker now checks its dependencies after an update, allowing it to install python-periphery on fresh Mainsail OS installations that have been updated.