"loki-client" python library does not work

Hello team.
I installed the “loki-client” library available in loki-client · PyPI

I verified that the install process was successfully executed in my environment:

root@host:/project/jupyter# docker-compose exec jupyter pip3 list | grep loki-client
loki-client 0.0.2

Then I attempted to use this library in a Python script, but it failed to start:

ModuleNotFoundError Traceback (most recent call last)
Cell In[40], line 3
** 1 #!/opt/conda/bin/python3**
----> 3 from loki_client import LokiClient

ModuleNotFoundError: No module named ‘loki_client’

¿Has anyone made it work in a Python program?

Hints will be greatly appreciated.
Best regards,


I had the same issue at some point, it seemse there is no official loki client.

Hello Matteo:
I found another client (I am pretty sure you did as well) called “python-loki-client” but I am not sure how useful it might be, according to this paragrah in the page:

“WARNING: This is a beta release of the loki-client, the client is incomplete”

My workaround for the time being: I am using Grafana´s HTTP API to get records from Loki. It is a little bit cumbersome but I get the requested information anyway. I just have have to sweat a bit to dig into the result to get the actual payload I am interested in.

Thanks a lot for your answer!!

1 Like

That is what I ended up doing too. Someone should build a gRPC client to use easily!