Fatal error: Python.h: No such file or directory

I am using deepstream docker from

docker pull nvcr.io/nvidia/deepstream:5.0.1-20.09-triton

for my workstation with Ubuntu 18.

Trying to compile trt_pose from https://github.com/NVIDIA-AI-IOT/trt_pose.

When run python3 setup.py install, I have errors as follows.

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/include/python3.6m -c trt_pose/parse/connect_parts.cpp -o build/temp.linux-x86_64-3.6/trt_pose/parse/connect_parts.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=plugins -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/include/python3.6m -c trt_pose/plugins.cpp -o build/temp.linux-x86_64-3.6/trt_pose/plugins.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=plugins -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Parallel.h:149:0,
                 from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
                 from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
                 from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
                 from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:12,
                 from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
                 from trt_pose/train/generate_cmap.hpp:1,
                 from trt_pose/plugins.cpp:6:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/ParallelOpenMP.h:84:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
 #pragma omp parallel for if ((end - begin) >= grain_size)
 
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/Device.h:3:0,
                 from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/python.h:8,
                 from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:6,
                 from trt_pose/train/generate_cmap.hpp:1,
                 from trt_pose/plugins.cpp:6:
/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/python_headers.h:10:10: fatal error: Python.h: No such file or directory
 #include <Python.h>
          ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I have already updated my docker with

nvidia-docker run nvcr.io/nvidia/tensorflow-cv2:latest bash -c "apt-get update; apt-get install -y python3-dev"

Why I have this error?

PLease refer to below commands run in nvcr.io/nvidia/deepstream:5.0.1-20.09-triton docker.
It can run “python3 setup.py install” successfully.

1 cd
2 apt-get update
3 apt-get install -y cmake python3-dev python3-matplotlib python3-pip libopenmpi2 libopenblas-dev git
4 pip3 install scikit-build tqdm cython pycocotools torchvision
5 ls
6 git clone GitHub - NVIDIA-AI-IOT/torch2trt: An easy to use PyTorch to TensorRT converter
7 ls
8 cd torch2trt/
9 python3 setup.py install --plugins
10 cd …
11 git clone GitHub - NVIDIA-AI-IOT/trt_pose: Real-time pose estimation accelerated with NVIDIA TensorRT
12 cd trt_pose/
13 ls
14 python3 setup.py install
15 history