Git Product home page Git Product logo

smbus-cffi's Introduction

smbus-cffi

Latest Version Implementation License Download format Requirements Status

This Python module allows SMBus access through the I2C /dev interface on Linux hosts. The host kernel must have I2C support, I2C device interface support, and a bus adapter driver.

This module is a cffi-based python reimplementation of the python-smbus C-extension (http://www.lm-sensors.org/browser/i2c-tools/trunk/py-smbus/) and works on PyPy and CPython (2.6 and up).

Notes

The SMBus methods read_block_data and block_process_call are not fully tested, and might not work correctly, see note below.

Note of caution for Raspberry Pi users: when calling read_block_data and block_process_call the underlying i2c/smbus library/driver causes a kernel panic on the Raspberry Pi. Testing these features on other hardware would be a great way to contribute.

Example

Assuming you have a device connected at address 4 on the bus

>>> from smbus import SMBus

>>> bus = SMBus(4)

>>> bus.write_quick()

>>> some_reg = 123

>>> bus.write_i2c_block_data(4, some_reg, [1, 4, 7])

Dependencies

To install smbus-cffi you will need:

https://metacpan.org/pod/Device::SMBus provides a good description on how to setup the dependencies.

On Debian based distributions these can be installed with:

sudo apt-get install build-essential libi2c-dev i2c-tools python-dev libffi-dev

On Arch Linux:

pacman -S base-devel
pacman -S i2c-tools

Finally install cffi using pip or from source.

pip install cffi

Installation

There are several methods to install the package. First install the dependencies as described above. Note: unfortunately at the moment when installing using pip or setup.py on CPython you need to make sure that the cffi package already is installed.

1. pip install from PyPi

pip install smbus-cffi

2. pip install from git

pip install git+https://github.com/bivab/smbus-cffi.git

3. Clone the repository and run setup.py

git clone https://github.com/bivab/smbus-cffi.git
python setup.py install

Bug Reporting

To submit a bugreport use the GitHub bugtracker for the project:

https://github.com/bivab/smbus-cffi/issues

Development

You can get the latest version from the repository hosted at GitHub https://github.com/bivab/smbus-cffi

The file requirements.txt contains the list of dependencies needed to work with smbus-cffi.

The project uses py.test for testing and tox to test on pypy and python.

The file test/test_smbus_integration.py contains a set of integration tests for the smbus wrapper. To run the integrations tests you need an Arduino board flashed with the sketch provided in test/test_sketch. The serial port and the i2c pins of the Arduino board need to be connected to the machine running the tests. The sketch implements the counterpart of the smbus protocol that reads and writes data for each test using smbus and the serial port.

Authors

  • David Schneider

Author of the original smbus C extension:

  • Mark M. Hoffman

Copyright

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

See LICENSE for full license text

smbus-cffi's People

Contributors

bivab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smbus-cffi's Issues

validator() got an unexpected keyword argument 'len'

Instantiating a SMBus() object and then calling read_i2c_block_data with len as a keyword argument fails:

>       bus.read_i2c_block_data(address, data, len=8)
E       TypeError: validator() got an unexpected keyword argument 'len'
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from smbus import SMBus
>>> bus = SMBus(3)
>>> bus.read_i2c_block_data(0x20, 0x0, len=8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: validator() got an unexpected keyword argument 'len'
>>>

does not compile on ArmOnArch

I do::

export CPATH=/usr/lib/libffi-3.0.13/include/
pip2 install smbus-cffi

Downloading/unpacking smbus-cffi
  Downloading smbus-cffi-0.2.tar.gz
  Running setup.py egg_info for package smbus-cffi

    Installed /tmp/pip_build_root/smbus-cffi/cffi-0.8.1-py2.7-linux-armv6l.egg
    Searching for pycparser
    Reading https://pypi.python.org/simple/pycparser/
    Best match: pycparser 2.10
    Downloading https://pypi.python.org/packages/source/p/pycparser/pycparser-2.10.tar.gz#md5=d87aed98c8a9f386aa56d365fe4d515f
    Processing pycparser-2.10.tar.gz
    Writing /tmp/easy_install-ZsGe8v/pycparser-2.10/setup.cfg
    Running pycparser-2.10/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZsGe8v/pycparser-2.10/egg-dist-tmp-NcALLa
    zip_safe flag not set; analyzing archive contents...

    Installed /tmp/pip_build_root/smbus-cffi/pycparser-2.10-py2.7.egg
    building '_cffi__x105b3718x176f443a' extension
    gcc -pthread -fno-strict-aliasing -march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -DNDEBUG -march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fPIC -I/usr/include/python2.7 -c smbus/__pycache__/_cffi__x105b3718x176f443a.c -o /tmp/pip_build_root/smbus-cffi/smbus/__pycache__/smbus/__pycache__/_cffi__x105b3718x176f443a.o
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_BLOCK_DATA':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:498:20: error: 'I2C_SMBUS_BLOCK_DATA' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:498:20: note: each undeclared identifier is reported only once for each function it appears in
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_BLOCK_MAX':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:517:20: error: 'I2C_SMBUS_BLOCK_MAX' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_BLOCK_PROC_CALL':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:536:20: error: 'I2C_SMBUS_BLOCK_PROC_CALL' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_BYTE':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:555:20: error: 'I2C_SMBUS_BYTE' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_BYTE_DATA':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:574:20: error: 'I2C_SMBUS_BYTE_DATA' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_I2C_BLOCK_BROKEN':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:593:20: error: 'I2C_SMBUS_I2C_BLOCK_BROKEN' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_I2C_BLOCK_DATA':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:612:20: error: 'I2C_SMBUS_I2C_BLOCK_DATA' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_PROC_CALL':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:631:20: error: 'I2C_SMBUS_PROC_CALL' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_QUICK':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:650:20: error: 'I2C_SMBUS_QUICK' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_READ':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:669:20: error: 'I2C_SMBUS_READ' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_WORD_DATA':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:688:20: error: 'I2C_SMBUS_WORD_DATA' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_const_I2C_SMBUS_WRITE':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:707:20: error: 'I2C_SMBUS_WRITE' undeclared (first use in this function)
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_check_union_i2c_smbus_data':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:725:12: error: dereferencing pointer to incomplete type
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:726:12: error: dereferencing pointer to incomplete type
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:727:33: error: dereferencing pointer to incomplete type
    smbus/__pycache__/_cffi__x105b3718x176f443a.c: In function '_cffi_layout_union_i2c_smbus_data':
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:732:58: error: field 'y' has incomplete type
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:734:12: error: invalid application of 'sizeof' to incomplete type 'union i2c_smbus_data'
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:736:5: error: invalid use of undefined type 'union i2c_smbus_data'
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:737:39: error: dereferencing pointer to incomplete type
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:738:5: error: invalid use of undefined type 'union i2c_smbus_data'
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:739:39: error: dereferencing pointer to incomplete type
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:740:5: error: invalid use of undefined type 'union i2c_smbus_data'
    smbus/__pycache__/_cffi__x105b3718x176f443a.c:741:39: error: dereferencing pointer to incomplete type
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip_build_root/smbus-cffi/setup.py", line 7, in <module>
        import smbus
      File "smbus/__init__.py", line 1, in <module>
        from .smbus import ffi
      File "smbus/smbus.py", line 93, in <module>
        """, ext_package='smbus')
      File "/tmp/pip_build_root/smbus-cffi/cffi-0.8.1-py2.7-linux-armv6l.egg/cffi/api.py", line 339, in verify
        lib = self.verifier.load_library()
      File "/tmp/pip_build_root/smbus-cffi/cffi-0.8.1-py2.7-linux-armv6l.egg/cffi/verifier.py", line 74, in load_library
        self._compile_module()
      File "/tmp/pip_build_root/smbus-cffi/cffi-0.8.1-py2.7-linux-armv6l.egg/cffi/verifier.py", line 139, in _compile_module
        outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
      File "/tmp/pip_build_root/smbus-cffi/cffi-0.8.1-py2.7-linux-armv6l.egg/cffi/ffiplatform.py", line 25, in compile
        outputfilename = _build(tmpdir, ext)
      File "/tmp/pip_build_root/smbus-cffi/cffi-0.8.1-py2.7-linux-armv6l.egg/cffi/ffiplatform.py", line 50, in _build
        raise VerificationError('%s: %s' % (e.__class__.__name__, e))
    cffi.ffiplatform.VerificationError: CompileError: command 'gcc' failed with exit status 1
    Complete output from command python setup.py egg_info:

[....]

Seems like a compatibility issue here...

Reading is not changing

The sensor reading is not changing and the smbus prevent the program from writng the data in the csv file

Failing to install when dependencies are met

I installed all dependencies including cffi and I get this error when running: pip install smbus-cffi

chip@chip:~$ pip install smbus-cffi
Downloading/unpacking smbus-cffi
Downloading smbus-cffi-0.5.1.tar.gz
Running setup.py (path:/tmp/pip-build-YUGZZ4/smbus-cffi/setup.py) egg_info for package smbus-cffi

Installed /tmp/pip-build-YUGZZ4/smbus-cffi/cffi-1.10.0-py2.7-linux-armv7l.egg
Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "/tmp/pip-build-YUGZZ4/smbus-cffi/setup.py", line 48, in <module>
    'Topic :: System :: Hardware',
  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 266, in __init__
    _Distribution.__init__(self,attrs)
  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
    self.finalize_options()
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 301, in finalize_options
    ep.load()(self, ep.name, value)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
ImportError: No module named setuptools_ext
Complete output from command python setup.py egg_info:

Installed /tmp/pip-build-YUGZZ4/smbus-cffi/cffi-1.10.0-py2.7-linux-armv7l.egg

Traceback (most recent call last):

File "", line 17, in

File "/tmp/pip-build-YUGZZ4/smbus-cffi/setup.py", line 48, in

'Topic :: System :: Hardware',

File "/usr/lib/python2.7/distutils/core.py", line 111, in setup

_setup_distribution = dist = klass(attrs)

File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 266, in init

_Distribution.__init__(self,attrs)

File "/usr/lib/python2.7/distutils/dist.py", line 287, in init

self.finalize_options()

File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 301, in finalize_options

ep.load()(self, ep.name, value)

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load

['__name__'])

ImportError: No module named setuptools_ext


Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-YUGZZ4/smbus-cffi
Storing debug log for failure in /home/chip/.pip/pip.log
chip@chip:~$

cffi Install Fails Prior to smbus-cffi Install on Arch Linux

Not sure if this is your issue or not: During install on Arch Linux, before I get to the step of actually installing smbus-cffi, pip install cffi runs up to a point, then fails with:

c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
compilation terminated

Microsoft Visual C++ 14.0 is required

I have already added:
Microsoft Visual C++ 2015-2019 Redistributable 14.23.27820.0
and i have installed the Visual Studio Build Tools 2019 with the Win 10 SDK.

I am using Visual Code for my python code.

crash when using Python 2.7 (arch arm on IMX233)

pip install went ok, but when i try to call the module i get:

[root@alarm ~]# python2
Python 2.7.8 (default, Sep 24 2014, 05:50:37)
[GCC 4.8.2 20131219 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from smbus import SMBus
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_BLOCK_DATA':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:517:30: error: 'I2C_SMBUS_BLOCK_DATA' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_BLOCK_DATA);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:517:30: note: each undeclared identifier is reported only once for each function it appears in
o = _cffi_from_c_int_const(I2C_SMBUS_BLOCK_DATA);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_BLOCK_MAX':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:531:30: error: 'I2C_SMBUS_BLOCK_MAX' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_BLOCK_MAX);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_BLOCK_PROC_CALL':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:545:30: error: 'I2C_SMBUS_BLOCK_PROC_CALL' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_BLOCK_PROC_CALL);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_BYTE':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:559:30: error: 'I2C_SMBUS_BYTE' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_BYTE);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_BYTE_DATA':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:573:30: error: 'I2C_SMBUS_BYTE_DATA' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_BYTE_DATA);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_I2C_BLOCK_BROKEN':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:587:30: error: 'I2C_SMBUS_I2C_BLOCK_BROKEN' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_I2C_BLOCK_BROKEN);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_I2C_BLOCK_DATA':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:601:30: error: 'I2C_SMBUS_I2C_BLOCK_DATA' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_I2C_BLOCK_DATA);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_PROC_CALL':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:615:30: error: 'I2C_SMBUS_PROC_CALL' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_PROC_CALL);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_QUICK':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:629:30: error: 'I2C_SMBUS_QUICK' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_QUICK);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_READ':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:643:30: error: 'I2C_SMBUS_READ' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_READ);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_WORD_DATA':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:657:30: error: 'I2C_SMBUS_WORD_DATA' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_WORD_DATA);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_const_I2C_SMBUS_WRITE':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:671:30: error: 'I2C_SMBUS_WRITE' undeclared (first use in this function)
o = _cffi_from_c_int_const(I2C_SMBUS_WRITE);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:54:8: note: in definition of macro '_cffi_from_c_int_const'
(((x) > 0) ?
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_check_union_i2c_smbus_data':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:684:12: error: dereferencing pointer to incomplete type
(void)((p->byte) << 1);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:685:12: error: dereferencing pointer to incomplete type
(void)((p->word) << 1);
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:686:33: error: dereferencing pointer to incomplete type
{ unsigned char(*tmp)[34] = &p->block; (void)tmp; }
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c: In function '_cffi_layout_union_i2c_smbus_data':
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:691:58: error: field 'y' has incomplete type
struct _cffi_aligncheck { char x; union i2c_smbus_data y; };
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:693:12: error: invalid application of 'sizeof' to incomplete type 'union i2c_smbus_data'
sizeof(union i2c_smbus_data),
^
In file included from /usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:3:0:
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:695:20: error: invalid use of undefined type 'union i2c_smbus_data'
offsetof(union i2c_smbus_data, byte),
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:696:39: error: dereferencing pointer to incomplete type
sizeof(((union i2c_smbus_data *)0)->byte),
^
In file included from /usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:3:0:
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:697:20: error: invalid use of undefined type 'union i2c_smbus_data'
offsetof(union i2c_smbus_data, word),
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:698:39: error: dereferencing pointer to incomplete type
sizeof(((union i2c_smbus_data *)0)->word),
^
In file included from /usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:3:0:
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:699:20: error: invalid use of undefined type 'union i2c_smbus_data'
offsetof(union i2c_smbus_data, block),
^
/usr/lib/python2.7/site-packages/smbus/pycache/_cffi__x484c8eddxe317607c.c:700:39: error: dereferencing pointer to incomplete type
sizeof(((union i2c_smbus_data *)0)->block),
^
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/smbus/init.py", line 1, in
from .smbus import ffi
File "/usr/lib/python2.7/site-packages/smbus/smbus.py", line 96, in
""", ext_package='smbus', include_dirs=[include_dir])
File "/usr/lib/python2.7/site-packages/cffi/api.py", line 340, in verify
lib = self.verifier.load_library()
File "/usr/lib/python2.7/site-packages/cffi/verifier.py", line 74, in load_library
self._compile_module()
File "/usr/lib/python2.7/site-packages/cffi/verifier.py", line 139, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "/usr/lib/python2.7/site-packages/cffi/ffiplatform.py", line 25, in compile
outputfilename = _build(tmpdir, ext)
File "/usr/lib/python2.7/site-packages/cffi/ffiplatform.py", line 51, in _build
raise VerificationError('%s: %s' % (e.class.name, e))
cffi.ffiplatform.VerificationError: CompileError: command 'gcc' failed with exit status 1

Error on beaglebone black with pypy's latest

I'm not very great at python, so I'm not sure what to do with this. Normal python and smbus work great. I just wanted to test the speed with pypy.


/usr/local/pypy/bin/pip run on Mon Dec 23 02:59:17 2013
Downloading/unpacking git+https://github.com/bivab/smbus-cffi.git

Cloning https://github.com/bivab/smbus-cffi.git to /tmp/pip-NGDOQl-build

Found command 'git' at '/usr/bin/git'
Running command /usr/bin/git clone -q https://github.com/bivab/smbus-cffi.git /tmp/pip-NGDOQl-build
Running setup.py egg_info for package from git+https://github.com/bivab/smbus-cffi.git

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_access’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:31:3: warning: implicit declaration of function ‘i2c_smbus_access’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_process_call’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:36:3: warning: implicit declaration of function ‘i2c_smbus_process_call’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_byte’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:41:3: warning: implicit declaration of function ‘i2c_smbus_read_byte’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_byte_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:46:3: warning: implicit declaration of function ‘i2c_smbus_read_byte_data’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_word_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:51:3: warning: implicit declaration of function ‘i2c_smbus_read_word_data’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_byte’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:56:3: warning: implicit declaration of function ‘i2c_smbus_write_byte’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_byte_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:61:3: warning: implicit declaration of function ‘i2c_smbus_write_byte_data’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_quick’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:66:3: warning: implicit declaration of function ‘i2c_smbus_write_quick’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_word_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:71:3: warning: implicit declaration of function ‘i2c_smbus_write_word_data’ [-Wimplicit-function-declaration]

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_DATA’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:88:28: error: ‘I2C_SMBUS_BLOCK_DATA’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:88:28: note: each undeclared identifier is reported only once for each function it appears in

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_MAX’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:94:28: error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_PROC_CALL’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:100:28: error: ‘I2C_SMBUS_BLOCK_PROC_CALL’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BYTE’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:106:28: error: ‘I2C_SMBUS_BYTE’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BYTE_DATA’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:112:28: error: ‘I2C_SMBUS_BYTE_DATA’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_I2C_BLOCK_BROKEN’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:118:28: error: ‘I2C_SMBUS_I2C_BLOCK_BROKEN’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_I2C_BLOCK_DATA’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:124:28: error: ‘I2C_SMBUS_I2C_BLOCK_DATA’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_PROC_CALL’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:130:28: error: ‘I2C_SMBUS_PROC_CALL’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_QUICK’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:136:28: error: ‘I2C_SMBUS_QUICK’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_READ’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:142:28: error: ‘I2C_SMBUS_READ’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_WORD_DATA’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:148:28: error: ‘I2C_SMBUS_WORD_DATA’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_WRITE’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:154:28: error: ‘I2C_SMBUS_WRITE’ undeclared (first use in this function)

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_check_union_i2c_smbus_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:161:12: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:162:12: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:163:33: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_layout_union_i2c_smbus_data’:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:167:58: error: field ‘y’ has incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:169:12: error: invalid application of ‘sizeof’ to incomplete type ‘union i2c_smbus_data’

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:171:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:172:39: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:173:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:174:39: error: dereferencing pointer to incomplete type

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:175:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c:176:39: error: dereferencing pointer to incomplete type

Traceback (most recent call last):

  File "app_main.py", line 72, in run_toplevel

  File "app_main.py", line 578, in run_it

  File "<string>", line 16, in <module>

  File "/tmp/pip-NGDOQl-build/setup.py", line 7, in <module>

    import smbus

  File "smbus/__init__.py", line 1, in <module>

    from .smbus import ffi

  File "smbus/smbus.py", line 93, in <module>

    """, ext_package='smbus')

  File "/usr/local/pypy/lib_pypy/cffi/api.py", line 339, in verify

    lib = self.verifier.load_library()

  File "/usr/local/pypy/lib_pypy/cffi/verifier.py", line 74, in load_library

    self._compile_module()

  File "/usr/local/pypy/lib_pypy/cffi/verifier.py", line 139, in _compile_module

    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())

  File "/usr/local/pypy/lib_pypy/cffi/ffiplatform.py", line 25, in compile

    outputfilename = _build(tmpdir, ext)

  File "/usr/local/pypy/lib_pypy/cffi/ffiplatform.py", line 50, in _build

    raise VerificationError('%s: %s' % (e.__class__.__name__, e))

VerificationError: CompileError: command 'cc' failed with exit status 1

Complete output from command python setup.py egg_info:

smbus/__pycache__/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_access’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:31:3: warning: implicit declaration of function ‘i2c_smbus_access’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_process_call’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:36:3: warning: implicit declaration of function ‘i2c_smbus_process_call’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_byte’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:41:3: warning: implicit declaration of function ‘i2c_smbus_read_byte’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_byte_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:46:3: warning: implicit declaration of function ‘i2c_smbus_read_byte_data’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_read_word_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:51:3: warning: implicit declaration of function ‘i2c_smbus_read_word_data’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_byte’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:56:3: warning: implicit declaration of function ‘i2c_smbus_write_byte’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_byte_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:61:3: warning: implicit declaration of function ‘i2c_smbus_write_byte_data’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_quick’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:66:3: warning: implicit declaration of function ‘i2c_smbus_write_quick’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_f_i2c_smbus_write_word_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:71:3: warning: implicit declaration of function ‘i2c_smbus_write_word_data’ [-Wimplicit-function-declaration]

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_DATA’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:88:28: error: ‘I2C_SMBUS_BLOCK_DATA’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c:88:28: note: each undeclared identifier is reported only once for each function it appears in

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_MAX’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:94:28: error: ‘I2C_SMBUS_BLOCK_MAX’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BLOCK_PROC_CALL’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:100:28: error: ‘I2C_SMBUS_BLOCK_PROC_CALL’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BYTE’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:106:28: error: ‘I2C_SMBUS_BYTE’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_BYTE_DATA’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:112:28: error: ‘I2C_SMBUS_BYTE_DATA’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_I2C_BLOCK_BROKEN’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:118:28: error: ‘I2C_SMBUS_I2C_BLOCK_BROKEN’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_I2C_BLOCK_DATA’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:124:28: error: ‘I2C_SMBUS_I2C_BLOCK_DATA’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_PROC_CALL’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:130:28: error: ‘I2C_SMBUS_PROC_CALL’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_QUICK’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:136:28: error: ‘I2C_SMBUS_QUICK’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_READ’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:142:28: error: ‘I2C_SMBUS_READ’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_WORD_DATA’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:148:28: error: ‘I2C_SMBUS_WORD_DATA’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_const_I2C_SMBUS_WRITE’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:154:28: error: ‘I2C_SMBUS_WRITE’ undeclared (first use in this function)

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_check_union_i2c_smbus_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:161:12: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:162:12: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:163:33: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c: In function ‘_cffi_layout_union_i2c_smbus_data’:

smbus/pycache/_cffi__gd005eae8x42de6d31.c:167:58: error: field ‘y’ has incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:169:12: error: invalid application of ‘sizeof’ to incomplete type ‘union i2c_smbus_data’

smbus/pycache/_cffi__gd005eae8x42de6d31.c:171:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/pycache/_cffi__gd005eae8x42de6d31.c:172:39: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:173:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/pycache/_cffi__gd005eae8x42de6d31.c:174:39: error: dereferencing pointer to incomplete type

smbus/pycache/_cffi__gd005eae8x42de6d31.c:175:5: error: invalid use of undefined type ‘union i2c_smbus_data’

smbus/pycache/_cffi__gd005eae8x42de6d31.c:176:39: error: dereferencing pointer to incomplete type

Traceback (most recent call last):

File "app_main.py", line 72, in run_toplevel

File "app_main.py", line 578, in run_it

File "", line 16, in

File "/tmp/pip-NGDOQl-build/setup.py", line 7, in

import smbus

File "smbus/init.py", line 1, in

from .smbus import ffi

File "smbus/smbus.py", line 93, in

""", ext_package='smbus')

