jborean93 / pykrb5

Python krb5 API interface
MIT License
17 stars 8 forks source link

subprocess.CalledProcessError: Command '('krb5-config --cflags krb5',)' returned non-zero exit status 1. #34

Closed taoli-ax closed 1 year ago

taoli-ax commented 1 year ago

`Collecting krb5 Using cached krb5-0.5.1.tar.gz (221 kB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [23 lines of output] '"krb5-config --cflags krb5"' is not recognized as an internal or external command, operable program or batch file. Using krb5-config at 'krb5-config' Traceback (most recent call last): File "D:\AI\private-GPT\origin-private-GPT\privateGPT-main\CritixScrapy\venv\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "D:\AI\private-GPT\origin-private-GPT\privateGPT-main\CritixScrapy\venv\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(*hook_input['kwargs']) File "D:\AI\private-GPT\origin-private-GPT\privateGPT-main\CritixScrapy\venv\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) File "C:\Users\TAOL.klotzsh\AppData\Local\Temp\pip-build-env-3669wbo7\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "C:\Users\TAOL.klotzsh\AppData\Local\Temp\pip-build-env-3669wbo7\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires self.run_setup() File "C:\Users\TAOL.klotzsh\AppData\Local\Temp\pip-build-env-3669wbo7\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 175, in File "", line 33, in run_command File "C:\Users\TAOL.klotzsh\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 421, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\TAOL.klotzsh\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '('krb5-config --cflags krb5',)' returned non-zero exit status 1. [end of output] `

and I have try run krb5-config --cflags krb5, it seems like not cofig a envrioment variable (venv) D:\CritixScrapy>krb5-config --cflags krb5 'krb5-config' is not recognized as an internal or external command, operable program or batch file. what should I do?

jborean93 commented 1 year ago

You need to ensure the package that ships krb5-config has been installed. It is used to get the correct flags needed to compile against the Kerberos libs.

taoli-ax commented 1 year ago

sorry I don't have krb5 background knowledge , I try pip install krb5-config, its not work

jborean93 commented 1 year ago

This package relies on the krb5 C library to be present on the system as it compiles against the libkrb5.so. To do this it requires some development tools like the krb5-config command and other headers. How you get these libraries depends on the Linux distribution you use, for example Debian based distros need to do apt-get install libkrb5-dev, RHEL based distros need to do dnf install krb5-devel and so on. There are also some build requirements like gcc and so on. These requirement cannot be fulfilled by pip as they are system package requirements and not Python requirement.

Here is an example running on Debian 11

# podman run --rm -it debian:11
apt-get update

apt-get install -y \
    libkrb5-dev \
    libpython3-dev \
    python3 \
    python3-pip

python3 -m pip install krb5

Another one for Alma 9

# podman run --rm -it almalinux:9
dnf install -y \
    gcc \
    krb5-devel \
    python3 \
    python3-devel

python3 -m pip install krb5

Obviously it's not good to install a package system wide with this Python but hopefully it gives you an example of how to satisfy the system packages for these popular Linux distro types.