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

Error with DietPi #4

Open
ILPlais opened this issue Jun 14, 2020 · 9 comments
Open

Error with DietPi #4

ILPlais opened this issue Jun 14, 2020 · 9 comments

Comments

@ILPlais
Copy link

ILPlais commented Jun 14, 2020

Hello,

I tried to install the NAS Kit on a DietPi distribution on my SunFounder Kit.
But I have this error:

root@DietPi:~/git/nas-kit/main# python3 raspi_omv_main.py &
[1] 933root@DietPi:~/git/nas-kit/main# python3 raspi_omv_main.py &
[1] 933
root@DietPi:~/git/nas-kit/main# Traceback (most recent call last):
  File "raspi_omv_main.py", line 11, in <module>
    from page import *
  File "/root/git/nas-kit/main/page.py", line 16, in <module>
    from epd_lib import epd2in13_V2 
  File "/root/git/nas-kit/lib/epd_lib/epd2in13_V2.py", line 2, in <module>
    from . import epdconfig
  File "/root/git/nas-kit/lib/epd_lib/epdconfig.py", line 146, in <module>
    implementation = RaspberryPi()
  File "/root/git/nas-kit/lib/epd_lib/epdconfig.py", line 50, in __init__
    self.SPI = spidev.SpiDev(0, 0)
FileNotFoundError: [Errno 2] No such file or directory

[1]+  Exit 1                  python3 raspi_omv_main.py
root@DietPi:~/git/nas-kit/main# Traceback (most recent call last):
  File "raspi_omv_main.py", line 11, in <module>
    from page import *
  File "/root/git/nas-kit/main/page.py", line 16, in <module>
    from epd_lib import epd2in13_V2 
  File "/root/git/nas-kit/lib/epd_lib/epd2in13_V2.py", line 2, in <module>
    from . import epdconfig
  File "/root/git/nas-kit/lib/epd_lib/epdconfig.py", line 146, in <module>
    implementation = RaspberryPi()
  File "/root/git/nas-kit/lib/epd_lib/epdconfig.py", line 50, in __init__
    self.SPI = spidev.SpiDev(0, 0)
FileNotFoundError: [Errno 2] No such file or directory

[1]+  Exit 1                  python3 raspi_omv_main.py

Here the line on bug:

self.SPI = spidev.SpiDev(0, 0)

Good luck!

@ILPlais
Copy link
Author

ILPlais commented Jun 23, 2020

With the help of @sunfounder I installed the dependencies:
apt install python3-rpi.gpio python3-spidev
And after via pip3:

pip3 install spidev
pip3 install rpi.gpio
pip3 install RPi.GPIO2

But now I have the error:

root@DietPi:/opt/vc/bin/nas-kit# python3 /opt/vc/bin/nas-kit/main/raspi_omv_main.py &
[1] 4557
root@DietPi:/opt/vc/bin/nas-kit# Traceback (most recent call last):
  File "/opt/vc/bin/nas-kit/main/raspi_omv_main.py", line 3, in <module>
    import RPi.GPIO as GPIO
  File "/usr/local/lib/python3.7/dist-packages/RPi/GPIO/__init__.py", line 8, in <module>
    from RPi.core import\
  File "/usr/local/lib/python3.7/dist-packages/RPi/core.py", line 59, in <module>
    LOW  = gpiod.Line.ACTIVE_LOW
AttributeError: module 'gpiod' has no attribute 'Line'
^C
[1]+  Exit 1                  python3 /opt/vc/bin/nas-kit/main/raspi_omv_main.py
root@DietPi:/opt/vc/bin/nas-kit#

Someone help?

@ILPlais ILPlais changed the title Error with DietPie Error with DietPi Jun 28, 2020
@ghost
Copy link

ghost commented Sep 29, 2020

I'm currently stuck at the same point while trying to install on Debian.

I also had to install the following :

pip3 install gpiod

@thomasdom
Copy link

thomasdom commented Oct 9, 2020

I managed to make it work today on my NAS Kit.

Dependencies

The only required Python dependencies are the following:

  • RPi.GPIO
  • spidev

⚠️ You must NOT use Rpi.GPIO2 nor gpiod. The script provided by SunFounder does not use these dependencies at all, only the ones listed above. If they are installed on your system, remove them:

  • sudo pip3 uninstall Rpi.GPIO2 gpiod
  • pip3 uninstall Rpi.GPIO2 gpiod

