danihodovic / celery-exporter

A Prometheus exporter for Celery metrics
MIT License
399 stars 87 forks source link

Cannot install with poetry for some reason. #174

Open Routhinator opened 1 year ago

Routhinator commented 1 year ago

Hey there,

Trying to install this with poetry but I keep getting the following:

  • Installing celery-exporter (0.5.3 0ea8dba): Failed

  EnvCommandError

  Command ['/home/routhinator/.cache/pypoetry/virtualenvs/theden-django-N-6mPsJq-py3.10/bin/pip', 'install', '--no-deps', '-U', '/home/routhinator/.cache/pypoetry/virtualenvs/theden-django-N-6mPsJq-py3.10/src/celery-exporter'] errored with the following return code 1, and output: 
  Processing /home/routhinator/.cache/pypoetry/virtualenvs/theden-django-N-6mPsJq-py3.10/src/celery-exporter
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error

    × Preparing metadata (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [16 lines of output]
        Traceback (most recent call last):
          File "/home/routhinator/.cache/pypoetry/virtualenvs/theden-django-N-6mPsJq-py3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
            main()
          File "/home/routhinator/.cache/pypoetry/virtualenvs/theden-django-N-6mPsJq-py3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
          File "/home/routhinator/.cache/pypoetry/virtualenvs/theden-django-N-6mPsJq-py3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 164, in prepare_metadata_for_build_wheel
            return hook(metadata_directory, config_settings)
          File "/tmp/pip-build-env-v5uv1_uj/overlay/lib/python3.10/site-packages/poetry/core/masonry/api.py", line 41, in prepare_metadata_for_build_wheel
            builder = WheelBuilder(poetry)
          File "/tmp/pip-build-env-v5uv1_uj/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 57, in __init__
            super().__init__(poetry, executable=executable)
          File "/tmp/pip-build-env-v5uv1_uj/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/builder.py", line 83, in __init__
            self._module = Module(
          File "/tmp/pip-build-env-v5uv1_uj/overlay/lib/python3.10/site-packages/poetry/core/masonry/utils/module.py", line 69, in __init__
            raise ModuleOrPackageNotFound(
        poetry.core.masonry.utils.module.ModuleOrPackageNotFound: No file/folder found for package celery-exporter
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: metadata-generation-failed

  × Encountered error while generating package metadata.
  ╰─> See above for output.

  note: This is an issue with the package mentioned above, not pip.
  hint: See above for details.

  [notice] A new release of pip available: 22.2.2 -> 22.3.1
  [notice] To update, run: pip install --upgrade pip

  at ~/.local/lib/python3.10/site-packages/poetry/utils/env.py:1195 in _run
      1191│                 output = subprocess.check_output(
      1192│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1193│                 )
      1194│         except CalledProcessError as e:
    → 1195│             raise EnvCommandError(e, input=input_)
      1196│ 
      1197│         return decode(output)
      1198│ 
      1199│     def execute(self, bin, *args, **kwargs):

I have added celery-exporter as a requirement and pointed at the lastest release tag like so:

celery-exporter = {git = "https://github.com/danihodovic/celery-exporter.git", tag = "celery-exporter-0.4.1"}

Is there a PyPi release I'm missing? Or install directions I am missing?

While I'm at it - do I need to add this to installed_apps? I don't see this mentioned in the readme. Will the metrics come out in django-prometheus exporter metrics? Or is there a port configuration when running with Django that I am missing in the README?

danihodovic commented 1 year ago

This is a standalone program that runs outside of your Django app. It reads metrics via the broker (e.g Redis). There is no point in installing it as a library.

SavinaRoja commented 1 year ago

FWIW (if someone finds this issue while trying to install the project for local development). I just tested the installation on linux, using poetry 1.3.1 installed to a python3.10 interpreter. This worked fine. However if you use a version of poetry < 1.2.0 you will likely encounter an issue with the use of dependency groups in the pyproject.toml. Upgrading your poetry version should resolve that.