wlav / cppyy

Other
412 stars 42 forks source link

trying to install cppy, but nothing happens #250

Open SimonDev666 opened 4 months ago

SimonDev666 commented 4 months ago

i am using kali linux 2024.2 with python3.12.4 in visual studio code 1.91.0 having setup a virtual environment in vs code, then under packages i try to install cppyy. it starts but nothing happens. i have tried cppyy-backend; thats seems to work as the venv packages reflect this - but not when i do it for just cppyy

the venv looks activate, as seen in the terminal prompt in vs code. when i try from the terminal in vs code, i get this error └─$ python -m pip install cppyy Collecting cppyy Using cached cppyy-3.1.2-py3-none-any.whl Collecting CPyCppyy==1.12.16 (from cppyy) Using cached CPyCppyy-1.12.16.tar.gz (211 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting cppyy-backend==1.15.2 (from cppyy) Using cached cppyy_backend-1.15.2-py2.py3-none-linux_x86_64.whl Collecting cppyy-cling==6.30.0 (from cppyy) Using cached cppyy_cling-6.30.0-py2.py3-none-manylinux2014_x86_64.whl.metadata (2.0 kB) Using cached cppyy_cling-6.30.0-py2.py3-none-manylinux2014_x86_64.whl (42.2 MB) Building wheels for collected packages: CPyCppyy Building wheel for CPyCppyy (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for CPyCppyy (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [14 lines of output] running bdist_wheel running build running build_ext building 'libcppyy' extension creating build creating build/temp.linux-x86_64-cpython-312 creating build/temp.linux-x86_64-cpython-312/src x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Iinclude "-I/home/simon/Code/VS Code - Python/.venv/include" -I/usr/include/python3.12 -c src/API.cxx -o build/temp.linux-x86_64-cpython-312/src/API.o -O2 -pthread -std=c++2a -m64 -Wno-cast-function-type -Wno-unknown-warning -Wno-register -Wno-strict-aliasing In file included from src/API.cxx:2: src/CPyCppyy.h:35:10: fatal error: Python.h: No such file or directory 35 | #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 CPyCppyy Failed to build CPyCppyy ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (CPyCppyy)

any advice please....

wlav commented 4 months ago

Specific error is here:

src/CPyCppyy.h:35:10: fatal error: Python.h: No such file or directory
35 | #include "Python.h"

Apparently, you don't have the Python C-API headers installed. (You can check with something like python -c 'import sysconfig; print(sysconfig.get_path("include"))' to see whether they're really not there or are simply not found.)

I'm not familiar with kali linux, but many distros separate out the Python binaries from the Python headers, with the latter typically called something like python-dev. Install the kali linux equivalent (I think it's this: https://www.kali.org/tools/what-is-python/) and you should be good.

SimonDev666 commented 4 months ago

thanks for the advice. it would seem that from 'visual studio code' under the .venv created that adding the cppyy packages fails - nothing happens - no error message.

installed the python dev headers for my version python

sudo apt-get install python3.12-dev

then tried your python -c 'import sysconfig; print(sysconfig.get_path("include"))' showing the '/usr/include/python3.12' so it now installed

installed cppyy from the within 'visual studio code' from a terminal ensuring i am with a .venv (for python3.12.4) and it worked.

just wanted to let you know and for other newbies like myself - many thanks