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

cannot import PiGlow from piglow #22

Open
brianpainterloser opened this issue Dec 11, 2015 · 9 comments
Open

cannot import PiGlow from piglow #22

brianpainterloser opened this issue Dec 11, 2015 · 9 comments

Comments

@brianpainterloser
Copy link

Hi, my test runs fine and I have managed to run clock.py successfully, but I get the following error message when I try to get the cpu monitoring program running instead:

pi@raspberrypi ~ $ from piglow import PiGlow
from: can't read /var/mail/piglow

I checked that psuutil was installed correctly (it was), see below:

pi@raspberrypi ~ $ sudo apt-get install python-smbus python-psutil -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-psutil is already the newest version.
python-smbus is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 177 not upgraded.

What am I missing here?

@electronicsguy
Copy link

Have you updated to the latest packages and Raspberry Pi firmware? What is the output of:
"sudo i2cdetect -y 1" and ""sudo i2cdetect -y 0"

@brianpainterloser
Copy link
Author

pi@raspberrypi ~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi ~ $ sudo i2cdetect - 0
Error: Unsupported option "-"!
Usage: i2cdetect [-y] [-a] [-q|-r] I2CBUS [FIRST LAST]
i2cdetect -F I2CBUS
i2cdetect -l
I2CBUS is an integer or an I2C bus name
If provided, FIRST and LAST limit the probing range.

@brianpainterloser
Copy link
Author

if you have time could you please explain what I have just done? I am a complete newbie to debian/raspberry pi so it's all good learning!

@electronicsguy
Copy link

The second command is missing a 'y'. It should be:"sudo i2cdetect -y 0"

But if the output is same as the first command, the problem is that the i2c module has not been loaded, OR, the i2c device is not being detected.

If you don't understand about how to enable i2c, read up about it here: https://learn.adafruit.com/using-the-bmp085-with-raspberry-pi/configuring-the-pi-for-i2c

and then see if you solve it. Or else report back with any new errors you encounter.

@brianpainterloser
Copy link
Author

ah yes, I didn't see that error. And the output to both commands was the same. Thanks for the help on this

@brianpainterloser
Copy link
Author

I followed through the instructions; the only change I apparently needed to make in nano was to add:
dtparam=i2c1=on.
However, going back a few steps, in the tutorial when they go to raspi-config they have 9 options in advanced setttings and I only have 6. One option that was missing was i2c enable/disable. Any ideas?

@brianpainterloser
Copy link
Author

after reading up a bit, and discovering the difference between update and upgrade, I did them both (in that order). I then had access to the i2c enable option in config. I enabled, but I seem to have done something bad. I had a couple of hangs while booting, and during the boot sequence I got a warning that I was out of space in the tmp directory. I ran autoremove in the hope that this might free up space. Now I seem to have disabled a load of features/deleted loads of software. Whoops! I am now able to get back into the GUI and it seems stable. I will start again and see if I need to reinstall everything and report back. However, if you have any pearls of wisdom here I would appreciate it!

@brianpainterloser
Copy link
Author

installed packages all seem to be there still, but when I reboot I get an error message saying there was an incomplete write

and

kernel panic - not syncing: VFS: unable to mount root fs on unknown block (0,0)

is it time to flash a new card with NOOBS and start from scratch?

@electronicsguy
Copy link

The enabling of i2c is correct. Don't worry about the missing options.

If your system still doesn't boot up and you don't have much customizations of the OS itself, it'd be easier to just start from scratch. Also check your SD card. Use a high quality one (people in this thread report similar problems due to bad SD cards: https://www.raspberrypi.org/forums/viewtopic.php?t=12245)

I personally would suggest you learn how to setup your root and home partitions on a USB drive attached to the RPi. In this way, you don't have to worry about the SD-card going bad (it'll only store the initial bootup partition and USB drives are much more resilient). I have a write-up about this if you want to go this way:
https://electronicsguy.wordpress.com/2015/03/15/booting-up-the-rpi-from-a-usb-flash-drive/

So get your system to boot up properly first, whichever way you like. Get the I2C enabled again and then we'll see.

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