Fixing `FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'`

A common source of pain a grief for Numba users are issues related to pip install llvmlite. For example recently: pip3 install llvmlite fails · Issue #697 · numba/llvmlite · GitHub

The issue is almost always that users end up seeing the line:

FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'

And, as expressed in pip3 install llvmlite fails · Issue #697 · numba/llvmlite · GitHub searching for this stack trace on the internet yields many issues with attempted solution ideas across a broad range of suggestions. The main problem here, is that multiple error conditions yield this error message and there is no universal solution.

However, the current situation is a pain for users and developers so I propose an approach to mitigate this.

a) If llvm-config can not be found, mention this to the user and point them at the llvmlite FAQ, rather than echoing the full stack trace. Users should not google the original error message any more, it is too deep a rabbit hole.
b) Than, add something along the lines of the following to the FAQ:

Q: What can I do about llvm-config not being found?
A: This depends on your original intent:

I am a user and I wanted to pip install llvmlite / pip install numba and I expected to install binary/pre-compiled wheels.

  • Check that your Python version is supported by llvmlite/numba
  • Check if you architecture is supported by our binary wheels: Linux (x86(32bit) / x86_64(64bit) OSX (x86_64) Win(x86(32bit) / x86_64(64bit)) – currently no Aarch64 Wheel support, so no RaspberryPi.
  • On Linux: check your pip version, at least 19.0 is needed to install manylinux2010 wheels.
  • Still having issues: try conda, compile from source or ask on Discourse /Gitter

I am a developer and I wanted to compile llvmlite from source.

  • Make sure that llvm-config is on the $PATH and executable
  • Ask on Discourse / Gitter

Should probably also ask users to check their python version to ensure that it is supported.

Another unfortunate side-effect of the error message is also that it suggests to users that LLVM needs to be installed. And this often prompts users to install Linux distribution provided LLVM packages, which then may cause run-time issues further down the line.

@esc I think it’d be a good idea to get this into the docs for both Numba and llvmlite, and then see if the error can be caught and a link to the docs put in to the error message so as to help users.

Suggest moving this to a PR for the purpose of gathering feedback, the content at present seems to cover the dominant use cases: i) user with unsupported software/hardware ii) developer needing to bootstrap from an LLVM installation.

I’ve created a starter patch here: Starter patch · stuartarchibald/llvmlite@e7dd319 · GitHub there’s a doc in the root of the llvmlite repo with some notes and a small patch to build.py to hide the issue relating to LLVM to encourage users to read the per-prepared advice.

@stuartarchibald thank you for the starter patch, I’ve taken it a step further here: Improve llvm not found error by esc · Pull Request #701 · numba/llvmlite · GitHub

Thanks @esc, much appreciated!