Question: This is my process. I start a new aws t2.micro ec2 on ubuntu20 and run this script sudo apt-get update sudo apt-get install gcc sudo apt-get install python3.9 sudo apt-get install python3.9-venv curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py > get-pip.py python3.9 get-pip.py sudo apt-get install python-dev sudo apt-get install python3-dev python3.9 -m pip install --upgrade pip python3.9 -m pip install --upgrade pip setuptools python3.9 -m pip install --upgrade wheel python3.9 -m pip install testresources sudo apt-get install build-essential sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev wget liblzma-dev lzma sudo apt-get install python3-devel python3.9 -m pip install p5py python3.9 -m pip install PEP517 python3.9 -m pip install py-find-1st  The last line is the problem I get this output (error is at the bottom, I included more output incase it's helpful, had to trim output a little bit)   Preparing to unpack .../python3.9-venv_3.9.5-3~20.04.1_amd64.deb ... Unpacking python3.9-venv (3.9.5-3~20.04.1) ... Setting up python-pip-whl (20.0.2-5ubuntu1.5) ... Setting up python3.9-venv (3.9.5-3~20.04.1) ... Defaulting to user installation because normal site-packages is not writeable Collecting pip Downloading pip-21.1.3-py3-none-any.whl (1.5 MB) |████████████████████████████████| 1.5 MB 5.0 MB/s Collecting wheel Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB) Installing collected packages: wheel, pip WARNING: The script wheel is installed in '/home/ubuntu/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts pip, pip3 and pip3.9 are installed in '/home/ubuntu/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-21.1.3 wheel-0.36.2 Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'python-dev-is-python2' instead of 'python-dev' The following additional packages will be installed: libexpat1-dev libpython2-dev libpython2-stdlib libpython2.7 libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib python-is-python2 python2 python2-dev python2-minimal python2.7 python2.7-dev python2.7-minimal Suggested packages: python2-doc python-tk python2.7-doc binfmt-support The following NEW packages will be installed: libexpat1-dev libpython2-dev libpython2-stdlib libpython2.7 libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib python-dev-is-python2 python-is-python2 python2 python2-dev python2-minimal python2.7 python2.7-dev python2.7-minimal 0 upgraded, 15 newly installed, 0 to remove and 78 not upgraded. Need to get 7744 kB of archives. After this operation, 35.1 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 libpython2.7-minimal amd64 2.7.18-1~20.04.1 [335 kB] Get:2 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python2.7-minimal amd64 2.7.18-1~20.04.1 [1285 kB] Get:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 python2-minimal amd64 2.7.17-2ubuntu4 [27.5 kB] Get:4 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 libpython2.7-stdlib amd64 2.7.18-1~20.04.1 [1887 kB] Get:5 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python2.7 amd64 2.7.18-1~20.04.1 [248 kB] Get:6 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 libpython2-stdlib amd64 2.7.17-2ubuntu4 [7072 B] Get:7 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 python2 amd64 2.7.17-2ubuntu4 [26.5 kB] Get:8 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libexpat1-dev amd64 2.2.9-1build1 [116 kB] Get:9 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 libpython2.7 amd64 2.7.18-1~20.04.1 [1038 kB] Get:10 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 libpython2.7-dev amd64 2.7.18-1~20.04.1 [2475 kB] Get:11 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 libpython2-dev amd64 2.7.17-2ubuntu4 [7140 B] Get:12 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 python-is-python2 all 2.7.17-4 [2496 B] Get:13 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python2.7-dev amd64 2.7.18-1~20.04.1 [287 kB] Get:14 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 python2-dev amd64 2.7.17-2ubuntu4 [1268 B] Get:15 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 python-dev-is-python2 all 2.7.17-4 [1396 B] Fetched 7744 kB in 0s (46.3 MB/s) Selecting previously unselected package libpython2.7-minimal:amd64. (Reading database ... 65082 files and directories currently installed.) Preparing to unpack .../0-libpython2.7-minimal_2.7.18-1~20.04.1_amd64.deb ... Unpacking libpython2.7-minimal:amd64 (2.7.18-1~20.04.1) ... Selecting previously unselected package python2.7-minimal. Preparing to unpack .../1-python2.7-minimal_2.7.18-1~20.04.1_amd64.deb ... Unpacking python2.7-minimal (2.7.18-1~20.04.1) ... Selecting previously unselected package python2-minimal. Preparing to unpack .../2-python2-minimal_2.7.17-2ubuntu4_amd64.deb ... Unpacking python2-minimal (2.7.17-2ubuntu4) ... Selecting previously unselected package libpython2.7-stdlib:amd64. Preparing to unpack .../3-libpython2.7-stdlib_2.7.18-1~20.04.1_amd64.deb ... Unpacking libpython2.7-stdlib:amd64 (2.7.18-1~20.04.1) ... Selecting previously unselected package python2.7. Preparing to unpack .../4-python2.7_2.7.18-1~20.04.1_amd64.deb ... Unpacking python2.7 (2.7.18-1~20.04.1) ... Selecting previously unselected package libpython2-stdlib:amd64. Preparing to unpack .../5-libpython2-stdlib_2.7.17-2ubuntu4_amd64.deb ... Unpacking libpython2-stdlib:amd64 (2.7.17-2ubuntu4) ... Setting up libpython2.7-minimal:amd64 (2.7.18-1~20.04.1) ... Setting up python2.7-minimal (2.7.18-1~20.04.1) ... Linking and byte-compiling packages for runtime python2.7... Setting up python2-minimal (2.7.17-2ubuntu4) ... Selecting previously unselected package python2. (Reading database ... 65829 files and directories currently installed.) Preparing to unpack .../0-python2_2.7.17-2ubuntu4_amd64.deb ... Unpacking python2 (2.7.17-2ubuntu4) ... Selecting previously unselected package libexpat1-dev:amd64. Preparing to unpack .../1-libexpat1-dev_2.2.9-1build1_amd64.deb ... Unpacking libexpat1-dev:amd64 (2.2.9-1build1) ... Selecting previously unselected package libpython2.7:amd64. Preparing to unpack .../2-libpython2.7_2.7.18-1~20.04.1_amd64.deb ... Unpacking libpython2.7:amd64 (2.7.18-1~20.04.1) ... Selecting previously unselected package libpython2.7-dev:amd64. Preparing to unpack .../3-libpython2.7-dev_2.7.18-1~20.04.1_amd64.deb ... Unpacking libpython2.7-dev:amd64 (2.7.18-1~20.04.1) ... Selecting previously unselected package libpython2-dev:amd64. Preparing to unpack .../4-libpython2-dev_2.7.17-2ubuntu4_amd64.deb ... Unpacking libpython2-dev:amd64 (2.7.17-2ubuntu4) ... Selecting previously unselected package python-is-python2. Preparing to unpack .../5-python-is-python2_2.7.17-4_all.deb ... Unpacking python-is-python2 (2.7.17-4) ... Selecting previously unselected package python2.7-dev. Preparing to unpack .../6-python2.7-dev_2.7.18-1~20.04.1_amd64.deb ... Unpacking python2.7-dev (2.7.18-1~20.04.1) ... Selecting previously unselected package python2-dev. Preparing to unpack .../7-python2-dev_2.7.17-2ubuntu4_amd64.deb ... Unpacking python2-dev (2.7.17-2ubuntu4) ... Selecting previously unselected package python-dev-is-python2. Preparing to unpack .../8-python-dev-is-python2_2.7.17-4_all.deb ... Unpacking python-dev-is-python2 (2.7.17-4) ... Setting up libpython2.7-stdlib:amd64 (2.7.18-1~20.04.1) ... Setting up libexpat1-dev:amd64 (2.2.9-1build1) ... Setting up libpython2.7:amd64 (2.7.18-1~20.04.1) ... Setting up libpython2.7-dev:amd64 (2.7.18-1~20.04.1) ... Setting up python2.7 (2.7.18-1~20.04.1) ... Setting up libpython2-stdlib:amd64 (2.7.17-2ubuntu4) ... Setting up python2 (2.7.17-2ubuntu4) ... Setting up libpython2-dev:amd64 (2.7.17-2ubuntu4) ... Setting up python-is-python2 (2.7.17-4) ... Setting up python2.7-dev (2.7.18-1~20.04.1) ... Setting up python2-dev (2.7.17-2ubuntu4) ... Setting up python-dev-is-python2 (2.7.17-4) ... Processing triggers for libc-bin (2.31-0ubuntu9.2) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for mime-support (3.64ubuntu1) ... Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libpython3-dev libpython3.8 libpython3.8-dev libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-dev python3.8-minimal zlib1g-dev Suggested packages: python3.8-venv python3.8-doc binfmt-support The following NEW packages will be installed: libpython3-dev libpython3.8-dev python3-dev python3.8-dev zlib1g-dev The following packages will be upgraded: libpython3.8 libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-minimal 5 upgraded, 5 newly installed, 0 to remove and 73 not upgraded. Need to get 10.9 MB of archives. After this operation, 21.2 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8 amd64 3.8.10-0ubuntu1~20.04 [387 kB] Get:2 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8 amd64 3.8.10-0ubuntu1~20.04 [1625 kB] Get:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-stdlib amd64 3.8.10-0ubuntu1~20.04 [1675 kB] Get:4 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-minimal amd64 3.8.10-0ubuntu1~20.04 [1898 kB] Get:5 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-minimal amd64 3.8.10-0ubuntu1~20.04 [717 kB] Get:6 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04 [3943 kB] Get:7 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7236 B] Get:8 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.2 [155 kB] Get:9 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04 [510 kB] Get:10 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1212 B] Fetched 10.9 MB in 0s (42.5 MB/s) (Reading database ... 66030 files and directories currently installed.) Preparing to unpack .../0-python3.8_3.8.10-0ubuntu1~20.04_amd64.deb ... Unpacking python3.8 (3.8.10-0ubuntu1~20.04) over (3.8.5-1~20.04.2) ... Preparing to unpack .../1-libpython3.8_3.8.10-0ubuntu1~20.04_amd64.deb ... Unpacking libpython3.8:amd64 (3.8.10-0ubuntu1~20.04) over (3.8.5-1~20.04.2) ... Preparing to unpack .../2-libpython3.8-stdlib_3.8.10-0ubuntu1~20.04_amd64.deb ... Unpacking libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04) over (3.8.5-1~20.04.2) ... Preparing to unpack .../3-python3.8-minimal_3.8.10-0ubuntu1~20.04_amd64.deb ... Unpacking python3.8-minimal (3.8.10-0ubuntu1~20.04) over (3.8.5-1~20.04.2) ... Preparing to unpack .../4-libpython3.8-minimal_3.8.10-0ubuntu1~20.04_amd64.deb ... Unpacking libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04) over (3.8.5-1~20.04.2) ... Selecting previously unselected package libpython3.8-dev:amd64. Preparing to unpack .../5-libpython3.8-dev_3.8.10-0ubuntu1~20.04_amd64.deb ... Unpacking libpython3.8-dev:amd64 (3.8.10-0ubuntu1~20.04) ... Selecting previously unselected package libpython3-dev:amd64. Preparing to unpack .../6-libpython3-dev_3.8.2-0ubuntu2_amd64.deb ... Unpacking libpython3-dev:amd64 (3.8.2-0ubuntu2) ... Selecting previously unselected package zlib1g-dev:amd64. Preparing to unpack .../7-zlib1g-dev_1%3a1.2.11.dfsg-2ubuntu1.2_amd64.deb ... Unpacking zlib1g-dev:amd64 (1:1.2.11.dfsg-2ubuntu1.2) ... Selecting previously unselected package python3.8-dev. Preparing to unpack .../8-python3.8-dev_3.8.10-0ubuntu1~20.04_amd64.deb ... Unpacking python3.8-dev (3.8.10-0ubuntu1~20.04) ... Selecting previously unselected package python3-dev. Preparing to unpack .../9-python3-dev_3.8.2-0ubuntu2_amd64.deb ... Unpacking python3-dev (3.8.2-0ubuntu2) ... Setting up libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04) ... Setting up zlib1g-dev:amd64 (1:1.2.11.dfsg-2ubuntu1.2) ... Setting up python3.8-minimal (3.8.10-0ubuntu1~20.04) ... Setting up libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04) ... Setting up python3.8 (3.8.10-0ubuntu1~20.04) ... Setting up libpython3.8:amd64 (3.8.10-0ubuntu1~20.04) ... Setting up libpython3.8-dev:amd64 (3.8.10-0ubuntu1~20.04) ... Setting up python3.8-dev (3.8.10-0ubuntu1~20.04) ... Setting up libpython3-dev:amd64 (3.8.2-0ubuntu2) ... Setting up python3-dev (3.8.2-0ubuntu2) ... Processing triggers for libc-bin (2.31-0ubuntu9.2) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for mime-support (3.64ubuntu1) ... Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: pip in ./.local/lib/python3.9/site-packages (21.1.3) Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: pip in ./.local/lib/python3.9/site-packages (21.1.3) Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (45.2.0) Collecting setuptools Downloading setuptools-57.4.0-py3-none-any.whl (819 kB) |████████████████████████████████| 819 kB 5.0 MB/s Installing collected packages: setuptools ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. launchpadlib 1.10.13 requires testresources, which is not installed. Successfully installed setuptools-57.4.0 Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: wheel in ./.local/lib/python3.9/site-packages (0.36.2) Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: dpkg-dev fakeroot g++ g++-9 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libfakeroot libfile-fcntllock-perl libstdc++-9-dev make Suggested packages: debian-keyring g++-multilib g++-9-multilib gcc-9-doc bzr libstdc++-9-doc make-doc The following NEW packages will be installed: build-essential dpkg-dev fakeroot g++ g++-9 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libfakeroot libfile-fcntllock-perl libstdc++-9-dev make 0 upgraded, 13 newly installed, 0 to remove and 73 not upgraded. Need to get 11.4 MB of archives. After this operation, 52.2 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libstdc++-9-dev amd64 9.3.0-17ubuntu1~20.04 [1714 kB] Get:2 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 g++-9 amd64 9.3.0-17ubuntu1~20.04 [8405 kB] Get:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 g++ amd64 4:9.3.0-1ubuntu2 [1604 B] Get:4 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 make amd64 4.2.1-1.2 [162 kB] Get:5 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libdpkg-perl all 1.19.7ubuntu3 [230 kB] Get:6 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 dpkg-dev all 1.19.7ubuntu3 [679 kB] Get:7 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 build-essential amd64 12.8ubuntu1.1 [4664 B] Get:8 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libfakeroot amd64 1.24-1 [25.7 kB] Get:9 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 fakeroot amd64 1.24-1 [62.6 kB] Get:10 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libalgorithm-diff-perl all 1.19.03-2 [46.6 kB] Get:11 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libalgorithm-diff-xs-perl amd64 0.04-6 [11.3 kB] Get:12 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libalgorithm-merge-perl all 0.08-3 [12.0 kB] Get:13 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libfile-fcntllock-perl amd64 0.22-3build4 [33.1 kB] Fetched 11.4 MB in 0s (54.8 MB/s) Selecting previously unselected package libstdc++-9-dev:amd64. (Reading database ... 66237 files and directories currently installed.) Preparing to unpack .../00-libstdc++-9-dev_9.3.0-17ubuntu1~20.04_amd64.deb ... Unpacking libstdc++-9-dev:amd64 (9.3.0-17ubuntu1~20.04) ... Selecting previously unselected package g++-9. Preparing to unpack .../01-g++-9_9.3.0-17ubuntu1~20.04_amd64.deb ... Unpacking g++-9 (9.3.0-17ubuntu1~20.04) ... Selecting previously unselected package g++. Preparing to unpack .../02-g++_4%3a9.3.0-1ubuntu2_amd64.deb ... Unpacking g++ (4:9.3.0-1ubuntu2) ... Selecting previously unselected package make. Preparing to unpack .../03-make_4.2.1-1.2_amd64.deb ... Unpacking make (4.2.1-1.2) ... Selecting previously unselected package libdpkg-perl. Preparing to unpack .../04-libdpkg-perl_1.19.7ubuntu3_all.deb Get:87 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 tcl8.6 amd64 8.6.10+dfsg-1 [14.8 kB] Get:88 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 tcl amd64 8.6.9+1 [5112 B] Get:89 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 tcl8.6-dev amd64 8.6.10+dfsg-1 [905 kB] Get:90 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 tcl-dev amd64 8.6.9+1 [5760 B] Get:91 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 tk8.6 amd64 8.6.10-1 [12.5 kB] Get:92 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 tk amd64 8.6.9+1 [3240 B] Get:93 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 tk8.6-dev amd64 8.6.10-1 [711 kB] Get:94 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 tk-dev amd64 8.6.9+1 [3076 B] Get:95 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libglvnd0 amd64 1.3.2-1~ubuntu0.20.04.1 [51.4 kB] Get:96 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libglx0 amd64 1.3.2-1~ubuntu0.20.04.1 [32.6 kB] Get:97 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgl1 amd64 1.3.2-1~ubuntu0.20.04.1 [86.9 kB] Get:98 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 x11-utils amd64 7.7+5 [199 kB] Get:99 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 xbitmaps all 1.1.1-2 [28.1 kB] Get:100 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/universe amd64 xterm amd64 353-1ubuntu1.20.04.2 [765 kB] Get:101 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libffi-dev amd64 3.3-4 [57.0 kB] Get:102 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 liblzma-dev amd64 5.2.4-1ubuntu1 [147 kB] Get:103 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libreadline-gplv2-dev amd64 5.2+dfsg-3build3 [125 kB] Fetched 47.5 MB in 1s (53.2 MB/s) Extracting templates from packages: 100% Preconfiguring packages ... Created wheel for p5py: filename=p5py-1.0.0-py2.py3-none-any.whl size=2333 sha256=e7417e00f0c9701b6889208ba42a352140b10d38748267029e0b3f5adb557857 Stored in directory: /home/ubuntu/.cache/pip/wheels/72/c3/3e/d2e21f7f687d90134f4774eee0b36f1b3303ef35d4ebf832c7 Successfully built p5py Installing collected packages: p5py Successfully installed p5py-1.0.0 Defaulting to user installation because normal site-packages is not writeable Collecting PEP517 Downloading pep517-0.11.0-py2.py3-none-any.whl (19 kB) Collecting tomli Downloading tomli-1.0.4-py3-none-any.whl (11 kB) Installing collected packages: tomli, PEP517 Successfully installed PEP517-0.11.0 tomli-1.0.4 Defaulting to user installation because normal site-packages is not writeable Collecting py-find-1st Downloading py_find_1st-1.1.5.tar.gz (8.8 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Collecting numpy>=1.13.0 Downloading numpy-1.21.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.8 MB) |████████████████████████████████| 15.8 MB 6.0 MB/s Building wheels for collected packages: py-find-1st Building wheel for py-find-1st (PEP 517) ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3.9 /home/ubuntu/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp47_3kk6k cwd: /tmp/pip-install-pvu0gblm/py-find-1st_36eb63373254485b8448e2b46d13c71f Complete output (20 lines): /tmp/pip-build-env-qm53q7xb/overlay/lib/python3.9/site-packages/setuptools/dist.py:697: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead warnings.warn( running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.9 creating build/lib.linux-x86_64-3.9/utils_find_1st copying utils_find_1st/__init__.py -> build/lib.linux-x86_64-3.9/utils_find_1st running build_ext check for clang compiler ... no building 'find_1st' extension creating build/temp.linux-x86_64-3.9 creating build/temp.linux-x86_64-3.9/utils_find_1st 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 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_13_API_VERSION -I/tmp/pip-build-env-qm53q7xb/overlay/lib/python3.9/site-packages/numpy/core/include -I/usr/include/python3.9 -c utils_find_1st/find_1st.cpp -o build/temp.linux-x86_64-3.9/utils_find_1st/find_1st.o utils_find_1st/find_1st.cpp:3:10: fatal error: Python.h: No such file or directory 3 | #include "Python.h" | ^~~~~~~~~~ compilation terminated. error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1 ---------------------------------------- ERROR: Failed building wheel for py-find-1st Failed to build py-find-1st ERROR: Could not build wheels for py-find-1st which use PEP 517 and cannot be installed directly     If you would like to reproduce the error, you can start a t2.micro ec2 running ubuntu20 and run the script listed above

Answer: This seems to be an issue with the module you are trying to install and not the header itself. The py-find-1st is a rather exotic module (9 stars on GitHub at the time of writing) and the build problem of this sort has been already reported. Solutions: Install libpython3.9 sudo apt install libpython3.9-dev  Edit: this solution worked, the OP was missing include/python3.9/Python.h header that's in the libpython3.9-dev. Forget about that module The module implements one function for "finding first indices without requiring to read the full array" which (partially) can be implemented as: def find_1st(X): ind = np.flatnonzero(X < 0.) if len(ind) : return ind[0] else: return -1  Problem is, this reads full array. If you arrays are too large, you might consider running this in a loop.