Cannot get/install Insights app in my current setup

I have Frappe/ERPNext 15.x production setup up and working.

When I run the command: bench get-app insights --branch version-3 to get and install it gives following errors:

Following apps will be installed
1. insights
Getting insights
$ git clone https://github.com/frappe/insights.git --branch version-3 --depth 1 --origin upstream
Cloning into 'insights'...
remote: Enumerating objects: 1040, done.
remote: Counting objects: 100% (1040/1040), done.
remote: Compressing objects: 100% (980/980), done.
remote: Total 1040 (delta 88), reused 474 (delta 45), pack-reused 0 (from 0)
Receiving objects: 100% (1040/1040), 14.06 MiB | 29.57 MiB/s, done.
Resolving deltas: 100% (88/88), done.
Installing insights
$ uv pip install --quiet -e /home/xxx/erp-demo/apps/insights  --python /home/xxx/erp-demo/env/bin/python
  × Failed to build `mysqlclient==2.3.2`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)

      [stdout]
      Trying pkg-config --exists mysqlclient
      Command 'pkg-config --exists mysqlclient' returned non-zero exit status 127.
      Trying pkg-config --exists mariadb
      Command 'pkg-config --exists mariadb' returned non-zero exit status 127.
      Trying pkg-config --exists libmariadb
      Command 'pkg-config --exists libmariadb' returned non-zero exit status 127.
      Trying pkg-config --exists perconaserverclient
      Command 'pkg-config --exists perconaserverclient' returned non-zero exit status 127.

      [stderr]
      /bin/sh: 1: pkg-config: not found
      /bin/sh: 1: pkg-config: not found
      /bin/sh: 1: pkg-config: not found
      /bin/sh: 1: pkg-config: not found
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
        File "/home/xxx/.cache/uv/builds-v0/.tmpTtFnUG/lib/python3.12/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/xxx/.cache/uv/builds-v0/.tmpTtFnUG/lib/python3.12/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
        File "/home/xxx/.cache/uv/builds-v0/.tmpTtFnUG/lib/python3.12/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())  # noqa: S102 # exec is intentional here
          ^^^^^^^^^^^^^^^^^^^^
        File "<string>", line 155, in <module>
        File "<string>", line 48, in get_config_posix
        File "<string>", line 27, in find_package_name
      Exception: Can not find valid pkg-config name.
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually

      hint: This usually indicates a problem with the package or the build environment.
  help: `mysqlclient` (v2.3.2) was included because `insights` (v3.50.3) depends on `ibis-framework[mysql]` (v11.0.0) which depends on `mysqlclient`
Error occured during app install: uv pip install --quiet -e /home/xxx/erp-demo/apps/insights  --python /home/xxx/erp-demo/env/bin/python

Even running the command bench get-app insights give error.

How to resolve this?

Hi @yogeshvachhani

Try these commands

sudo apt update

sudo apt install -y
pkg-config
build-essential
default-libmysqlclient-dev

pkg-config --version

If the above fails then try: -

bench setup requirements

Hope it helps