Frappe Insights installation error in ERPNext v15?

Hi so my ERPNext version is v15.65.2, and I’m trying to install Frappe Insights into it, but for some reason I keep getting this error related to missing pkg-config` and MySQL/MariaDB client development libraries.

So once I DID :

bench get-app insights

Error message:


Getting insights
$ git clone https://github.com/frappe/insights.git   --origin upstream
Cloning into 'insights'...
remote: Enumerating objects: 36221, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 36221 (delta 20), reused 15 (delta 15), pack-reused 36184 (from 2)
Receiving objects: 100% (36221/36221), 64.95 MiB | 14.05 MiB/s, done.
Resolving deltas: 100% (28482/28482), done.
Ignoring dependencies of insights. To install dependencies use --resolve-deps
Installing insights
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/insights 
  error: subprocess-exited-with-error
  
  Ɨ Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      /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
      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.
      Traceback (most recent call last):
        File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
        File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-4yfbye5s/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-4yfbye5s/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-4yfbye5s/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
        File "<string>", line 156, in <module>
        File "<string>", line 49, in get_config_posix
        File "<string>", line 28, in find_package_name
      Exception: Can not find valid pkg-config name.
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: /home/frappe/frappe-bench/env/bin/python -m pip install --upgrade pip
error: subprocess-exited-with-error

Ɨ Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/insights 
subprocess.CalledProcessError: Command '/home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/insights ' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.11/site-packages/bench/commands/make.py", line 181, in get_app
    get_app(
  File "/usr/local/lib/python3.11/site-packages/bench/app.py", line 778, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/usr/local/lib/python3.11/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/app.py", line 253, in install
    install_app(
  File "/usr/local/lib/python3.11/site-packages/bench/app.py", line 912, in install_app
    bench.run(
  File "/usr/local/lib/python3.11/site-packages/bench/bench.py", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/utils/__init__.py", line 181, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/insights 

INFO: A newer version of bench is available: 5.24.1 → 5.25.9

I tried to install the missing dependency especially the pkg-config

by doing

apt update then eventually

*sudo apt install pkg-config*

But it wont let me install that dependency either.

Reading package lists... Done 
E: List directory /var/lib/apt/lists/partial is missing. - 
Acquire (13: Permission denied)

:exploding_head:

Please help me! :frowning: Thanks in advance.

Try to update bench first

pip3 install --upgrade frappe-bench
1 Like

Okay so i tried this and then:
bench get-app insights

[notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: /home/frappe/frappe-bench/env/bin/python -m pip install --upgrade pip
error: subprocess-exited-with-error

Ɨ Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/insights 
subprocess.CalledProcessError: Command '/home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/insights ' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/frappe/.local/lib/python3.11/site-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/home/frappe/.local/lib/python3.11/site-packages/bench/commands/make.py", line 181, in get_app
    get_app(
  File "/home/frappe/.local/lib/python3.11/site-packages/bench/app.py", line 781, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/home/frappe/.local/lib/python3.11/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.local/lib/python3.11/site-packages/bench/app.py", line 253, in install
    install_app(
  File "/home/frappe/.local/lib/python3.11/site-packages/bench/app.py", line 932, in install_app
    bench.run(
  File "/home/frappe/.local/lib/python3.11/site-packages/bench/bench.py", line 49, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise, env=env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/.local/lib/python3.11/site-packages/bench/utils/__init__.py", line 184, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/insights 
Try below command 

pip install --upgrade pip

bench get-app https://github.com/frappe/insights

You need to run sudo apt update and sudo apt install pkg-config libmysqlclient-dev with proper permissions to fix the missing dependencies. The permission error indicates you must run these commands as root or with sudo privileges.