joakimtoe / KlipperLCD

A simple LCD service that enables the Neptune 3 Pro LCD screen with Klipper
Apache License 2.0
73 stars 11 forks source link

ModuleNotFoundError: No module name 'requests' #3

Closed 1coderookie closed 8 months ago

1coderookie commented 8 months ago

Hi,

I have a problem when I try to run python3 main.py.
I followed your installation guide and adjusted the paths (since I don't use a RPi) in both main.py and KlipperLCD.service to fit my setup:

main.py

class KlipperLCD ():
    def __init__(self):
        self.lcd = LCD("/dev/serial/by-path/pci-0000:00:10.0-usb-0:3:1.0-port0", callback=self.lcd_callback)
        self.lcd.start()
        self.printer = PrinterData('XXXXXX', URL=("127.0.0.1"), klippy_sock='/home/db/printer_1_data/comms/klippy.sock', callback=self.printer_callback)

KlipperLCD.service

[Unit]
 Description=KlipperLCD Service
 After=moonraker.service

[Service]
 Type=simple
 User=db
 Restart=always
 RestartSec=1
 ExecStart=/bin/sh -c '/usr/bin/env python3 /home/db/KlipperLCD/main.py  > /tmp/KlipperLCD.log 2>&1'

[Install]
 WantedBy=multi-user.target

When executing python3 main.py in ~/KlipperLCD it gives me the following error though:

Traceback (moste recent call last):
    File "/home/db/KlipperLCD/main.py", line 8, in <module> from printer import PrinterData
    File "/home/db/KlipperLCD/printer.py", line 7, in <module> import requests
ModuleNotFoundError: No module named 'requests'

Do you have an idea what's wrong? TIA

cnlackey commented 8 months ago

You are missing the requests module run "pip3 install requests" if you see "No module named 'example'" it usually means your missing a dependency, if you run into the issue "no module named 'PIL'" you'll also need to "pip3 install pillow". Please feel free to reach out with any other issues :)

1coderookie commented 8 months ago

Thanks for the answer! I'll give it a try in a few minutes :) That's odd tho, I followed the installation instructions, but it's probably due to the distro I'm using? Running latest Lubuntu on the HP T630..

1coderookie commented 8 months ago

Ha, it worked! Thank you so much!

It seems to work - I didn't try while printing yet, just did some basic checks and I'll have to do some further testing about the functionality, so I'll close this issue for now. What I can already say tho is that the printer's name doesn't fit (it says "Elegoo Neptune 3 Pro"), some infos in the "About Machine" don't fit and some functions in the "Settings" menu don't work (e.g. Fan Control on/off which I assume is the part cooling fan?), but maybe there's a way to fix that as well. Especially for a multiple printer setup it would be nice to have the correct names then, maybe there could be sth like a config file for KlipperLCD where one can then add the necessary info or so?