explodinglabs / jsonrpcclient

Generate JSON-RPC requests and parse responses in Python

Home Page:https://www.jsonrpcclient.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'jsonrpcclient.clients'

sameerlal opened this issue · comments

I'm am getting the error:

ModuleNotFoundError: No module named 'jsonrpcclient.clients'
any idea why this might occur?

The code I am running to produce this is (python 3.8):

!pip3 install jsonrpcclient
import jsonrpcclient.clients

commented

Use this:

from jsonrpcclient.clients.aiohttp_client import AiohttpClient

Use this:

from jsonrpcclient.clients.aiohttp_client import AiohttpClient
gives same problem

----> 4 from jsonrpcclient.clients.aiohttp_client import AiohttpClient
      5 
      6 

ModuleNotFoundError: No module named 'jsonrpcclient.clients'

commented

I can't reproduce this in my environment

/tmp
$ mkvirtualenv -p $(which python3.8) test-jsonrpcclient
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.8'
New python executable in /Users/beau/.virtualenvs/test-jsonrpcclient/bin/python3.8
Also creating executable in /Users/beau/.virtualenvs/test-jsonrpcclient/bin/python
Installing setuptools, pip, wheel...done.
(test-jsonrpcclient) /tmp
$ pip3 install "jsonrpcclient[aiohttp]"
Collecting jsonrpcclient[aiohttp]
  Using cached https://files.pythonhosted.org/packages/22/50/4b24fd69151011ffbffe469fdd24da8cdc6eb6cad4dfe2771a062779230f/jsonrpcclient-3.3.4.tar.gz
Processing
-- snip --
(test-jsonrpcclient) /tmp
$ python
Python 3.8.0b1 (v3.8.0b1:3b5deb0116, Jun  4 2019, 14:39:11)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Shell Enhancement module problem: No module named 'gnureadline'
>>> import jsonrpcclient.clients
>>> 
commented

I've made a new release (3.3.5) with more consistent file permissions, try now?

I've made a new release (3.3.5) with more consistent file permissions, try now?

Still same issue. I'm using Google Colab to test with Python 3. I have also tried on mac os. See below:

Mac OS:

l$ which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
$ pip3 install "jsonrpcclient[aiohttp]"
Requirement already satisfied: jsonrpcclient[aiohttp] in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (2.0.1)
  WARNING: jsonrpcclient 2.0.1 does not provide the extra 'aiohttp'
Requirement already satisfied: jsonschema in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonrpcclient[aiohttp]) (3.2.0)
Requirement already satisfied: future in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonrpcclient[aiohttp]) (0.18.2)
Requirement already satisfied: pyrsistent>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonschema->jsonrpcclient[aiohttp]) (0.15.5)
Requirement already satisfied: attrs>=17.4.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonschema->jsonrpcclient[aiohttp]) (19.3.0)
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonschema->jsonrpcclient[aiohttp]) (41.2.0)
Requirement already satisfied: six>=1.11.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonschema->jsonrpcclient[aiohttp]) (1.12.0)
$ python3
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import jsonrpcclient.clients
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'jsonrpcclient.clients'
>>> 

on google colab:

!pip3 install "jsonrpcclient[aiohttp]"
!pip3 install "jsonrpcclient"


import ctypes; ctypes.cdll.LoadLibrary('libsecp256k1.so.0')

import jsonrpcclient.clients
from jsonrpcclient.clients.aiohttp_client import AiohttpClient


now gives:

Requirement already satisfied: jsonrpcclient[aiohttp] in /usr/local/lib/python3.6/dist-packages (2.0.1)
  WARNING: jsonrpcclient 2.0.1 does not provide the extra 'aiohttp'
Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from jsonrpcclient[aiohttp]) (0.16.0)
Requirement already satisfied: jsonschema in /usr/local/lib/python3.6/dist-packages (from jsonrpcclient[aiohttp]) (2.6.0)
Requirement already satisfied: jsonrpcclient in /usr/local/lib/python3.6/dist-packages (2.0.1)
Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from jsonrpcclient) (0.16.0)
Requirement already satisfied: jsonschema in /usr/local/lib/python3.6/dist-packages (from jsonrpcclient) (2.6.0)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-16-afcdc0c9551b> in <module>()
      5 import ctypes; ctypes.cdll.LoadLibrary('libsecp256k1.so.0')
      6 
----> 7 import jsonrpcclient.clients
      8 from jsonrpcclient.clients.aiohttp_client import AiohttpClient
      9 

ModuleNotFoundError: No module named 'jsonrpcclient.clients'```

Note the   WARNING: jsonrpcclient 2.0.1 does not provide the extra 'aiohttp'
commented

Aiohttp isn’t included with jsonrpcclient, you need to install it.

Because jsonrpcclient can work with so many protocols we don’t include all the libraries.

commented

Seems you’ve used the right install command

But it looks like you have an old version of jsonrpcclient - 2.0.1?

Seems you’ve used the right install command

But it looks like you have an old version of jsonrpcclient - 2.0.1?

Yep, good catch.

This fixes it:

!pip3 install aiohttp
!pip3 install "jsonrpcclient==3.3.5"
!pip3 install "jsonrpcclient[aiohttp]"

import jsonrpcclient.clients
from jsonrpcclient.clients.aiohttp_client import AiohttpClient