I'm having trouble compiling the python from an example in the library.


I basically just cloned the entire repo, navigated to the example and then tried to run it as sudo:

sudo python ./ads1x15_ex_singleended.py

Here is the stack trace:

Traceback (most recent call last):
  File "ads1x15_ex_singleended.py", line 35, in <module>
    adc = ADS1x15(ic=ADS1115)
  File "/home/mename/Developer/AutomatedSmokingMachine/Adafruit-Raspberry-Pi-Python-Code/Adafruit_ADS1x15/Adafruit_ADS1x15.py", line 138, in __init__
    self.i2c = Adafruit_I2C(address)
  File "/home/mename/Developer/AutomatedSmokingMachine/Adafruit-Raspberry-Pi-Python-Code/Adafruit_ADS1x15/Adafruit_I2C.py", line 36, in __init__
    busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 2] No such file or directory

3 Answers 3


Nevermind. I found the solution in another forum. It turns out that i2c is disabled by default. Follow this guide:


# ensure the pi has i2c enabled by adding this to the end of /etc/modules
sudo vim /etc/modules

# download and install prerequisites
sudo apt-get update
sudo apt-get install python-smbus
sudo apt-get install i2c-tools

# un-blacklist spi and i2c (disabled by default)
# by commenting out the lines that say
# blacklist spi-bcm2708
# blacklist i2c-bcm2708
sudo vim /etc/modprobe.d/raspi-blacklist.conf

# look for an i2c device on the bus (assuming you have rpi revB)
sudo i2cdetect -y 1

I just wanted to report that today this result can be achieve very easily using this command from the terminal:

sudo raspi-config

In the next screen choose, in order:

  1. Interfacing Options
  2. I2C

Done that you're good to go.

Happy hacking!

  • 1
    I'm amazed it took a year for someone to point this out :-)
    – MikeKulls
    Commented Mar 17, 2019 at 1:21

Important to note that in the link that the above answer provided, there is an additional step:

Add the following lines to /boot/config.txt and reboot

  • Likely the adafruit thing was edited since that answer was posted, after the pi kernel's started using device trees by default.
    – goldilocks
    Commented Jun 1, 2015 at 20:12
  • 1
    That makes sense. It tripped me up before so I thought I would bring attention to it.
    – Greg
    Commented Jun 2, 2015 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.