private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

[SOLVED] Fixing pip install on Linux Mint, No such file or directory

Open hacker-szabo opened this issue 1 year ago • 0 comments

I am using Linux Mint and had an error Linux Mint 20.1 Ulyssa python3.10 pip 22.3.1

To build hnswlib I needed to install gcc-11 and g++-11 and make them defailt with using-alternatives (test with gcc-11 --version and g++ --version)

Then what solved my problem was this: sudo apt install python3.10-dev

pip install finally was successful

The full error message: × Building wheel for hnswlib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [21 lines of output] running bdist_wheel running build running build_ext creating tmp x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.10 -c /tmp/tmpj4yohzji.cpp -o tmp/tmpj4yohzji.o -std=c++14 x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.10 -c /tmp/tmparm4op_p.cpp -o tmp/tmparm4op_p.o -fvisibility=hidden building 'hnswlib' extension creating build creating build/temp.linux-x86_64-cpython-310 creating build/temp.linux-x86_64-cpython-310/python_bindings x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/tmp/pip-build-env-n362_ecf/overlay/local/lib/python3.10/dist-packages/pybind11/include -I/tmp/pip-build-env-n362_ecf/overlay/local/lib/python3.10/dist-packages/numpy/core/include -I./hnswlib/ -I/usr/include/python3.10 -c ./python_bindings/bindings.cpp -o build/temp.linux-x86_64-cpython-310/./python_bindings/bindings.o -O3 -fopenmp -DVERSION_INFO="0.7.0" -std=c++14 -fvisibility=hidden In file included from /tmp/pip-build-env-n362_ecf/overlay/local/lib/python3.10/dist-packages/pybind11/include/pybind11/detail/../attr.h:13, from /tmp/pip-build-env-n362_ecf/overlay/local/lib/python3.10/dist-packages/pybind11/include/pybind11/detail/class.h:12, from /tmp/pip-build-env-n362_ecf/overlay/local/lib/python3.10/dist-packages/pybind11/include/pybind11/pybind11.h:13, from /tmp/pip-build-env-n362_ecf/overlay/local/lib/python3.10/dist-packages/pybind11/include/pybind11/functional.h:12, from ./python_bindings/bindings.cpp:2: /tmp/pip-build-env-n362_ecf/overlay/local/lib/python3.10/dist-packages/pybind11/include/pybind11/detail/../detail/common.h:266:10: fatal error: Python.h: No such file or directory 266 | #include <Python.h> | ^~~~~~~~~~ compilation terminated. error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for hnswlib

Hope it helps for some

hacker-szabo avatar May 29 '23 23:05 hacker-szabo