Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't run grafana-import after installation #17

Open
gecube opened this issue Sep 23, 2024 · 8 comments
Open

can't run grafana-import after installation #17

gecube opened this issue Sep 23, 2024 · 8 comments
Labels
question Further information is requested

Comments

@gecube
Copy link

gecube commented Sep 23, 2024

Good day!

I am playing around the script for uploading dashboards: https://github.com/OpenSTEF/openstef-reference/blob/master/grafana-configurator/volumes/config/configurator.sh

My goal is to get the one-go solution - docker compose up and get grafana instance with all dashboards loaded.

Now I am experiencing troubles with the installation and running of grafana-import.
We have: alpine docker image and script installing the necessary dependencies. If I use the next statements:

apk add --no-cache curl python3 git

pip3 install --upgrade pip

pip3 install grafana-import

export GRAFANA_URL=http://admin:admin@grafana:3000

grafana-import  -i ./dashboards/station_forecasts.json

I am getting the next error:

fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/17) Installing ca-certificates (20190108-r0)
(2/17) Installing libssh2 (1.9.0-r1)
(3/17) Installing libcurl (7.61.1-r3)
(4/17) Installing curl (7.61.1-r3)
(5/17) Installing expat (2.2.8-r0)
(6/17) Installing pcre2 (10.30-r0)
(7/17) Installing git (2.15.4-r0)
(8/17) Installing libbz2 (1.0.6-r7)
(9/17) Installing libffi (3.2.1-r4)
(10/17) Installing gdbm (1.13-r1)
(11/17) Installing xz-libs (5.2.3-r1)
(12/17) Installing ncurses-terminfo-base (6.0_p20171125-r1)
(13/17) Installing ncurses-terminfo (6.0_p20171125-r1)
(14/17) Installing ncurses-libs (6.0_p20171125-r1)
(15/17) Installing readline (7.0.003-r0)
(16/17) Installing sqlite-libs (3.25.3-r2)
(17/17) Installing python3 (3.6.9-r1)
Executing busybox-1.27.2-r11.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 81 MiB in 30 packages
Collecting pip
  Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-21.3.1
Collecting grafana-import
  Downloading grafana_import-0.2.0-py3-none-any.whl (14 kB)
Collecting grafana-api
  Downloading grafana_api-1.0.3-py2.py3-none-any.whl (26 kB)
Collecting jinja2
  Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
Collecting requests>=2.23.0
  Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl (29 kB)
