qdrant-client icon indicating copy to clipboard operation
qdrant-client copied to clipboard

ModuleNotFoundError: No module named 'dbm' during connection

Open Willseed opened this issue 2 years ago • 3 comments

Description: I encountered a ModuleNotFoundError when attempting to connect to the Qdrant client. The error indicates that the module dbm is missing. This issue occurs when running the client in a WSL environment with Python 3.11.

Error Message:

Traceback (most recent call last):
  File "/mnt/c/Users/jgh98/Documents/repo/langchain_intro/client_test.py", line 3, in <module>
    from qdrant_client import QdrantClient
  File "/home/pony/.cache/pypoetry/virtualenvs/langchain-intro-DUmHWU-T-py3.11/lib/python3.11/site-packages/qdrant_client/__init__.py", line 1, in <module>
    from .async_qdrant_client import AsyncQdrantClient as AsyncQdrantClient
  File "/home/pony/.cache/pypoetry/virtualenvs/langchain-intro-DUmHWU-T-py3.11/lib/python3.11/site-packages/qdrant_client/async_qdrant_client.py", line 33, in <module>
    from qdrant_client.local.async_qdrant_local import AsyncQdrantLocal
  File "/home/pony/.cache/pypoetry/virtualenvs/langchain-intro-DUmHWU-T-py3.11/lib/python3.11/site-packages/qdrant_client/local/async_qdrant_local.py", line 40, in <module>
    from qdrant_client.local.local_collection import LocalCollection
  File "/home/pony/.cache/pypoetry/virtualenvs/langchain-intro-DUmHWU-T-py3.11/lib/python3.11/site-packages/qdrant_client/local/local_collection.py", line 45, in <module>
    from qdrant_client.local.persistence import CollectionPersistence
  File "/home/pony/.cache/pypoetry/virtualenvs/langchain-intro-DUmHWU-T-py3.11/lib/python3.11/site-packages/qdrant_client/local/persistence.py", line 2, in <module>
    import dbm
ModuleNotFoundError: No module named 'dbm'

Code Example:

import yaml
from qdrant_client import QdrantClient

with open("key.yml", "r") as f:
    config = yaml.safe_load(f)

qdrant_client = QdrantClient(
    url=config['QDRANT_ENDPOINT'], 
    api_key=config['QDRANT_API_KEY'],
)

Environment:

OS: WSL (Windows Subsystem for Linux) openSUSE tumbleweed Python version: 3.11 qdrant_client package version: 1.9.1 Steps to Reproduce:

Install qdrant_client package in a WSL environment. Run the provided code snippet. Observe the ModuleNotFoundError related to dbm. Additional Information: Any advice on resolving this issue or guidance on additional dependencies required would be greatly appreciated. Thank you!

Willseed avatar May 27 '24 16:05 Willseed

Hey @Willseed

It seems like something is wrong with your setup, because dbm is a default library, which is available on windows. I would try reinstalling virtualenv / check python installation

joein avatar May 27 '24 20:05 joein

Hello,

I have identified that this issue seems to be specific to the Windows environment. When running the same setup on a Mac, I did not encounter the ModuleNotFoundError: No module named 'dbm' error. It appears that this might be a bug related to the Windows Subsystem for Linux (WSL) or the way Python handles modules in this environment.

Thank you for your assistance and prompt response.

Willseed avatar May 28 '24 01:05 Willseed

Hello,

I have identified the cause of the issue. It was due to the python312-dbm package not being installed on my openSUSE system. Installing this package, which provides the Python interface to the GDBM library, resolved the ModuleNotFoundError: No module named 'dbm' error.

For those experiencing the same issue, you can install the package using the following command:

sudo zypper install python312-dbm

Thank you for your assistance and I hope this information is helpful to others.

Best regards, Willseed

Willseed avatar May 28 '24 14:05 Willseed