adafruit / Adafruit_Blinka

Add CircuitPython hardware API and libraries to MicroPython & CPython devices
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
MIT License
453 stars 340 forks source link

Pip install fails on Beaglebone Black #596

Closed scirelli closed 2 years ago

scirelli commented 2 years ago

I found this page and it seemed like I could install Blinka on a BBB. When I tried I got the below errors.

Running:

It looks like it tries to install RPi.GPIO Raspberry Pi GPIO?

$ pip3 install Adafruit-Blinka
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting Adafruit-Blinka
  Downloading https://www.piwheels.org/simple/adafruit-blinka/Adafruit_Blinka-8.0.2-py3-none-any.whl (231 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 231.2/231.2 kB 503.1 kB/s eta 0:00:00
Collecting pyftdi>=0.40.0
  Downloading https://www.piwheels.org/simple/pyftdi/pyftdi-0.54.0-py3-none-any.whl (144 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 144.8/144.8 kB 410.9 kB/s eta 0:00:00
Collecting rpi-ws281x>=4.0.0
  Downloading rpi_ws281x-4.3.4.tar.gz (64 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.2/64.2 kB 923.1 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: Adafruit-PlatformDetect>=3.13.0 in /media/sdcard/home/cck/.pyenv/versions/3.10.4/lib/python3.10/site-packages (from Adafruit-Blinka) (3.24.1)
Collecting adafruit-circuitpython-typing
  Downloading https://www.piwheels.org/simple/adafruit-circuitpython-typing/adafruit_circuitpython_typing-1.7.1-py3-none-any.whl (9.2 kB)
Collecting Adafruit-PureIO>=1.1.7
  Downloading https://www.piwheels.org/simple/adafruit-pureio/Adafruit_PureIO-1.1.9-py3-none-any.whl (12 kB)
Collecting sysv-ipc>=1.1.0
  Downloading sysv_ipc-1.1.0.tar.gz (99 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.4/99.4 kB 1.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting RPi.GPIO
  Downloading RPi.GPIO-0.7.1.tar.gz (29 kB)
  Preparing metadata (setup.py) ... done
Collecting pyusb!=1.2.0,>=1.0.0
  Downloading https://www.piwheels.org/simple/pyusb/pyusb-1.2.1-py3-none-any.whl (58 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.4/58.4 kB 356.4 kB/s eta 0:00:00
Collecting pyserial>=3.0
  Downloading https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.6/90.6 kB 156.9 kB/s eta 0:00:00
Collecting adafruit-circuitpython-busdevice
  Downloading https://www.piwheels.org/simple/adafruit-circuitpython-busdevice/adafruit_circuitpython_busdevice-5.1.10-py3-none-any.whl (7.3 kB)
Building wheels for collected packages: rpi-ws281x, sysv-ipc, RPi.GPIO
  Building wheel for rpi-ws281x (setup.py) ... done
  Created wheel for sysv-ipc: filename=sysv_ipc-1.1.0-cp310-cp310-linux_armv7l.whl size=55284 sha256=1fa4e788fe84346b127d3de42e213ba96bcedaf2ae167a44612bf8721a6a28c5
  Stored in directory: /media/sdcard/home/cck/.cache/pip/wheels/d0/44/ea/b9041c5c17d02075484f7745c4d2db8c9b79af9c2cf8f82a23
  Building wheel for RPi.GPIO (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [48 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-armv7l-3.10
      creating build/lib.linux-armv7l-3.10/RPi
      copying RPi/__init__.py -> build/lib.linux-armv7l-3.10/RPi
      creating build/lib.linux-armv7l-3.10/RPi/GPIO
      copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-3.10/RPi/GPIO
      running build_ext
      building 'RPi._GPIO' extension
      creating build/temp.linux-armv7l-3.10
      creating build/temp.linux-armv7l-3.10/source
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/c_gpio.c -o build/temp.linux-armv7l-3.10/source/c_gp
io.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/common.c -o build/temp.linux-armv7l-3.10/source/comm
on.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/constants.c -o build/temp.linux-armv7l-3.10/source/c
onstants.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/cpuinfo.c -o build/temp.linux-armv7l-3.10/source/cpu
info.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/event_gpio.c -o build/temp.linux-armv7l-3.10/source/
event_gpio.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/py_gpio.c -o build/temp.linux-armv7l-3.10/source/py_
gpio.o
      source/py_gpio.c:87:4: error: function definition is not allowed here
         {
         ^
      source/py_gpio.c:143:10: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
               cleanup_one();
               ^
      source/py_gpio.c:172:13: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
                  cleanup_one();
                  ^
      source/py_gpio.c:200:24: error: function definition is not allowed here
         int setup_one(void) {
                             ^
      source/py_gpio.c:293:13: warning: implicit declaration of function 'setup_one' is invalid in C99 [-Wimplicit-function-declaration]
             if (!setup_one())
                  ^
      source/py_gpio.c:323:12: warning: implicit declaration of function 'setup_one' is invalid in C99 [-Wimplicit-function-declaration]
            if (!setup_one())
                 ^
      source/py_gpio.c:345:21: error: function definition is not allowed here
         int output(void) {
                          ^
      source/py_gpio.c:419:18: error: called object type 'PyObject *' (aka 'struct _object *') is not a function or function pointer
            if (!output())
                 ~~~~~~^
      source/py_gpio.c:475:18: error: called object type 'PyObject *' (aka 'struct _object *') is not a function or function pointer
            if (!output())
                 ~~~~~~^
      4 warnings and 5 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for RPi.GPIO
  Running setup.py clean for RPi.GPIO
Successfully built rpi-ws281x sysv-ipc
Failed to build RPi.GPIO
Installing collected packages: sysv-ipc, rpi-ws281x, RPi.GPIO, pyserial, pyusb, Adafruit-PureIO, pyftdi, adafruit-circuitpython-busdevice, adafruit-circuitpython-typing, Adafruit-Blinka
  Running setup.py install for RPi.GPIO ... error
  error: subprocess-exited-with-error

  × Running setup.py install for RPi.GPIO did not run successfully.
  │ exit code: 1
  ╰─> [48 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-armv7l-3.10
      creating build/lib.linux-armv7l-3.10/RPi
      copying RPi/__init__.py -> build/lib.linux-armv7l-3.10/RPi
      creating build/lib.linux-armv7l-3.10/RPi/GPIO
      copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-3.10/RPi/GPIO
      running build_ext
      building 'RPi._GPIO' extension
      creating build/temp.linux-armv7l-3.10
      creating build/temp.linux-armv7l-3.10/source
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/c_gpio.c -o build/temp.linux-armv7l-3.10/source/c_gp
io.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/common.c -o build/temp.linux-armv7l-3.10/source/comm
on.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/constants.c -o build/temp.linux-armv7l-3.10/source/constants.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/cpuinfo.c -o build/temp.linux-armv7l-3.10/source/cpuinfo.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/event_gpio.c -o build/temp.linux-armv7l-3.10/source/event_gpio.o
      clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/py_gpio.c -o build/temp.linux-armv7l-3.10/source/py_gpio.o
      source/py_gpio.c:87:4: error: function definition is not allowed here
         {
         ^
      source/py_gpio.c:143:10: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
               cleanup_one();
               ^
      source/py_gpio.c:172:13: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
                  cleanup_one();
                  ^
      source/py_gpio.c:200:24: error: function definition is not allowed here
         int setup_one(void) {
                             ^
      source/py_gpio.c:293:13: warning: implicit declaration of function 'setup_one' is invalid in C99 [-Wimplicit-function-declaration]
             if (!setup_one())
                  ^
      source/py_gpio.c:323:12: warning: implicit declaration of function 'setup_one' is invalid in C99 [-Wimplicit-function-declaration]
            if (!setup_one())
                 ^
      source/py_gpio.c:345:21: error: function definition is not allowed here
         int output(void) {
                          ^
      source/py_gpio.c:419:18: error: called object type 'PyObject *' (aka 'struct _object *') is not a function or function pointer
            if (!output())
                 ~~~~~~^
      source/py_gpio.c:475:18: error: called object type 'PyObject *' (aka 'struct _object *') is not a function or function pointer
            if (!output())
                 ~~~~~~^
      4 warnings and 5 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [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.
╰─> RPi.GPIO

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

Not sure if you need it but output from adafruit_platformdetect

Chip id:  AM33XX
Board id:  BEAGLEBONE_BLACK
Pi 3B+?  False
BBB?  True
Orange Pi PC?  False
generic Linux PC?  False
makermelissa commented 2 years ago

It should be able to run on it. Yeah, that's pretty strange that it tries to install RPi.GPIO, which it shouldn't.

scirelli commented 2 years ago

@makermelissa could you point me in a direction to fix this? Maybe I can contribute a patch?

scirelli commented 2 years ago

Is it as simple as being more specific about the architecture? https://github.com/adafruit/Adafruit_Blinka/blob/main/requirements.txt#L4

makermelissa commented 2 years ago

Here's the setup.py where it determines if RPi.GPIO needs to be installed: https://github.com/adafruit/Adafruit_Blinka/blob/main/setup.py#L25-L37 Offhand, I'm really not sure why it would be acting this way. It's possible BBB added something to say it's compatible with Broadcom chips for some reason, but that seems unlikely. For other files specific to the BBB, the board file is at https://github.com/adafruit/Adafruit_Blinka/blob/main/src/adafruit_blinka/board/beagleboard/beaglebone_black.py and the microcontroller files are here: https://github.com/adafruit/Adafruit_Blinka/tree/main/src/adafruit_blinka/microcontroller/am335x

scirelli commented 2 years ago

I'm not sure what changed but this time the install worked. I guess 10th time's the charm?

pipenv install Adafruit-Blinka
Installing Adafruit-Blinka...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
✔ Success!
Updated Pipfile.lock (98c947)!
Installing dependencies from Pipfile.lock (98c947)...
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00

Testing fails though. I attempted to import board, it failed, #599. I'm going to attempt another install on a second BBB.

scirelli commented 2 years ago

Install fails on the second BBB. I'm not sure what the difference is yet. They should be the exact same setup.

B1 (failed) Python 3.10.4 pip 22.1.2 from /tmp/t/.venv/lib/python3.10/site-packages/pip (python 3.10) pipenv, version 2022.4.30

#in venv
pip freeze 
rpi-ws281x==4.3.4
sysv-ipc==1.1.0
# no venv
# Even removing the extra packages did not help.
pip freeze
Adafruit-PlatformDetect==3.24.1
certifi==2021.10.8
distlib==0.3.4
filelock==3.6.0
pipenv==2022.4.30
platformdirs==2.5.2
rpi-ws281x==4.3.4
six==1.16.0
sysv-ipc==1.1.0
virtualenv==20.14.1
virtualenv-clone==0.5.7

B2 (succeeded) Python 3.10.4 pip 22.1.2 from /tmp/t2/.venv/lib/python3.10/site-packages/pip (python 3.10) pipenv, version 2022.7.24

pip freeze
Adafruit-Blinka==8.2.0
adafruit-circuitpython-busdevice==5.2.1
adafruit-circuitpython-typing==1.7.3
Adafruit-PlatformDetect==3.27.0
Adafruit-PureIO==1.1.9
pyftdi==0.54.0
pyserial==3.5
pyusb==1.2.1
rpi-ws281x==4.3.4
RPi.GPIO==0.7.1
sysv-ipc==1.1.0
typing_extensions==4.3.0
pipenv install -v Adafruit-Blinka
Installing Adafruit-Blinka...
Installing package: adafruit-blinka
Writing supplied requirement line to temporary file: 'adafruit-blinka'
⠏ Installing Adafruit-Blinka...$ /tmp/t/.venv/bin/python -m pip install --verbose --upgrade --exists-action=i -r /tmp/pipenv-5npr8mvs-requirements/pipenv-vzbsl83w-requirement.txt -i https://pypi.org/simple
Error:  An error occurred while installing Adafruit-Blinka!
Error text: Using pip 22.1.2 from /tmp/t/.venv/lib/python3.10/site-packages/pip (python 3.10)
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting adafruit-blinka 
  Using cached https://www.piwheels.org/simple/adafruit-blinka/Adafruit_Blinka-8.2.0-py3-none-any.whl (234 kB)
Collecting pyftdi>=0.40.0  
  Using cached https://www.piwheels.org/simple/pyftdi/pyftdi-0.54.0-py3-none-any.whl (144 kB)
Collecting adafruit-circuitpython-typing
  Using cached adafruit_circuitpython_typing-1.7.3-py3-none-any.whl (9.1 kB)
Collecting RPi.GPIO
  Using cached RPi.GPIO-0.7.1.tar.gz (29 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting Adafruit-PureIO>=1.1.7
  Using cached https://www.piwheels.org/simple/adafruit-pureio/Adafruit_PureIO-1.1.9-py3-none-any.whl (12 kB)
Requirement already satisfied: rpi-ws281x>=4.0.0 in ./.venv/lib/python3.10/site-packages (from adafruit-blinka->-r /tmp/pipenv-5npr8mvs-requirements/pipenv-vzbsl83w-requirement.txt (line 1)) (4.3.4)
Requirement already satisfied: sysv-ipc>=1.1.0 in ./.venv/lib/python3.10/site-packages (from adafruit-blinka->-r /tmp/pipenv-5npr8mvs-requirements/pipenv-vzbsl83w-requirement.txt (line 1)) (1.1.0)
Collecting Adafruit-PlatformDetect>=3.13.0
  Using cached https://www.piwheels.org/simple/adafruit-platformdetect/Adafruit_PlatformDetect-3.27.0-py3-none-any.whl (18 kB)
Collecting pyserial>=3.0   
  Using cached https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
Collecting pyusb!=1.2.0,>=1.0.0
  Using cached https://www.piwheels.org/simple/pyusb/pyusb-1.2.1-py3-none-any.whl (58 kB)
Collecting typing-extensions~=4.0
  Using cached https://www.piwheels.org/simple/typing-extensions/typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting adafruit-circuitpython-busdevice
  Using cached adafruit_circuitpython_busdevice-5.2.1-py3-none-any.whl (7.4 kB)
Building wheels for collected packages: RPi.GPIO
Building wheel for RPi.GPIO (setup.py): started
  Building wheel for RPi.GPIO (setup.py): finished with status 'error'
  Running setup.py clean for RPi.GPIO
Failed to build RPi.GPIO   
Installing collected packages: RPi.GPIO, pyserial, typing-extensions, pyusb, Adafruit-PureIO, Adafruit-PlatformDetect, pyftdi, adafruit-circuitpython-busdevice, adafruit-circuitpython-typing, adafruit-blinka
  Running setup.py install for RPi.GPIO: started
  Running setup.py install for RPi.GPIO: finished with status 'error'

  Running command python setup.py egg_info
  running egg_info
  creating /tmp/pip-pip-egg-info-q9uzbjmp/RPi.GPIO.egg-info
  writing /tmp/pip-pip-egg-info-q9uzbjmp/RPi.GPIO.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-pip-egg-info-q9uzbjmp/RPi.GPIO.egg-info/dependency_links.txt
  writing top-level names to /tmp/pip-pip-egg-info-q9uzbjmp/RPi.GPIO.egg-info/top_level.txt
  writing manifest file '/tmp/pip-pip-egg-info-q9uzbjmp/RPi.GPIO.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-pip-egg-info-q9uzbjmp/RPi.GPIO.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  no previously-included directories found matching '.hg'
  adding license file 'LICENCE.txt'
  writing manifest file '/tmp/pip-pip-egg-info-q9uzbjmp/RPi.GPIO.egg-info/SOURCES.txt'
  Running command python setup.py bdist_wheel
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-cpython-310
  creating build/lib.linux-armv7l-cpython-310/RPi
  copying RPi/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi
  creating build/lib.linux-armv7l-cpython-310/RPi/GPIO
  copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi/GPIO
  warning: build_py: byte-compiling is disabled, skipping.

running build_ext
  building 'RPi._GPIO' extension
  creating build/temp.linux-armv7l-cpython-310
  creating build/temp.linux-armv7l-cpython-310/source
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/c_gpio.c -o build/temp.linux-armv7l-cpython-310/source/c_gpio.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/common.c -o build/temp.linux-armv7l-cpython-310/source/common.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/constants.c -o build/temp.linux-armv7l-cpython-310/source/constants.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/cpuinfo.c -o build/temp.linux-armv7l-cpython-310/source/cpuinfo.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/event_gpio.c -o build/temp.linux-armv7l-cpython-310/source/event_gpio.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/py_gpio.c -o build/temp.linux-armv7l-cpython-310/source/py_gpio.o
  source/py_gpio.c:87:4: error: function definition is not allowed here
     {
     ^
  source/py_gpio.c:143:10: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
           cleanup_one();
           ^
  source/py_gpio.c:172:13: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
              cleanup_one();
              ^
  source/py_gpio.c:200:24: error: function definition is not allowed here
     int setup_one(void) {
                         ^
  source/py_gpio.c:293:13: warning: implicit declaration of function 'setup_one' is invalid in C99 [-Wimplicit-function-declaration]
         if (!setup_one())
              ^
  source/py_gpio.c:323:12: warning: implicit declaration of function 'setup_one' is invalid in C99 [-Wimplicit-function-declaration]
        if (!setup_one())
           ^
  source/py_gpio.c:345:21: error: function definition is not allowed here
     int output(void) {
                      ^
  source/py_gpio.c:419:18: error: called object type 'PyObject *' (aka 'struct _object *') is not a function or function pointer
        if (!output())
             ~~~~~~^
  source/py_gpio.c:475:18: error: called object type 'PyObject *' (aka 'struct _object *') is not a function or function pointer
        if (!output())
             ~~~~~~^
  4 warnings and 5 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /tmp/t/.venv/bin/python -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/tmp/pip-install-rn_4sg8m/rpi-gpio_d44d7209af364836a285969d70650a8d/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d /tmp/pip-wheel-b9qhektm
  cwd: /tmp/pip-install-rn_4sg8m/rpi-gpio_d44d7209af364836a285969d70650a8d/
  ERROR: Failed building wheel for RPi.GPIO
  Running command python setup.py clean
  running clean
  removing 'build/temp.linux-armv7l-cpython-310' (and everything under it)
  removing 'build/lib.linux-armv7l-cpython-310' (and everything under it)
  'build/bdist.linux-armv7l' does not exist -- can't clean it
  'build/scripts-3.10' does not exist -- can't clean it
  removing 'build'
  Running command Running setup.py install for RPi.GPIO
running install
  /tmp/t/.venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-cpython-310
  creating build/lib.linux-armv7l-cpython-310/RPi
  copying RPi/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi
  creating build/lib.linux-armv7l-cpython-310/RPi/GPIO
  copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi/GPIO
  warning: build_py: byte-compiling is disabled, skipping.

  running build_ext
  building 'RPi._GPIO' extension
  creating build/temp.linux-armv7l-cpython-310
  creating build/temp.linux-armv7l-cpython-310/source
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/c_gpio.c -o build/temp.linux-armv7l-cpython-310/source/c_gpio.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/common.c -o build/temp.linux-armv7l-cpython-310/source/common.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/constants.c -o build/temp.linux-armv7l-cpython-310/source/constants.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/cpuinfo.c -o build/temp.linux-armv7l-cpython-310/source/cpuinfo.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/event_gpio.c -o build/temp.linux-armv7l-cpython-310/source/event_gpio.o
  clang -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/t/.venv/include -I/media/sdcard/home/cck/.pyenv/versions/3.10.4/include/python3.10 -c source/py_gpio.c -o build/temp.linux-armv7l-cpython-310/source/py_gpio.o
  source/py_gpio.c:87:4: error: function definition is not allowed here
     {
     ^
  source/py_gpio.c:143:10: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
source/py_gpio.c:143:10: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
           cleanup_one();
           ^
  source/py_gpio.c:172:13: warning: implicit declaration of function 'cleanup_one' is invalid in C99 [-Wimplicit-function-declaration]
              cleanup_one();
              ^
  source/py_gpio.c:200:24: error: function definition is not allowed here
     int setup_one(void) {
                         ^
  source/py_gpio.c:293:13: warning: implicit declaration of function 'setup_one' is invalid in C99 [-Wimplicit-function-declaration]
         if (!setup_one())
              ^
  source/py_gpio.c:323:12: warning: implicit declaration of function 'setup_one' is invalid in C99 [-Wimplicit-function-declaration]
        if (!setup_one())
             ^
  source/py_gpio.c:345:21: error: function definition is not allowed here
     int output(void) {
                      ^
  source/py_gpio.c:419:18: error: called object type 'PyObject *' (aka 'struct _object *') is not a function or function pointer
        if (!output())
             ~~~~~~^
  source/py_gpio.c:475:18: error: called object type 'PyObject *' (aka 'struct _object *') is not a function or function pointer
        if (!output())
             ~~~~~~^
  4 warnings and 5 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1
  error: subprocess-exited-with-error

  × Running setup.py install for RPi.GPIO did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /tmp/t/.venv/bin/python -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/tmp/pip-install-rn_4sg8m/rpi-gpio_d44d7209af364836a285969d70650a8d/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' install --record /tmp/pip-record-zqokjdpr/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/t/.venv/include/site/python3.10/RPi.GPIO
  cwd: /tmp/pip-install-rn_4sg8m/rpi-gpio_d44d7209af364836a285969d70650a8d/
error: legacy-install-failure

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

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
⠹ Installing Adafruit-Blinka...Using pip 22.1.2 from /tmp/t/.venv/lib/python3.10/site-packages/pip (python 3.10)
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting adafruit-blinka
  Using cached https://www.piwheels.org/simple/adafruit-blinka/Adafruit_Blinka-8.2.0-py3-none-any.whl (234 kB)
Collecting pyftdi>=0.40.0
  Using cached https://www.piwheels.org/simple/pyftdi/pyftdi-0.54.0-py3-none-any.whl (144 kB)
Collecting adafruit-circuitpython-typing
  Using cached adafruit_circuitpython_typing-1.7.3-py3-none-any.whl (9.1 kB)
Collecting RPi.GPIO
  Using cached RPi.GPIO-0.7.1.tar.gz (29 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting Adafruit-PureIO>=1.1.7
  Using cached https://www.piwheels.org/simple/adafruit-pureio/Adafruit_PureIO-1.1.9-py3-none-any.whl (12 kB)
Requirement already satisfied: rpi-ws281x>=4.0.0 in ./.venv/lib/python3.10/site-packages (from adafruit-blinka->-r /tmp/pipenv-5npr8mvs-requirements/pipenv-vzbsl83w-requirement.txt (line 1)) (4.3.4)
Requirement already satisfied: sysv-ipc>=1.1.0 in ./.venv/lib/python3.10/site-packages (from adafruit-blinka->-r /tmp/pipenv-5npr8mvs-requirements/pipenv-vzbsl83w-requirement.txt (line 1)) (1.1.0)
Collecting Adafruit-PlatformDetect>=3.13.0
  Using cached https://www.piwheels.org/simple/adafruit-platformdetect/Adafruit_PlatformDetect-3.27.0-py3-none-any.whl (18 kB)
Collecting pyserial>=3.0
  Using cached https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
Collecting pyusb!=1.2.0,>=1.0.0
 Using cached https://www.piwheels.org/simple/pyusb/pyusb-1.2.1-py3-none-any.whl (58 kB)
Collecting typing-extensions~=4.0
  Using cached https://www.piwheels.org/simple/typing-extensions/typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting adafruit-circuitpython-busdevice
  Using cached adafruit_circuitpython_busdevice-5.2.1-py3-none-any.whl (7.4 kB)
Building wheels for collected packages: RPi.GPIO
  Building wheel for RPi.GPIO (setup.py): started
  Building wheel for RPi.GPIO (setup.py): finished with status 'error'
  Running setup.py clean for RPi.GPIO
Failed to build RPi.GPIO
Installing collected packages: RPi.GPIO, pyserial, typing-extensions, pyusb, Adafruit-PureIO, Adafruit-PlatformDetect, pyftdi, adafruit-circuitpython-busdevice, adafruit-circuitpython-typing, adafruit-blinka
  Running setup.py install for RPi.GPIO: started
  Running setup.py install for RPi.GPIO: finished with status 'error'

✘ Installation Failed

I attempted to clean pipenv cache pipenv --clear. Same error. I'm going to install with straight pip install ... should not make a difference but going to try anyway.

makermelissa commented 2 years ago

I'm glad you were able to get one working at least. My guess is you installed something it needed when playing around. Which Beaglebone images do you have installed on those?

scirelli commented 2 years ago

Yeah, the board that does not work is the one I've been playing around with, and testing things. I must have installed something that is causing a problem.

But, even on the board where Blinka does install, attempting to use Blinka fails.

Umm I can't remember now exactly which one it is. But I used one of the eMMC flasher images

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

I guess a version of this

Buster IoT (without graphical desktop) for BeagleBone on-board eMMC flashing via microSD card AM3358 Debian 10.3 2020-04-06 4GB eMMC IoT Flasher image for BeagleBone, BeagleBone Black, BeagleBone Black Wireless, BeagleBone Blue, SeeedStudio BeagleBone Green, SeeedStudio BeagleBone Green Wireless, SanCloud BeagleBone Enhanced, element14 BeagleBone Black Industrial, Arrow BeagleBone Black Industrial and Mentorel BeagleBone uSomIQ - more info - sha256sum: e339459077b83f6458cb3432494954582aedad897b9f3b62fa390dfdb010a9df

scirelli commented 2 years ago

A little progress. On the BBB where the installed failed I switched to using the system Python (3.7.3) and the install succeeded. I am going to uninstall 3.10.4 and reinstall it. See if that helps.

With Python 3.7.3 on the board that failed, I'm at the same point. Blinka fails with

 import board
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/d/.venv/lib/python3.7/site-packages/board.py", line 62, in <module>
    from adafruit_blinka.board.beagleboard.beaglebone_black import *
  File "/tmp/d/.venv/lib/python3.7/site-packages/adafruit_blinka/board/beagleboard/beaglebone_black.py", line 5, in <module>
    from adafruit_blinka.microcontroller.am335x import pin
  File "/tmp/d/.venv/lib/python3.7/site-packages/adafruit_blinka/microcontroller/am335x/pin.py", line 5, in <module>
    from Adafruit_BBIO import GPIO
ModuleNotFoundError: No module named 'Adafruit_BBIO'
scirelli commented 2 years ago

By manually installing Adafruit_BBIO I was able to run the previously failing tests from the docs

import board
dir(board)
scirelli commented 2 years ago

I'm going to close this issue as it looks like it was just something messed up with my Python install.