Prerequisites

Make sure SPI is enabled on your Raspberry Pi:

  1. ssh pi@your-ip-address
  2. sudo raspi-config
  3. Navigate to 5 Interfacing Options and press Enter
  4. Navigate to P4 SPI and Press Enter
  5. Answer Yes to the question
  6. Quit raspi-config (Ctrl-C or navigate to exit menu)
  7. Reboot your Raspberry Pi: sudo reboot now

Setup

Clone this repo:

  • cd ~
  • git clone https://github.com/sunfounder/nas-kit

Go to nas-kit root folder and execute setup:

  1. cd ~/nas-kit
  2. sudo python3 setup.py (sudo is important, since this script is meant to run at startup later)

That's all! You can now run the script.

Run

  • cd ~/nas-kit
  • python3 main/raspi_omv_main.py

Launch at startup

Note: To start omv-epd at NAS startup:

  1. ln -s /home/pi/nas-kit/bin/omv-epd /etc/init.d/omv-epd
  2. sudo systemctl daemon-reload
  3. sudo systemctl enable omv-epd
  4. sudo systemctl start omv-epd

It should now start the NAS Kit EPD screen display at startup! 🎉


PS: This should be in a README in this repo, so it could help people.

PPS: I have opened #5, do not hesitate to comment/improve the documentation! 👍

@ghost
Copy link

ghost commented Oct 10, 2020

@thomasdom This is clearly an improvement on the problem, as I get the fans to work this way.

I'm still having an issue with the screen that is briefly blinking, then stays white. I get an error from the command python3 main.raspi_omv_main.py

pi@raspberrypi:~nas-kit $ python3 main/raspi_omv_main.py
Exception in thread Thread-1
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _boostrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "main/raspi_omv_main.py", line 312, in main
    page(current_page)
  File "/home/pi/nas-kit/main/page.py", line 76, in __call__
    eval(cmd)
  File "<string>", line 1, in <module>
  File "/home/pi/nas-kit/main/page.py", line 99, in page_1_update
    pi_msg = pi_read()
  File "/home/pi/nas-kit/main/page.py", line 150, in pi_read
    "cpu_usage": cpu_usage(),
  File "/home/pi/nas-kit/main/page.py", line 106, in cpu_usage
    result = round(100 - float(result), 2)
ValueError: could not convert string to float: '80,35'

This seems to be an error with the locale number format, as the number use a , as a decimal and not a ..

@ghost
Copy link

ghost commented Oct 10, 2020

Using raspi-config to revert back to en_US locale is a workaround. The screen now works.

Still, there is room for improvement here.

@thomasdom
Copy link

Using raspi-config to revert back to en_US locale is a workaround. The screen now works.
Still, there is room for improvement here.

Agree! This should be addressed in a separate issue to facilitate tracking of bugs/improvements 👍

@ghost
Copy link

ghost commented Oct 11, 2020

I created a new issue for that locale problem.

I'm still having an issue with the launch at startup (on a fresh install of raspbian). If I follow your guide:

  1. ln -s /home/pi/nas-kit/bin/omv-epd /etc/init.d/omv-epd
  2. sudo systemctl daemon-reload
  3. sudo systemctl enable omv-epd
  4. sudo systemctl start omv-epd

I cannot make the link (1.) without sudo (but it works with sudo). The second command works fine (without any message). The third command is giving me a message:

bleu@raspberrypi:~/nas-kit $ sudo systemctl enable omv-epd
omv-epd.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable omv-epd

The fourth command gives me an error:

bleu@raspberrypi:~/nas-kit $ sudo systemctl start omv-epd
Failed to start omv-epd.service: Unit omv-epd.service not found.

Any idea about this one ?

@nostromo1st
Copy link

Hi,
for this:

bleu@raspberrypi:~/nas-kit $ sudo systemctl start omv-epd
Failed to start omv-epd.service: Unit omv-epd.service not found.

I do this:
Chmod u+x /to_the_path/omv-epd

Now start service by:

sudo /to_the_path/omv-epd start

And reboot your raspberry and it's working.

@ghost
Copy link

ghost commented Oct 18, 2020

@nostromo1st you are right, I forgot to make the file executable, which was the cause of my problem.

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

3 participants