Home > Software engineering >  python3 failed to import riak
python3 failed to import riak

Time:07-04

I used python 3.9.13, and have installed riak client lib. But I failed to

import riak

Here's the exception message below

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/riak/__init__.py", line 9, in <module>
    from riak.client import RiakClient
  File "/usr/local/lib/python3.9/site-packages/riak/client/__init__.py", line 9, in <module>
    from riak.client.operations import RiakClientOperations
  File "/usr/local/lib/python3.9/site-packages/riak/client/operations.py", line 5, in <module>
    from riak.client.transport import RiakClientTransport, \
  File "/usr/local/lib/python3.9/site-packages/riak/client/transport.py", line 3, in <module>
    from riak.transports.tcp import is_retryable as is_tcp_retryable
  File "/usr/local/lib/python3.9/site-packages/riak/transports/tcp/__init__.py", line 5, in <module>
    from riak.transports.tcp.transport import TcpTransport
  File "/usr/local/lib/python3.9/site-packages/riak/transports/tcp/transport.py", line 6, in <module>
    from riak.codecs import Codec, Msg
  File "/usr/local/lib/python3.9/site-packages/riak/codecs/__init__.py", line 9, in <module>
    Msg = collections.namedtuple('Msg',
TypeError: namedtuple() got an unexpected keyword argument 'verbose'

CodePudding user response:

The verbose keyword argument for namedtuple() was deprecated in Python 3.7 and it doesn't look like the package version for riak on PyPi has been updated to account for this.

It has been patched on the master branch of the riak GitHub repo so you should try pip installing the package directly from GitHub rather from PyPi.

e.g.

$ pip install git https://github.com/basho/riak-python-client

CodePudding user response:

And I quote

You must use version 2.7.11, 3.4.4 or 3.5.1 (or greater within a version series). Otherwise you will be affected by this python bug

Link for the know bug

The solution as suggested is to use 3.5.X.

More information can be found at pypi riak page.

  • Related