The error message /bin/sh: 1: krb5-config: not found typically indicates that the system is missing the krb5-config script, which is part of the Kerberos development package (libkrb5-dev). This script is used to find the correct compiler and linker flags for programs that want to use Kerberos.
If you encounter this message during pip install, it is likely because you are trying to install a Python package that has a dependency on the Kerberos libraries. For example, the requests-kerberos or gssapi packages may require Kerberos development headers and libraries.
To resolve this without installing libkrb5-dev, you can try the following:
Check if Kerberos support is truly needed: If the package you are trying to install is not critical for Kerberos authentication, you might be able to find an alternative package or disable the Kerberos feature.
Use a pre-built wheel: If available, you could install a pre-built wheel file of the package that contains the necessary binaries and does not require compilation. This can avoid the need for krb5-config. You can check if a wheel is available on PyPI or the project's website.
Install a pure Python implementation: For some functionality, there might be a pure Python implementation that does not require compiling against the Kerberos libraries.
Bypass the dependency: If Kerberos is an optional dependency for the package, check the package documentation or setup.py file for an option to bypass the Kerberos support during installation.
Use a virtual environment with the necessary dependencies: If you are working in an environment where you do not have permissions to install system packages, you could use a virtual environment that has the necessary dependencies pre-installed, such as a Docker container.
Contact the package maintainer: If there's a specific reason why you cannot install libkrb5-dev, consider reaching out to the maintainer of the Python package to ask for advice. They might have suggestions for your particular situation.
Modify the setup.py: As a last resort, if you are comfortable with Python package installation mechanisms, you could potentially modify the setup.py file of the package to remove the dependency on Kerberos. However, this is not recommended unless you know what you're doing, as it could break the package or its security features.
If none of these options work and you do need the Kerberos functionality, you would need to install the libkrb5-dev package. On Debian-based systems like Ubuntu, you can install it using the following command:
bash
sudo apt-get install libkrb5-dev
On Red Hat-based systems like CentOS or Fedora, you can use:
bash
sudo yum install krb5-devel
or
bash
sudo dnf install krb5-devel
Remember that avoiding the installation of critical dependencies might lead to the package not working as intended, so it's important to understand the implications of doing so.