prometheus / client_python

Prometheus instrumentation library for Python applications
Apache License 2.0
3.94k stars 795 forks source link

ModuleNotFoundError: No module named 'prometheus_client' when installing prometheus_client in a Python virtual env #1054

Closed camilla-storytel closed 1 month ago

camilla-storytel commented 2 months ago

Hello all, I am trying to install prometheus/client_python locally and it is failing. Here is a minimal reproducible example (I am on Mac)

  1. Create virtual env python3 -m venv env
  2. Activate source env/bin/activate
  3. Run install command as per instructions pip install prometheus-client

Everything completes successfully

Collecting prometheus-client
  Downloading prometheus_client-0.20.0-py3-none-any.whl.metadata (1.8 kB)
Downloading prometheus_client-0.20.0-py3-none-any.whl (54 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.5/54.5 kB 2.7 MB/s eta 0:00:00
Installing collected packages: prometheus-client
Successfully installed prometheus-client-0.20.0
  1. Open Python shell
  2. Try to import the module as per docs import prometheus_client
  3. Get above exception.

Could you please advise what is going wrong? I receive the same error after installing prometheus-client in a Docker container as well.