Skip to content

Import issue #2

Open
Open

Description

@aklofas

Follow steps:

  1. python3 setup.py install
  2. No issues on compile/install
  3. import ASUS.GPIO
    Traceback (most recent call last):
    File "", line 1, in
    ImportError: No module named 'ASUS.GPIO'

Same output using python2.7 as well.

Activity

  1. rbuffat commented on Mar 1, 2018

    @rbuffat

    This message indicates that the module ASUS.GPIO is not installed. Can you post the output of
    sudo python3 setup.py install

  2. farzadsw commented on May 19, 2018

    @farzadsw

    I have same problem. this is out put of setup.py:
    linaro@tinkerboard:~/gpio_lib_python$ sudo python3 setup.py install
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.5
    creating build/lib.linux-armv7l-3.5/ASUS
    copying ASUS/init.py -> build/lib.linux-armv7l-3.5/ASUS
    running build_ext
    building 'ASUS.GPIO' extension
    creating build/temp.linux-armv7l-3.5
    creating build/temp.linux-armv7l-3.5/source
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/py_gpio.c -o build/temp.linux-armv7l-3.5/source/py_gpio.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/c_gpio.c -o build/temp.linux-armv7l-3.5/source/c_gpio.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/cpuinfo.c -o build/temp.linux-armv7l-3.5/source/cpuinfo.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/event_gpio.c -o build/temp.linux-armv7l-3.5/source/event_gpio.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/soft_pwm.c -o build/temp.linux-armv7l-3.5/source/soft_pwm.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/py_pwm.c -o build/temp.linux-armv7l-3.5/source/py_pwm.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/common.c -o build/temp.linux-armv7l-3.5/source/common.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/constants.c -o build/temp.linux-armv7l-3.5/source/constants.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/wiringTB.c -o build/temp.linux-armv7l-3.5/source/wiringTB.o
    arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.5/source/py_gpio.o build/temp.linux-armv7l-3.5/source/c_gpio.o build/temp.linux-armv7l-3.5/source/cpuinfo.o build/temp.linux-armv7l-3.5/source/event_gpio.o build/temp.linux-armv7l-3.5/source/soft_pwm.o build/temp.linux-armv7l-3.5/source/py_pwm.o build/temp.linux-armv7l-3.5/source/common.o build/temp.linux-armv7l-3.5/source/constants.o build/temp.linux-armv7l-3.5/source/wiringTB.o -o build/lib.linux-armv7l-3.5/ASUS/GPIO.cpython-35m-arm-linux-gnueabihf.so
    running install_lib
    creating /usr/local/lib/python3.5/dist-packages/ASUS
    copying build/lib.linux-armv7l-3.5/ASUS/init.py -> /usr/local/lib/python3.5/dist-packages/ASUS
    copying build/lib.linux-armv7l-3.5/ASUS/GPIO.cpython-35m-arm-linux-gnueabihf.so -> /usr/local/lib/python3.5/dist-packages/ASUS
    byte-compiling /usr/local/lib/python3.5/dist-packages/ASUS/init.py to init.cpython-35.pyc
    running install_egg_info
    Writing /usr/local/lib/python3.5/dist-packages/ASUS.GPIO-0.1.egg-info
    running install
    running build
    running build_py
    creating build/lib.linux-armv7l-3.5/RPi
    copying RPi/init.py -> build/lib.linux-armv7l-3.5/RPi
    running build_ext
    building 'RPi.GPIO' extension
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/py_gpio_RPi.c -o build/temp.linux-armv7l-3.5/source/py_gpio_RPi.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/c_gpio.c -o build/temp.linux-armv7l-3.5/source/c_gpio.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/cpuinfo.c -o build/temp.linux-armv7l-3.5/source/cpuinfo.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/event_gpio.c -o build/temp.linux-armv7l-3.5/source/event_gpio.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/soft_pwm.c -o build/temp.linux-armv7l-3.5/source/soft_pwm.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/py_pwm.c -o build/temp.linux-armv7l-3.5/source/py_pwm.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/common.c -o build/temp.linux-armv7l-3.5/source/common.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/constants.c -o build/temp.linux-armv7l-3.5/source/constants.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c source/wiringTB.c -o build/temp.linux-armv7l-3.5/source/wiringTB.o
    arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fdebug-prefix-map=/build/python3.5-haFsHd/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv7l-3.5/source/py_gpio_RPi.o build/temp.linux-armv7l-3.5/source/c_gpio.o build/temp.linux-armv7l-3.5/source/cpuinfo.o build/temp.linux-armv7l-3.5/source/event_gpio.o build/temp.linux-armv7l-3.5/source/soft_pwm.o build/temp.linux-armv7l-3.5/source/py_pwm.o build/temp.linux-armv7l-3.5/source/common.o build/temp.linux-armv7l-3.5/source/constants.o build/temp.linux-armv7l-3.5/source/wiringTB.o -o build/lib.linux-armv7l-3.5/RPi/GPIO.cpython-35m-arm-linux-gnueabihf.so
    running install_lib
    creating /usr/local/lib/python3.5/dist-packages/RPi
    copying build/lib.linux-armv7l-3.5/RPi/init.py -> /usr/local/lib/python3.5/dist-packages/RPi
    copying build/lib.linux-armv7l-3.5/RPi/GPIO.cpython-35m-arm-linux-gnueabihf.so -> /usr/local/lib/python3.5/dist-packages/RPi
    byte-compiling /usr/local/lib/python3.5/dist-packages/RPi/init.py to init.cpython-35.pyc
    running install_egg_info
    Writing /usr/local/lib/python3.5/dist-packages/RPi.GPIO-0.1.egg-info

  3. farzadsw commented on May 19, 2018

    @farzadsw

    I checked the build directory, the module is created . After I manually copied the module file to my path it worked. So i guess the install script needs to be fixed.

  4. scorpiochang commented on Jul 27, 2018

    @scorpiochang
    Contributor

    Hi farzadsw

    i just install gpio_lib_python and run test program. i don't observe any error message.
    can i know what program you can't execute before you copy module files?
    thank you.

  5. cr1901 commented on Jul 14, 2020

    @cr1901

    This is an old issue, but might as well respond with what worked for me:

    If you try to import ASUS.GPIO from within the gpio_lib_python source directory root, python will think the module you want to import is at the wrong place:

    wjones@DietPi:~/src/tinker/gpio_lib_python$ python3 -c 'import ASUS; print(ASUS.__path__)'
    ['/home/wjones/src/tinker/gpio_lib_python/ASUS']
    wjones@DietPi:~/src/tinker/gpio_lib_python$ python3 -c 'import ASUS.GPIO'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'ASUS.GPIO'
    

    Outside of the source directory, however, python will pick up the correct module if you've ran setup.py install, and import ASUS.GPIO will succeed:

    wjones@DietPi:~/src/tinker$ python3 -c 'import ASUS; print(ASUS.__path__)'
    ['/usr/local/lib/python3.7/dist-packages/ASUS']
    wjones@DietPi:~/src/tinker$ python3 -c 'import ASUS.GPIO'
    wjones@DietPi:~/src/tinker$
    

    Solution for me was to not test the library from within the gpio_lib_python directory.

  6. ZongXR commented on Dec 18, 2023

    @ZongXR

    This is an old issue, but might as well respond with what worked for me:

    If you try to import ASUS.GPIO from within the gpio_lib_python source directory root, python will think the module you want to import is at the wrong place:

    wjones@DietPi:~/src/tinker/gpio_lib_python$ python3 -c 'import ASUS; print(ASUS.__path__)'
    ['/home/wjones/src/tinker/gpio_lib_python/ASUS']
    wjones@DietPi:~/src/tinker/gpio_lib_python$ python3 -c 'import ASUS.GPIO'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'ASUS.GPIO'
    

    Outside of the source directory, however, python will pick up the correct module if you've ran setup.py install, and import ASUS.GPIO will succeed:

    wjones@DietPi:~/src/tinker$ python3 -c 'import ASUS; print(ASUS.__path__)'
    ['/usr/local/lib/python3.7/dist-packages/ASUS']
    wjones@DietPi:~/src/tinker$ python3 -c 'import ASUS.GPIO'
    wjones@DietPi:~/src/tinker$
    

    Solution for me was to not test the library from within the gpio_lib_python directory.

    Great! That's usefule for me. Thank you very much.

  7. Baiokis commented on Dec 29, 2023

    @Baiokis

    I have the same problem, someone can help me?

    Traceback (most recent call last):
    File "c:\Users\alexa\OneDrive\Documentos\BM Tech\TinkerBoard\gpio_lib_python\test\GPIO_IN_OUT_test.py", line 2, in
    import ASUS.GPIO as GPIO
    ModuleNotFoundError: No module named 'ASUS'

    I already install every dependence and others packages

  8. ZongXR commented on Jan 24, 2024

    @ZongXR

    I have the same problem, someone can help me?

    Traceback (most recent call last): File "c:\Users\alexa\OneDrive\Documentos\BM Tech\TinkerBoard\gpio_lib_python\test\GPIO_IN_OUT_test.py", line 2, in import ASUS.GPIO as GPIO ModuleNotFoundError: No module named 'ASUS'

    I already install every dependence and others packages

    You should manually modify setup.py. Retain just one setup function and delete another. And then install like this.
    sudo python setup.py install # for python2
    sudo pip3 install . # for python3, and notice the dot at the end
    I tried this successfully

  9. ismirgibmir commented on Apr 13, 2025

    @ismirgibmir

    I reject this solution fix the install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions