Problem installing Enviro software on Pi zero

Raspbian Lite is missing some things that the “With Desktop” version has by default.

I have tried with both Raspian Lite and the full version with all the extras. I get the same error messages with both.

Ok, I wasn’t sure if Lite was being used or if it might be the issue but I figured I better mention it as a “possible” issue.

You could try running the following, just in case there is a missing dependency
sudo apt install python-numpy python-smbus python-pil python-setuptools
and for python 3
sudo apt install python3-numpy python3-smbus python3-pil python3-setuptools

Unfortunately that does not seem to have helped. Both commands reported that all were the newest version and nothing new was installed.

I’m kind of grasping at straws but if you did the curl bash install try this instead

git clone https://github.com/pimoroni/enviroplus-python
cd enviroplus-python
sudo ./install.sh

I have tried both methods of installation with similar results. I get a series of error messages which endwith the following

No package ‘libffi’ found
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^~~~~~~
compilation terminated.
error: Setup script exited with error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1
Setting up i2c and SPI…

although it then appears to finish normally.
I cannot see any reference to i2cdevice in the error messages

I have also run a simple python test and do see the I2c active:

#!/usr/bin/env python

import smbus

bus = smbus.SMBus(1) # 1 indicates /dev/i2c-1

for device in range(128):

  try:
     bus.read_byte(device)
     print(hex(device))
  except: # exception if read_byte fails
     pass

python3 i2ctest.py
0x23
0x49
0x76

I have tried the same and only get 0x23 & 0x76
but I presume that is because I have an Enviro not an Enviro+ so fewer sensors.

My search for libffi took me here, not sure if it helps though.

i2cdetect -y 1 is what you can run from terminal.

For the + it’s
0x49: ADS1015
0x76: BME280
0x23: LTR559

I had a look at it and found it all a bit beyond my skill level but it may provide some help.

One thing you can do is report this on Pimoroni’s GitHub Page for the Enviro / Enviro+, in the issues section.

Running i2c detect is a nice quick way to see if its working. If its not turned on / enabled you’ll get an error as soon as you run it. Then see what you get. All zero’s or all the fields full are an indication of an issue.
As far as i2c goes, its a shared bus and can have multiple devices connected. You just can’t have two devices with the same address. Do that an neither one of them will work.

Many thanks for your help. I have finally got it working by installing the missing libffi module with

sudo apt-get install libffi-dev

having done that the enviroplus-python package installs without any error messages and after rebooting the demo programmes run as expected.

1 Like

That’s good to hear.

Best guess is the owner of the libffi repository has moved things around or changed something that has broken the Pimoroni installer.

Hi all. I’m struggling with this on my new enviro and enviro+ .

Have you found any way forward to get these working?

Thanks.

He did get his working, he says as much in his last post.
Start at the top and work down and see if anything posted helps.

Thanks!

I plan to image a new sd card with Raspian Full desktop and start from scratch.

I plan to go through the post, from top to bottom and gather all the notes, what to install etc and build a process document then work to get this going and hopefully contribute back here with what worked etc.

Question. Did all the example scripts work? I’m trying to figure out what to expect as working and not working.

Some of the examples will only work if you also have the PMS5003 Particulate Matter Sensor. Just keep that in mind. It shouldn’t be too hard to look at the code to see if its listed or not. I don’t own an Enviro or Enviro +, just so you know.
I will be playing around with a BME280 and that same 0.96 LCD display and trying to run some of the Enviro+ examples on with them. I’m just waiting for them to arrive.

Thanks!

I don’t have the PMS5003…yet. Ill be ordering one soon though.