Install pycocotools with pipenv on Windows 10

Hi,
I’m trying to install pycocotools on Windows 10 using pipenv. I have Python 3.9.5 and pip 21.2.2.
I have tried

pipenv install pycocotools
pipenv install pycocotools-windows
pipenv install cocoapi
pipenv install cocoapi-windows
pipenv install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

And other similar commands that I came across as I searched for a solution. I’m not sure what the correct package is nor do I know what, if any, prerequisites there are.

Either I get a result that says

ERROR: Could not find a version that satisfies the requirement cocoapi-windows (from versions: none)
ERROR: No matching distribution found for cocoapi-windows

or a much lengthier complaint about my transgressions:

(instance_segmentation-tZ6Nhj9L) C:\Users\Nightrunner\Documents\programming\instance_segmentation>pipenv install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI
Installing git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI...
Error:  An error occurred while installing git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI!
Error text: Collecting pycocotools
  Cloning https://github.com/philferriere/cocoapi.git to c:\users\nightrunner\appdata\local\temp\pip-install-2fk3dvpy\pycocotools_cff1e94e6e9541bf94515bdcca322aa5
  Resolved https://github.com/philferriere/cocoapi.git to commit 2929bd2ef6b451054755dfd7ceb09278f935f7ad
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (setup.py): started
  Building wheel for pycocotools (setup.py): finished with status 'error'
  Running setup.py clean for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
    Running setup.py install for pycocotools: started
    Running setup.py install for pycocotools: finished with status 'error'

  Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\Nightrunner\AppData\Local\Temp\pip-install-2fk3dvpy\pycocotools_cff1e94e6e9541bf94515bdcca322aa5'
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nightrunner\\AppData\\Local\\Temp\\pip-install-2fk3dvpy\\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nightrunner\\AppData\\Local\\Temp\\pip-install-2fk3dvpy\\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Nightrunner\AppData\Local\Temp\pip-wheel-2wq2_y57'
       cwd: C:\Users\Nightrunner\AppData\Local\Temp\pip-install-2fk3dvpy\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\PythonAPI
  Complete output (24 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\pycocotools
  copying pycocotools\coco.py -> build\lib.win-amd64-3.9\pycocotools
  copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.9\pycocotools
  copying pycocotools\mask.py -> build\lib.win-amd64-3.9\pycocotools
  copying pycocotools\__init__.py -> build\lib.win-amd64-3.9\pycocotools
  warning: build_py: byte-compiling is disabled, skipping.

  running build_ext
  building 'pycocotools._mask' extension
  creating build\temp.win-amd64-3.9
  creating build\temp.win-amd64-3.9\common
  creating build\temp.win-amd64-3.9\Release
  creating build\temp.win-amd64-3.9\Release\pycocotools
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\lib\site-packages\numpy\core\include -I../common -IC:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\include -IC:\OSGeo4W\apps\Python39\include -IC:\OSGeo4W\apps\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
  maskApi.c
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\lib\site-packages\numpy\core\include -I../common -IC:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\include -IC:\OSGeo4W\apps\Python39\include -IC:\OSGeo4W\apps\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.9\Release\pycocotools/_mask.obj
  _mask.c
  pycocotools/_mask.c(32): fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  ----------------------------------------
  ERROR: Failed building wheel for pycocotools
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nightrunner\\AppData\\Local\\Temp\\pip-install-2fk3dvpy\\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nightrunner\\AppData\\Local\\Temp\\pip-install-2fk3dvpy\\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
       cwd: C:\Users\Nightrunner\AppData\Local\Temp\pip-install-2fk3dvpy\pycocotools_cff1e94e6e9541bf94515bdcca322aa5
  Complete output (11 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Nightrunner\AppData\Local\Temp\pip-install-2fk3dvpy\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\PythonAPI\setup.py", line 25, in <module>
      cythonize(ext_modules)
    File "C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\lib\site-packages\Cython\Build\Dependencies.py", line 965, in cythonize
      module_list, module_metadata = create_extension_list(
    File "C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\lib\site-packages\Cython\Build\Dependencies.py", line 815, in create_extension_list
      for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
    File "C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty
      raise ValueError(error_msg)
  ValueError: 'pycocotools/_mask.pyx' doesn't match any files
  ----------------------------------------
  ERROR: Failed cleaning build dir for pycocotools
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nightrunner\\AppData\\Local\\Temp\\pip-install-2fk3dvpy\\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nightrunner\\AppData\\Local\\Temp\\pip-install-2fk3dvpy\\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nightrunner\AppData\Local\Temp\pip-record-vmbqgzsv\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\include\site\python3.9\pycocotools'
         cwd: C:\Users\Nightrunner\AppData\Local\Temp\pip-install-2fk3dvpy\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\PythonAPI
    Complete output (13 lines):
    running install
    running build
    running build_py
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    building 'pycocotools._mask' extension
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\lib\site-packages\numpy\core\include -I../common -IC:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\include -IC:\OSGeo4W\apps\Python39\include -IC:\OSGeo4W\apps\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
    maskApi.c
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\lib\site-packages\numpy\core\include -I../common -IC:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\include -IC:\OSGeo4W\apps\Python39\include -IC:\OSGeo4W\apps\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.9\Release\pycocotools/_mask.obj
    _mask.c
    pycocotools/_mask.c(32): fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nightrunner\\AppData\\Local\\Temp\\pip-install-2fk3dvpy\\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nightrunner\\AppData\\Local\\Temp\\pip-install-2fk3dvpy\\pycocotools_cff1e94e6e9541bf94515bdcca322aa5\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Nightrunner\AppData\Local\Temp\pip-record-vmbqgzsv\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Nightrunner\.virtualenvs\instance_segmentation-tZ6Nhj9L\include\site\python3.9\pycocotools' Check the logs for full command output.

Installation Failed

Is there a surefire way to get pycocotools installed with pipenv on Windows 10?