Collecting charset-normalizer~=2.0.0
  Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2024.8.30-py3-none-any.whl (167 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.10-py3-none-any.whl (70 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.20-py2.py3-none-any.whl (144 kB)
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests, MarkupSafe, jinja2, grafana-api, grafana-import
Successfully installed MarkupSafe-2.0.1 certifi-2024.8.30 charset-normalizer-2.0.12 grafana-api-1.0.3 grafana-import-0.2.0 idna-3.10 jinja2-3.0.3 requests-2.27.1 urllib3-1.26.20
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
...
Traceback (most recent call last):
  File "/usr/bin/grafana-import", line 5, in <module>
    from grafana_import.cli import main
  File "/usr/lib/python3.6/site-packages/grafana_import/cli.py", line 25, in <module>
    import grafana_client.client as GrafanaApi
ModuleNotFoundError: No module named 'grafana_client'

what is really weird. It looks like that the installation of package is broken.

If I change the script to use

pip3 install --upgrade 'grafana-import[builder] @ git+https://github.com/grafana-toolbox/grafana-import.git'

I am getting the next error:

fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/17) Installing ca-certificates (20190108-r0)
(2/17) Installing libssh2 (1.9.0-r1)
(3/17) Installing libcurl (7.61.1-r3)
(4/17) Installing curl (7.61.1-r3)
(5/17) Installing expat (2.2.8-r0)
(6/17) Installing pcre2 (10.30-r0)
(7/17) Installing git (2.15.4-r0)
(8/17) Installing libbz2 (1.0.6-r7)
(9/17) Installing libffi (3.2.1-r4)
(10/17) Installing gdbm (1.13-r1)
(11/17) Installing xz-libs (5.2.3-r1)
(12/17) Installing ncurses-terminfo-base (6.0_p20171125-r1)
(13/17) Installing ncurses-terminfo (6.0_p20171125-r1)
(14/17) Installing ncurses-libs (6.0_p20171125-r1)
(15/17) Installing readline (7.0.003-r0)
(16/17) Installing sqlite-libs (3.25.3-r2)
(17/17) Installing python3 (3.6.9-r1)
Executing busybox-1.27.2-r11.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 81 MiB in 30 packages
Collecting pip
  Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-21.3.1
Collecting grafana-import[builder]@ git+https://github.com/grafana-toolbox/grafana-import.git
  Cloning https://github.com/grafana-toolbox/grafana-import.git to /tmp/pip-install-v66fq7np/grafana-import_3fa05eba16bc4b23b478883167696574
  Running command git clone -q https://github.com/grafana-toolbox/grafana-import.git /tmp/pip-install-v66fq7np/grafana-import_3fa05eba16bc4b23b478883167696574
  Resolved https://github.com/grafana-toolbox/grafana-import.git to commit aa602531329dbbb184166150160368b99d1590c5
  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 'done'
Collecting jinja2<4
  Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
Collecting pyyaml<7
  Downloading PyYAML-6.0.1.tar.gz (125 kB)
  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 'done'
Collecting grafana-client<5
  Downloading grafana_client-3.11.2-py2.py3-none-any.whl (70 kB)
Collecting watchdog<5
  Downloading watchdog-2.3.1.tar.gz (123 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting grafanalib==0.7.1
  Downloading grafanalib-0.7.1-py3-none-any.whl (62 kB)
Collecting grafana-dashboard==0.1.1
  Downloading grafana_dashboard-0.1.1-py3-none-any.whl (63 kB)
INFO: pip is looking at multiple versions of grafana-import[builder] to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement rich>=13.4.2 (from grafana-dashboard) (from versions: 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.4.0, 0.4.1, 0.5.0, 0.6.0, 0.7.0, 0.7.1, 0.7.2, 0.8.0a1, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5, 0.8.6, 0.8.7, 0.8.8, 0.8.9, 0.8.10, 0.8.11, 0.8.12, 0.8.13, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.1.8, 1.1.9, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.3.1, 2.0.0, 2.0.1, 2.1.0, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.2.6, 2.3.0, 2.3.1, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1.0, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.4.0, 3.4.1, 4.0.0, 4.1.0, 4.2.0, 4.2.1, 4.2.2, 5.0.0, 5.1.0, 5.1.1, 5.1.2, 5.2.0, 5.2.1, 6.0.0, 6.1.0, 6.1.1, 6.1.2, 6.2.0, 7.0.0, 7.1.0, 8.0.0, 9.0.0, 9.0.1, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.5.1, 9.6.0, 9.6.1, 9.6.2, 9.7.0, 9.8.0, 9.8.1, 9.8.2, 9.9.0, 9.10.0, 9.11.0, 9.11.1, 9.12.0, 9.12.1, 9.12.2, 9.12.3, 9.12.4, 9.13.0, 10.0.0, 10.0.1, 10.1.0, 10.2.0, 10.2.1, 10.2.2, 10.3.0, 10.4.0, 10.5.0, 10.6.0, 10.7.0, 10.8.0, 10.9.0, 10.10.0, 10.11.0, 10.12.0, 10.13.0, 10.14.0, 10.15.0a0, 10.15.0a2, 10.15.0a3, 10.15.0, 10.15.1, 10.15.2, 10.15.3a1, 10.15.3a2, 10.16.0, 10.16.1a1, 10.16.1, 10.16.2, 11.0.0, 11.1.0, 11.2.0, 12.0.0a1, 12.0.0a2, 12.0.0, 12.0.1, 12.1.0, 12.2.0, 12.3.0, 12.4.0, 12.4.1, 12.4.2, 12.4.3, 12.4.4, 12.5.0, 12.5.1, 12.6.0a1, 12.6.0a2, 12.6.0)
ERROR: No matching distribution found for rich>=13.4.2

I am kindly asking to check the installation scripts and make appropriate changes.

@gecube
Copy link
Author

gecube commented Sep 23, 2024

I was able to run grafana-import after installation of all dependencies:

$ pip3 install grafana-import grafana-client pyyaml

@gecube
Copy link
Author

gecube commented Sep 23, 2024

Also I am kindly asking to fix this

Currently, there is no up-to-date version on PyPI, so we recommend to install directly from the repository. The command outlined above describes a full installation of grafana-import, including support for dashboard builders, aka. dashboard-as-code.

by publishing a proper version on PyPI

@amotl
Copy link
Contributor

amotl commented Sep 26, 2024

Oh, thank you so much for your report, and apologies for the hiccup you've experienced. We will wrap up the current state of the code base into a new release, which hasn't happened yet.

@gecube
Copy link
Author

gecube commented Sep 26, 2024

@amotl Hi! Thanks for the reply. I found that I was using old container image. The update to alpine:3.20.3 helped a lit. But still need to:

  • install dependencies manually pip3 install rich pydantic
  • and install the package from the github: pip3 install --upgrade 'grafana-import[builder] @ git+https://github.com/grafana-toolbox/grafana-import.git'

not very convenient, but at least I was able to run the tool.

@amotl
Copy link
Contributor

amotl commented Sep 26, 2024

Hi again. Good that you have been able to resolve your most pressing needs, getting this running, in a self-service manner. I am also so happy that you reached out to us, because, apparently, after spending some time on the package the other day, we missed to wrap it up properly and run a corresponding release.

Your detailed feedback here is very much appreciated, and we are looking forward to provide you a working package, and then hear back from you about it. 🍀

@amotl
Copy link
Contributor

amotl commented Oct 3, 2024

Hi again. We just published grafana-import v0.3.0 to PyPI.

@amotl
Copy link
Contributor

amotl commented Oct 16, 2024

Hi again. I think installing the package from PyPI works well now? So, I guess closing this issue will be safe?

@gecube
Copy link
Author

gecube commented Oct 16, 2024

@amotl Hi! Thanks. I will check in next few days and return to you.

@amotl amotl added the question Further information is requested label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants