Home>

I need the Encoder library. And it is even among the installed modules. However, when I importfrom Encoder.params_data import *I get the error:

ModuleNotFoundError: No module named 'RPi'

Next I'm trying to installRPibut I get the following notification:

WARNING: Ignoring invalid distribution -rpcio (c: \ users \ zlatt \ anaconda3 \ lib \ site-packages) ERROR: Could not find a version that satisfies the requirement RPi (from versions: none) ERROR: No matching distribution found for RPi

Thought thatRPiRequires Python 3.8 (I now have 3.7.6, and pip is version 21.3.1), but it failed to install -many hours of testing conflicting dependencies had to be stopped. Although, perhaps the Python version has nothing to do with it.

The following command didn't help either -it gives the same WARNING about -rpcio and ERROR about requirement RPi:

pip install python3-rpi.gpio

Same warning about ignoring invalid -rpcio when using the command:

pip install RPi.GPIO

When installing grpcio, I see that it is there, although the warning about ignoring -rpcio appears again.

So far, all attempts are in vain. Perhaps your colleagues will help you solve the problem?

I dug more carefully, both libraries are intended for RaspberryPi. The documentation lists OC as Linux. Plus, the RPi works with actual GPIO pins, which you can't have on a production machine. Install on RaspberryPi and test in that environment

Dmitry2022-01-06 07:50:41

@Dmitry thanks -I did it for the second day, although, apparently, for a standard computer with Windows this is an unsolvable task. Thank you again

Алексей Казанцев2022-01-06 08:06:50

See the answer, I tricked Encoder a bit. And I started import. But these are crutches and an eternal search for bugs.

Dmitry2022-01-06 08:08:19
  • Answer # 1

    Libraries are intended forRaspberryPiand are not designed to work from a local machine. BUT it is possible to get around your warnings and errors. My sequence looked like this. Installed on Win 10, Python 3.9.6.

    1. First and foremost: created a virtual space and activated it
    py -m venv env
    env \ Scripts \ activate
    
    1. Installing the Encoder we need
    pip install Encoder
    
    1. Check what is swearing at
    import Encoder
    "" "
        import RPi.GPIO as GPIO
    ModuleNotFoundError: No module named 'RPi'
    "" "
    
    1. Next to folderenvcreated a folderRPiand put two files in it__init__.pyandGPIO.py...GPIO.py-empty, and for__init__.pyfound content from amateurs here
    #__ init__.py
    BOARD= 1
    OUT= 1
    IN= 1
    def setmode (a):
       print (a)
    def setup (a, b):
       print (a)
    def output (a, b):
       print (a)
    def cleanup ():
       print ('a')
    def setwarnings (flag):
       print (False)
    
    1. Run, check
    >
    >
    >
     import Encoder
    >
    >
    >
     dir (Encoder)
    ['Encoder', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'encoder']
    

    I don't really understand the scenario of using this library, but I'll say right away thatEncoderdoes not contain a method or fieldparams_data

  • Answer # 2

    Libraries are intended forRaspberryPiand are not designed to work from a local machine. BUT it is possible to get around your warnings and errors. My sequence looked like this. Installed on Win 10, Python 3.9.6.

    1. First and foremost: created a virtual space and activated it
    py -m venv env
    env \ Scripts \ activate
    
    1. Installing the Encoder we need
    pip install Encoder
    
    1. Check what is swearing at
    import Encoder
    "" "
        import RPi.GPIO as GPIO
    ModuleNotFoundError: No module named 'RPi'
    "" "
    
    1. Next to folderenvcreated a folderRPiand put two files in it__init__.pyandGPIO.py...GPIO.py-empty, and for__init__.pyfound content from amateurs here
    #__ init__.py
    BOARD= 1
    OUT= 1
    IN= 1
    def setmode (a):
       print (a)
    def setup (a, b):
       print (a)
    def output (a, b):
       print (a)
    def cleanup ():
       print ('a')
    def setwarnings (flag):
       print (False)
    
    1. Run, check
    >
    >
    >
     import Encoder
    >
    >
    >
     dir (Encoder)
    ['Encoder', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'encoder']
    

    I don't really understand the scenario of using this library, but I'll say right away thatEncoderdoes not contain a method or fieldparams_data