About the location of "sudo find / -iname 'Python.h'


1.My environment is as follows.

Ubuntu 22.04lts
Python 3.10.6

2.When I command “sudo find / -iname ‘Python.h’” in my environment, I get the following…
h19078@h19078:~$ sudo find / -iname ‘Python.h’
find: ‘/run/user/1000/gvfs’: no permission
find: ‘/run/user/1000/doc’: no permission

3.The location of python.h in above 2. is too deep,
I think it should be in a shallow place like the below.

4.Therefore, I am trying to install Ubuntu – Details of package libpython3.10-dev in jammy.
But, as below.
h19078@h19078:~$ sudo apt install ./download/libpython3.10-dev_3.10.6-1~22.04.2ubuntu1_amd64.deb
Note,‘./download/libpython3.10-dev_3.10.6-1~22.04.2ubuntu1_amd64.deb’ instead ‘libpython3.10-dev’ choose

→ Please teach me how to actively change to libpython3.10_dev_3.10.6-1~22.04.2ubuntu1_amd64.deb instead of the existing ‘libpython3.10-dev’

/home/h19078/.local/lib/python3.10/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/common/python.h is part of the debugpy Python module, which vendors the pydevd, which apparently contains a copy of Python.h for its internal purposes.

It is not meant to compile your own C extensions. You should not use it directly.

Since you already have /usr/include/python3.10/Python.h, I don’t understand what problem you are trying to solve.

You can install a .deb package with sudo dpkg -i foo.deb. But again, I don’t know what you’re trying to do with this or how you think it will improve your setup (which looks perfectly normal).

Dear Jean Abou Samra,

Thank you very much.

libpython3.10_dev_3.10.6-1~22.04.2ubuntu1_amd64.deb was able to install successfully.
Specifically, it is as follows. (This gives me a foundation to install ibpython3.10_dev_3.10.6-1~22.04.2ubuntu1_amd64.deb, which I recommend towards my this goal.)

h19078@h19078:~$ sudo dpkg -i ./downloads/libpython3.10-dev_3.10.6-1~22.04.2ubuntu1_amd64.deb
(Reading database… 264402 files and directories currently installed.)
Preparing to unpack …/libpython3.10-dev_3.10.6-1~22.04.2ubuntu1_amd64.deb …
libpython3.10-dev:amd64 (3.10.6-1~22.04.2ubuntu1) is overwritten (to 3.10.6-1~22.04.2ubuntu1)…
Configuring libpython3.10-dev:amd64 (3.10.6-1~22.04.2ubuntu1) …
Processing triggers for man-db (2.10.2-1)…

Let’s take a step back here - what happened when you ran sudo apt install python3-dev which would normally be the most obvious way to do this? What led you to do things manually like this?

Dear Chris Angelico

Thank you very much.
I tried sudo apt install python3-dev again as you said,
and the result is as follows.

h19078@h19078:~$ sudo apt install python3-dev
Loading package list… Done
Building dependency tree… Done
Reading state information… Done
python3-dev is already the latest version (3.10.6-1~22.04).


Even if I enter "sudo find / -iname ‘Python.h’ ", ‘Python.h’ is not found as follows. I would appreciate it if someone could teach me the solution.

h19078@h19078:~$ sudo find / -iname ‘Python.h’
find: ‘/run/user/1000/gvfs’: permission denied
find: ‘/run/user/1000/doc’: permission denied

  **Ubuntu 22.04lts**
  **Python 3.10.6**
  h19078@h19078:~$ sudo apt install python3-dev
  Loading package list… Done
  Building dependency tree… Done
  Reading state information… Done
  **python3-dev** is already the latest version (**3.10.6-1~22.04**).

The right package is libpython3.10-dev, not python-dev.

(You had it already installed at the beginning so I don’t really understand why you still have this problem – are you using several different machines?)

(Also, remember that find is not the right tool to find a C header.)

Hmm, I’d be inclined to install python3-dev rather than just the libbpython package - that way, you know you’re getting all of the necessary header files, not just the core library. (On my Debian system, python3-dev depends on libpython3-dev which depends on libpython3.8-dev or whichever specific version you get.)

Dear Chris Angelico

Thank you very much to you for teaching me, I had a realization.
In the first place, I used the default installed Python on Ubuntu 22.04 LTS…

So, in my case, I installed Python separately as below.

wget https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tar.xz tar xJf Python-3.10.9.tar.xz
cd Python-3.10.9 ./configure
make sudo make install

Then I did the following and it worked as below!

$ sudo find / -iname ‘Python.h’