feelfreelinux / octo4a

Use your old Android device as an OctoPrint server.
GNU Affero General Public License v3.0
1.52k stars 140 forks source link

octoklipper error: externally-managed-environment #493

Open zaid-hm opened 1 month ago

zaid-hm commented 1 month ago

I'm trying to run klipper on a galaxy tab A (2019) But when running the command in the instruction I get the following error:


bash -c "$(curl -fsSL https://raw.githubusercontent.com/feelfreelinux/octo4a/master/scrip
ts/setup-klipper.sh)"
Setting up klipper
Do you have "Plugin extras" installed? (y/n): y
Installing dependencies...

OK: 404 MiB in 183 packages
error: externally-managed-environment

× This environment is externally managed
╰─>
    The system-wide python installation should be maintained using the system
    package manager (apk) only.

    If the package in question is not packaged already (and hence installable via
    "apk add py3-somepackage"), please consider installing it inside a virtual
    environment, e.g.:

    python3 -m venv /path/to/venv
    . /path/to/venv/bin/activate
    pip install mypackage

    To exit the virtual environment, run:

    deactivate

    The virtual environment is not deleted, and can be re-entered by re-sourcing
    the activate file.

    To automatically manage virtual environments, consider using pipx (from the
    pipx package).

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.
localhost:~# bash -c "$(curl -fsSL https://raw.githubusercontent.com/feelfreelinux/octo4a/master/scrip
ts/setup-klipper.sh)"
Bartouzz commented 1 month ago

There is a new script for the 2.0.0 version of octo4a

https://github.com/feelfreelinux/octo4a/blob/master/scripts/setup-klipper-moonraker.sh

By the way i'm still figuring out, how to get it to work i'm running network error. Maybe you should install 1.2.6 version of octo4a and use the command line you did.

zaid-hm commented 1 month ago

@Bartouzz did you manage to get it to work, I'm running into a network issue as well

Bartouzz commented 1 month ago

@zaid-hm Still not ... Starting to lose hope, see my current klippy log:

mcu 'mcu': Starting serial connect mcu 'mcu': Unable to open serial port: [Errno 13] Could not exclusively lock port /dev/ttyOcto4a: [Errno 13] Permission denied webhooks client 489798200720: New connection webhooks client 489798200720: Client info {'program': 'Moonraker', 'version': 'v0.8.0-384-g8f3b30a'} mcu 'mcu': Unable to open serial port: [Errno 13] Could not exclusively lock port /dev/ttyOcto4a: [Errno 13] Permission denied

seem's like permission problem but i can't find the right answer. i'll post if get something

EDIT: If someone can help...

schmttc commented 1 month ago

I'm working on this issue, am updating the klipper install script to work with octo4a 2.0 Once I've done some testing will provide the details for you to confirm.

schmttc commented 4 weeks ago

I've fixed the environment and permission denied error, but have run into the next error (non rooted device) https://github.com/schmttc/octo4a/blob/schmttc-patch-1/scripts/setup-klipper.sh Have confirmed that Klipper on a Raspberry Pi 3B is working with the printer.

mcu 'mcu': Wait for identify_response
Traceback (most recent call last):
  File "/klipper/klippy/serialhdl.py", line 68, in _get_identify_data
    params = self.send_with_response(msg, 'identify_response')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/klipper/klippy/serialhdl.py", line 262, in send_with_response
    return src.get_response([cmd], self.default_cmd_queue)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/klipper/klippy/serialhdl.py", line 319, in get_response
    self.serial.raw_send_wait_ack(cmds[-1], minclock, reqclock,
  File "/klipper/klippy/serialhdl.py", line 254, in raw_send_wait_ack
    self._error("Serial connection closed")
  File "/klipper/klippy/serialhdl.py", line 61, in _error
    raise error(self.warn_prefix + (msg % params))
serialhdl.error: mcu 'mcu': Serial connection closed
schmttc commented 3 weeks ago

I've used setup-klipper-moonraker.sh and reduced it to only install Klipper, which resolves all issues.

Please try https://github.com/schmttc/octo4a/blob/klipper-fix/scripts/setup-klipper.sh

Note, you will get this error in klippy.log if Klipper is not set to the correct serial port, or the printer is not available/powered off. This error will go away once the printer is connected and configured correctly.

mcu 'mcu': Starting serial connect
mcu 'mcu': Timeout on connect
mcu 'mcu': Wait for identify_response
Traceback (most recent call last):
  File "/root/klipper/klippy/serialhdl.py", line 68, in _get_identify_data
    params = self.send_with_response(msg, 'identify_response')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/klipper/klippy/serialhdl.py", line 262, in send_with_response
    return src.get_response([cmd], self.default_cmd_queue)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/klipper/klippy/serialhdl.py", line 319, in get_response
    self.serial.raw_send_wait_ack(cmds[-1], minclock, reqclock,
  File "/root/klipper/klippy/serialhdl.py", line 254, in raw_send_wait_ack
    self._error("Serial connection closed")
  File "/root/klipper/klippy/serialhdl.py", line 61, in _error
    raise error(self.warn_prefix + (msg % params))
serialhdl.error: mcu 'mcu': Serial connection closed
schmttc commented 3 weeks ago

This may need more troubleshooting, while everything kicked off OK either Octoprint or Klipper crashed part way though a test print