File "/usr/local/pypy/lib_pypy/cffi/api.py", line 339, in verify

lib = self.verifier.load_library()

File "/usr/local/pypy/lib_pypy/cffi/verifier.py", line 74, in load_library

self._compile_module()

File "/usr/local/pypy/lib_pypy/cffi/verifier.py", line 139, in _compile_module

outputfilename = ffiplatform.compile(tmpdir, self.get_extension())

File "/usr/local/pypy/lib_pypy/cffi/ffiplatform.py", line 25, in compile

outputfilename = _build(tmpdir, ext)

File "/usr/local/pypy/lib_pypy/cffi/ffiplatform.py", line 50, in _build

raise VerificationError('%s: %s' % (e.__class__.__name__, e))

VerificationError: CompileError: command 'cc' failed with exit status 1


Cleaning up...

Removing temporary dir /tmp/pip_build_root...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-NGDOQl-build

Exception information:
Traceback (most recent call last):
File "/usr/local/pypy/site-packages/pip/basecommand.py", line 134, in main
status = self.run(options, args)
File "/usr/local/pypy/site-packages/pip/commands/install.py", line 236, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/local/pypy/site-packages/pip/req.py", line 1134, in prepare_files
req_to_install.run_egg_info()
File "/usr/local/pypy/site-packages/pip/req.py", line 259, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/pypy/site-packages/pip/util.py", line 670, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip-NGDOQl-build

IOError 121 when using on Intel Edison

Hey there,

I'm getting the following error when trying to use the code for Intel Edison (LSM9DS0)

Traceback (most recent call last):
File "berryIMU.py", line 126, in
writeACC(CTRL_REG1_XM, 0b01100111) #z,y,x axis enabled, continuos update, 100Hz data rate
File "berryIMU.py", line 38, in writeACC
bus.write_byte_data(ACC_ADDRESS , register, value)
File "/usr/lib/python2.7/site-packages/smbus/util.py", line 59, in validator
return fn(_args, *_kwdefaults)
File "/usr/lib/python2.7/site-packages/smbus/smbus.py", line 145, in write_byte_data
raise IOError(ffi.errno)
IOError: 121

Any idea what's going on?

Slower than the python-smbus on Raspberry Pi

I tried this smbus package on my RPi with MCP23017, which has a photodiode module connected. Read the output from the photodiode(High/Low) continuously. The read performance is about 350Hz (calculated in my code). Change to the python-smbus, the read performance is about 560Hz.

IOError: Errno 110 Connection timed out

Hi,
I have a sensor in 0x50 adress and work correctly, but when I did a loop for a long time, the error appear (110).
For example, I put a while to see continuosly the data and the error appeared (after half minut), and now the sensor doesn't connected to the I2C bus. (with the comand i2cdetect -y 1 I don't see any sensor, that before, I've saw.
I've had to disconnect and connect to use it again, and when I do a number of reads, come back again the error, You know why?
Can you help me?

