BME280 and SGP30 with Raspberry Pi Pico

Hi,
I am new to the hardware devices, I am currently doing a raspberry pi pico data logging, and I am using Raspberry Pi Pico and BME280 (breakout BME280) sensor by pimoroni, I am getting errors as below when I tried !pip install pimoroni-bme280 smBus
inside Thonny as there is no other way to interact with Pip :


Defaulting to user installation because normal site-packages is not writeable
Collecting pimoroni-bme280
  Using cached pimoroni_bme280-0.1.1-py3-none-any.whl (5.5 kB)
Collecting smBus
  Using cached smbus-1.1.post2.tar.gz (104 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting i2cdevice>=0.0.6
  Using cached i2cdevice-0.0.7-py3-none-any.whl (7.2 kB)
Building wheels for collected packages: smBus
  Building wheel for smBus (setup.py): started
  Building wheel for smBus (setup.py): finished with status '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: [WinError 2] The system cannot find the file specified
      [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
Installing collected packages: smBus, i2cdevice, pimoroni-bme280
  Running setup.py install for smBus: started
  Running setup.py install for smBus: finished with status 'error'
  error: subprocess-exited-with-error
  
  × Running setup.py install for smBus did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      running install
      running build
      running build_ext
      building 'i2c' library
      error: [WinError 2] The system cannot find the file specified
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> smBus

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

AND, This below, for SGP30:

>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "/lib/sgp30/__init__.py", line 1, in <module>
  File "/lib/sgp30/sgp30.py", line 1, in <module>
  File "/lib/smbus2/__init__.py", line 23, in <module>
  File "/lib/smbus2/smbus2.py", line 25, in <module>
  File "/lib/fcntl.py", line 1, in <module>
  File "/lib/ffi.py", line 39, in <module>
  File "/lib/ffi.py", line 43, in DynMod
AttributeError: 'module' object has no attribute 'c_char_p'

I think you’re trying to install Python drivers there which I suspect is why it’s not working, you need MicroPython drivers for the Pico.

Our batteries included MicroPython build has drivers for most breakouts baked in. You can download it from here and there’s a guide on how to install it here.

BME280 example: pimoroni-pico/demo_bme280.py at main · pimoroni/pimoroni-pico · GitHub
SGP30 example: pimoroni-pico/demo.py at main · pimoroni/pimoroni-pico · GitHub