ImportError No Module named grovepi

  • Hallo

    Ich habe mir einen GrovePi+ gekauft und ihn über diese Seite installiert

    https://www.dexterindustries.com/GrovePi/get-st…tting-software/

    Das hat auch alles Funktioniert also habe ich mir noch 3 weitere GrovePi´s bestellt
    Dann bin nach der folgenden Seite vorgegangen

    https://www.dexterindustries.com/GrovePi/progra…vepis-together/

    Wenn ich dann sudo i2cdetect -y 1 eingebe kommt folgendes bei heraus


    Code
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          03 04 05 06 -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --


    Also denke ich das der Pi die Platinen richtig erkannt hat
    aber beim Befehl import grovepi oder grovepi3 kommt die fehlermeldung

    ImportError No Module named grovepi

    habe mir dann die Seite http://forum.dexterindustries.com/t/no-module-na…vepi-solved/382 angeschaut.
    Komme jetzt aber nicht weiter habe auch den Befehl sudo python setup.py install ausgeführt.
    Aber bekomme immernoch diese Fehlermeldung

    Vielleicht kann mir ja jemand helfen

    Ich glaube eine Lösung gefunden zu haben, wenn ich richtig liege habe ich das ganze für Python2 installiert denn ich habe dieses Script gefunden für Python3

    [code=php]#!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    from setuptools import setup


    setup(
    name='grovepi-python3',
    description='More pythonized version of GrovePis python module rewritten for python3',
    version='0.1.0',
    url='https://github.com/elnappo/GrovePi-python3',
    license='MIT',
    author='elnappo',
    author_email='elnappo@nerdpol.io',
    keywords='grovepi i2c',
    platforms='any',
    py_modules=['grovepi'],
    scripts=['grovepi-cli.py'],
    install_requires=['RPi.GPIO'],
    classifiers=[
    'Development Status :: 4 - Beta',
    'Environment :: Console',
    'License :: OSI Approved :: MIT License',
    'Operating System :: OS Independent',
    'Programming Language :: Python',
    'Programming Language :: Python :: 3',
    'Topic :: Software Development :: Libraries',
    'Topic :: Utilities',
    ],
    )[/php]

    Kann ich jetzt dieses Script durch das alte in der datei setup.py ersetzen ?

    mfg sönke

    Einmal editiert, zuletzt von Challanger72 (9. Dezember 2016 um 23:01)

  • Programmieren ist nicht "Dinge ineinander kloppen & hoffen, dass sie gehen". So etwas funktioniert mit Ton. Oder Salzteig. Aber nicht mit Code. Was du da oben zeigst, die setup.py fuer Python 3, gehoert doch zu einem Repo. Steht sogar drin in der setup.py - https://github.com/elnappo/GrovePi-python3

    Das musst du clonen, und da rein wechseln. Und dann "sudo python3 setup.py install" aufrufen.

  • Repo ist ein Github repository, und das musst du clonen - in deiner Anleitung ist auch ein git clone gewesen, nur eben fuer ein anderes Repo. Und wenn es kopieren waere, hiesse es copy, nicht clone.

  • [code=php]
    pi@raspberrypi:~/webserver$ sudo -i
    root@raspberrypi:~# cd /usr/src/
    root@raspberrypi:/usr/src# git clone https://github.com/elnappo/GrovePi-python3
    Cloning into 'GrovePi-python3'...
    remote: Counting objects: 15, done.
    remote: Total 15 (delta 0), reused 0 (delta 0), pack-reused 15
    Unpacking objects: 100% (15/15), done.
    Checking connectivity... done.
    root@raspberrypi:/usr/src# ls
    ffmpeg GrovePi-python3
    root@raspberrypi:/usr/src# cd GrovePi-python3/
    root@raspberrypi:/usr/src/GrovePi-python3# ls
    grovepi-cli.py grovepi.py LICENSE README.md setup.py
    root@raspberrypi:/usr/src/GrovePi-python3# python3 setup.py install
    running install
    Checking .pth file support in /usr/local/lib/python3.4/dist-packages/
    /usr/bin/python3 -E -c pass
    TEST PASSED: /usr/local/lib/python3.4/dist-packages/ appears to support .pth files
    running bdist_egg
    running egg_info
    creating grovepi_python3.egg-info
    writing top-level names to grovepi_python3.egg-info/top_level.txt
    writing grovepi_python3.egg-info/PKG-INFO
    writing dependency_links to grovepi_python3.egg-info/dependency_links.txt
    writing requirements to grovepi_python3.egg-info/requires.txt
    writing manifest file 'grovepi_python3.egg-info/SOURCES.txt'
    reading manifest file 'grovepi_python3.egg-info/SOURCES.txt'
    writing manifest file 'grovepi_python3.egg-info/SOURCES.txt'
    installing library code to build/bdist.linux-armv7l/egg
    running install_lib
    running build_py
    creating build
    creating build/lib
    copying grovepi.py -> build/lib
    creating build/bdist.linux-armv7l
    creating build/bdist.linux-armv7l/egg
    copying build/lib/grovepi.py -> build/bdist.linux-armv7l/egg
    byte-compiling build/bdist.linux-armv7l/egg/grovepi.py to grovepi.cpython-34.pyc
    creating build/bdist.linux-armv7l/egg/EGG-INFO
    installing scripts to build/bdist.linux-armv7l/egg/EGG-INFO/scripts
    running install_scripts
    running build_scripts
    creating build/scripts-3.4
    copying and adjusting grovepi-cli.py -> build/scripts-3.4
    changing mode of build/scripts-3.4/grovepi-cli.py from 644 to 755
    creating build/bdist.linux-armv7l/egg/EGG-INFO/scripts
    copying build/scripts-3.4/grovepi-cli.py -> build/bdist.linux-armv7l/egg/EGG-INFO/scripts
    changing mode of build/bdist.linux-armv7l/egg/EGG-INFO/scripts/grovepi-cli.py to 755
    copying grovepi_python3.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
    copying grovepi_python3.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
    copying grovepi_python3.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
    copying grovepi_python3.egg-info/requires.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
    copying grovepi_python3.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
    zip_safe flag not set; analyzing archive contents...
    creating dist
    creating 'dist/grovepi_python3-0.1.0-py3.4.egg' and adding 'build/bdist.linux-armv7l/egg' to it
    removing 'build/bdist.linux-armv7l/egg' (and everything under it)
    Processing grovepi_python3-0.1.0-py3.4.egg
    Copying grovepi_python3-0.1.0-py3.4.egg to /usr/local/lib/python3.4/dist-packages
    Adding grovepi-python3 0.1.0 to easy-install.pth file
    Installing grovepi-cli.py script to /usr/local/bin

    Installed /usr/local/lib/python3.4/dist-packages/grovepi_python3-0.1.0-py3.4.egg
    Processing dependencies for grovepi-python3==0.1.0
    Searching for RPi.GPIO==0.6.3
    Best match: RPi.GPIO 0.6.3
    Adding RPi.GPIO 0.6.3 to easy-install.pth file

    Using /usr/local/lib/python3.4/dist-packages
    Finished processing dependencies for grovepi-python3==0.1.0
    root@raspberrypi:/usr/src/GrovePi-python3# cd
    root@raspberrypi:~# python3
    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.
    >>> import grovepi
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/local/lib/python3.4/dist-packages/grovepi_python3http://-0.1.0-py3.4.egg/grovepi.py", line 29, in <module>
    ImportError: No module named 'smbus'
    >>>
    [/php]

    Es funktioniert definitiv. Der Error bei mir ist ein anderer, es fehlt nur ein Module welches von grovepi benötigt wird. "pysmbus" installieren und das wars dann auch schon.


    PS: Sourcecodes legt man üblicherweise immer in /usr/src/ ab

  • Einmal editiert, zuletzt von Challanger72 (11. Dezember 2016 um 17:10)

  • Wie kommst du auf 'grovepi3' ? :s

    Es gibt nur ein Module 'grovepi' ... Das du dann mit python3 lädst.

    Dateiname des Modules ist https://github.com/elnappo/GroveP…ster/grovepi.py ... 'grovepi' ohne 3

  • Das "multi_installer.sh" Script was auf der dexterindustries.com beschrieben wird macht nichts anderes als die I2C Adresse in der grovepi.py Datei zu ändern und eine angepasste Firmware zu flashen.
    Die grovepi.py Dateien unterscheiden sich wirklich nur in der "address" Zeile.

    Der Unterschied in der Firmware ist ebenfalls nur die jeweils verwendete I2C Adresse => https://github.com/DexterInd/Grov…_v1_2_7.ino#L14

    Ich würde an deiner Stelle es also lieber bei nur einem Module belassen: grovepi.py
    Und stattdessen die jeweiligen Aufrufe mit einer anderen I2C_ADDRESS versehen.

  • so ich komm wieder nicht weiter

    Habe dieses Script geschrieben

    [code=php]import smbus
    import time

    bus = smbus.SMBus(1)

    bus.write_byte_data(0x03, 0x00, 0x00)
    bus.write_byte_data(0x03, 0x01, 0x00)

    bus.write_byte_data(0x03, 0x14, 0xff)
    bus.write_byte_data(0x03, 0x15, 0xff)

    bus.write_byte_data(0x04, 0x00, 0x00)
    bus.write_byte_data(0x04, 0x01, 0x00)

    bus.write_byte_data(0x04, 0x14, 0xff)
    bus.write_byte_data(0x04, 0x15, 0xff)
    [/php]

    Wobei der bus halt den bus 1 anspricht

    0x03 ist die adresse vom grovepi3
    0x00 bezieht sich auf die IODIRA und 0x01 IODIRB
    0x00 Damit setze ich alle Pins auf ausgang

    bei 0x14 und 0x15 spreche ich die OLATA und OLATB an
    mit 0xff setze ich alle Pins auf 1

    Ich bekomme keine Fehlermeldung allerdings Schaltet dort auch nix

    was kann ich noch machen ?


    Ok ich beende das jetzt hier
    Habe mir MCP 23017 geholt

    Einmal editiert, zuletzt von Challanger72 (15. Dezember 2016 um 19:45)

Jetzt mitmachen!

Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!