Code:

import smbus
while True:
bus = smbus.SMBus(1)
b = bus.read_byte_data(0x50,0)
print b
(with identation)

Python 3 Support – problem with installing through PIP

Im trying to install this package on arch arm (IMX-233) through pip. there seems to be a dependancy problem in building the package.


[root@alarm /]# pip install smbus-cffi
Downloading/unpacking smbus-cffi
Downloading smbus-cffi-0.3.2.tar.gz
Running setup.py (path:/tmp/pip_build_root/smbus-cffi/setup.py) egg_info for package smbus-cffi
Traceback (most recent call last):
File "", line 17, in
File "/tmp/pip_build_root/smbus-cffi/setup.py", line 7, in
import smbus
File "/tmp/pip_build_root/smbus-cffi/smbus/init.py", line 1, in
from .smbus import ffi
File "/tmp/pip_build_root/smbus-cffi/smbus/smbus.py", line 29, in
from util import validate
ImportError: No module named 'util'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 17, in

File "/tmp/pip_build_root/smbus-cffi/setup.py", line 7, in

import smbus

File "/tmp/pip_build_root/smbus-cffi/smbus/init.py", line 1, in

from .smbus import ffi

File "/tmp/pip_build_root/smbus-cffi/smbus/smbus.py", line 29, in

from util import validate

ImportError: No module named 'util'


Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/smbus-cffi
Storing debug log for failure in /root/.pip/pip.log

any assistance you can give would be awesome.

Hint

could you please add somewhere that for successfully installation one must first do

sudo apt-get install libi2c-dev i2c-tools build-essential

and then

pip install git+https://github.com/bivab/smbus-cffi.git

there are too few places in internet, where build-essential is mentioned

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.