'AttributeError: module 'memcache' has no attribute 'Client'

Recently I implemented lock.py in my python project for locking threads, using memcached. However I encoutered an error which I have trouble solving. It says that memcache does not containt attribute Client. I am not using Client directly, I believe it's just being called inside the imported modules. I have installed both dogpile.cache==1.1.5 and python-memcached==1.59 using pip. Could someone please help me?

Here is the full error message:

Exception in thread Thread-1 (mock_process_repo):
Traceback (most recent call last):
  File "/usr/lib64/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/home/jdonic/code/prograde/prograde/lock.py", line 164, in mock_process_repo
    with RepoSyncLock("repository-name"):
  File "/home/jdonic/code/prograde/prograde/lock.py", line 122, in __enter__
    while not lock_cache_region.backend.client.add(
  File "/home/jdonic/.local/lib/python3.10/site-packages/dogpile/cache/backends/memcached.py", line 181, in client
    return self._clients.memcached
  File "/home/jdonic/.local/lib/python3.10/site-packages/dogpile/util/langhelpers.py", line 78, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/home/jdonic/.local/lib/python3.10/site-packages/dogpile/cache/backends/memcached.py", line 169, in _clients
    return ClientPool()
  File "/home/jdonic/.local/lib/python3.10/site-packages/dogpile/cache/backends/memcached.py", line 167, in __init__
    self.memcached = backend._create_client()
  File "/home/jdonic/.local/lib/python3.10/site-packages/dogpile/cache/backends/memcached.py", line 313, in _create_client
    return memcache.Client(self.url)
AttributeError: module 'memcache' has no attribute 'Client'


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source