Search code examples
pythonpython-3.xpipsmbus

Error installing smbus module with Python 3.10


I have Ubuntu running on Raspberry Pi and Python 3.10 installed on it. In my attempt to add smbus library I get next error:

pi@raspberrypi:~$ python3 -m pip install smbus
Defaulting to user installation because normal site-packages is not writeable
Collecting smbus
  Using cached smbus-1.1.post2.tar.gz (104 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: smbus
  Building wheel for smbus (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'i2c' library
      error: [Errno 2] No such file or directory: 'make'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for smbus
  Running setup.py clean for smbus
Failed to build smbus

I suppose, that I should install some package which will help to build i2c library, but what package it should be?

Attempt to run sudo python3 -m pip install smbus don't bring much help:

pi@raspberrypi:~$ sudo python3 -m pip install smbus
/usr/bin/python3: No module named pip

Solution

  • I had solved the problem by next installations:

    sudo apt-get install build-essential
    

    for make

    sudo apt install libpython3.10-dev
    

    fir source files.