title: Troubleshooting pycocotools installation
body: <p>I'm trying to use object detection models from Tensorflow and need to get pycocotools installed. I'm doing this from a python (3) virtual environment on a Windows 10 machine. There seems to be some known issues around getting this working on Windows, and I'm pretty sure I've tried them all.</p>
  <p>I've tried pip-installing pycocotools, with this error (fails building wheel):</p>
  <pre><code>(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection&gt; pip install pycocotools
  Collecting pycocotools
    Using cached pycocotools-2.0.2.tar.gz (23 kB)
  Requirement already satisfied: setuptools&gt;=18.0 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from pycocotools) (56.0.0)
  Requirement already satisfied: cython&gt;=0.27.3 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from pycocotools) (0.29.23)
  Requirement already satisfied: matplotlib&gt;=2.1.0 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from pycocotools) (3.4.2)
  Requirement already satisfied: pyparsing&gt;=2.2.1 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib&gt;=2.1.0-&gt;pycocotools) (2.4.7)
  Requirement already satisfied: cycler&gt;=0.10 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib&gt;=2.1.0-&gt;pycocotools) (0.10.0)
  Requirement already satisfied: pillow&gt;=6.2.0 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib&gt;=2.1.0-&gt;pycocotools) (8.2.0)
  Requirement already satisfied: numpy&gt;=1.16 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib&gt;=2.1.0-&gt;pycocotools) (1.19.5)
  Requirement already satisfied: kiwisolver&gt;=1.0.1 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib&gt;=2.1.0-&gt;pycocotools) (1.3.1)
  Requirement already satisfied: python-dateutil&gt;=2.7 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib&gt;=2.1.0-&gt;pycocotools) (2.8.1)
  Requirement already satisfied: six in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from cycler&gt;=0.10-&gt;matplotlib&gt;=2.1.0-&gt;pycocotools) (1.15.0)
  Building wheels for collected packages: pycocotools
    Building wheel for pycocotools (setup.py) ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' bdist_wheel -d 'C:\Users\la01043601\AppData\Local\Temp\pip-wheel-i_wesduj'
         cwd: C:\Users\la01043601\AppData\Local\Temp\pip-install-hjka7e0k\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\
    Complete output (23 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 -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\cocoeval.py -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\mask.py -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\__init__.py -&gt; build\lib.win-amd64-3.9\pycocotools
    running build_ext
    cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
    c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\la01043601\AppData\Local\Temp\pip-install-hjka7e0k\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\pycocotools\_mask.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    building 'pycocotools._mask' extension
    creating build\temp.win-amd64-3.9
    creating build\temp.win-amd64-3.9\Release
    creating build\temp.win-amd64-3.9\Release\common
    creating build\temp.win-amd64-3.9\Release\pycocotools
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I./common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc./common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\./common/maskApi.obj
    maskApi.c
    ./common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
    ERROR: Failed building wheel for pycocotools
    Running setup.py clean for pycocotools
  Failed to build pycocotools
  Installing collected packages: pycocotools
      Running setup.py install for pycocotools ... error
      ERROR: Command errored out with exit status 1:
       command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' install --record 'C:\Users\la01043601\AppData\Local\Temp\pip-record-crzypf9k\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\la01043601\ml_cameravision\humandetection\env\include\site\python3.9\pycocotools'
           cwd: C:\Users\la01043601\AppData\Local\Temp\pip-install-hjka7e0k\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\
      Complete output (21 lines):
      running install
      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 -&gt; build\lib.win-amd64-3.9\pycocotools
      copying pycocotools\cocoeval.py -&gt; build\lib.win-amd64-3.9\pycocotools
      copying pycocotools\mask.py -&gt; build\lib.win-amd64-3.9\pycocotools
      copying pycocotools\__init__.py -&gt; build\lib.win-amd64-3.9\pycocotools
      running build_ext
      skipping 'pycocotools\_mask.c' Cython extension (up-to-date)
      building 'pycocotools._mask' extension
      creating build\temp.win-amd64-3.9
      creating build\temp.win-amd64-3.9\Release
      creating build\temp.win-amd64-3.9\Release\common
      creating build\temp.win-amd64-3.9\Release\pycocotools
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I./common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc./common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\./common/maskApi.obj
      maskApi.c
      ./common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      ----------------------------------------
  ERROR: Command errored out with exit status 1: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' install --record 'C:\Users\la01043601\AppData\Local\Temp\pip-record-crzypf9k\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\la01043601\ml_cameravision\humandetection\env\include\site\python3.9\pycocotools' Check the logs for full command output.
  </code></pre>
  <p>I've tried the fix from Phil Ferriere's repository (still fails building wheel, something with math.h file not found):</p>
  <pre><code>(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection&gt; pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
  Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
    Cloning https://github.com/philferriere/cocoapi.git to c:\users\la01043601\appdata\local\temp\pip-req-build-htao1r08
    Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08'
  Building wheels for collected packages: pycocotools
    Building wheel for pycocotools (setup.py) ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' bdist_wheel -d 'C:\Users\la01043601\AppData\Local\Temp\pip-wheel-kktx8s70'
         cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08\PythonAPI
    Complete output (20 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 -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\cocoeval.py -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\mask.py -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\__init__.py -&gt; build\lib.win-amd64-3.9\pycocotools
    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.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I../common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
    maskApi.c
    ../common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
    ERROR: Failed building wheel for pycocotools
    Running setup.py clean for pycocotools
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' clean --all
         cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08
    Complete output (11 lines):
    Traceback (most recent call last):
      File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
      File &quot;C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08\PythonAPI\setup.py&quot;, line 25, in &lt;module&gt;
        cythonize(ext_modules)
      File &quot;c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py&quot;, line 965, in cythonize
        module_list, module_metadata = create_extension_list(
      File &quot;c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py&quot;, line 815, in create_extension_list
        for file in nonempty(sorted(extended_iglob(filepattern)), &quot;'%s' doesn't match any files&quot; % filepattern):
      File &quot;c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py&quot;, line 114, in nonempty
        raise ValueError(error_msg)
    ValueError: 'pycocotools/_mask.pyx' doesn't match any files
    ----------------------------------------
    ERROR: Failed cleaning build dir for pycocotools
  Failed to build pycocotools
  Installing collected packages: pycocotools
      Running setup.py install for pycocotools ... error
      ERROR: Command errored out with exit status 1:
       command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' install --record 'C:\Users\la01043601\AppData\Local\Temp\pip-record-ok0x1q7g\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\la01043601\ml_cameravision\humandetection\env\include\site\python3.9\pycocotools'
           cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08\PythonAPI
      Complete output (9 lines):
      running install
      running build
      running build_py
      running build_ext
      building 'pycocotools._mask' extension
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I../common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
      maskApi.c
      ../common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      ----------------------------------------
  ERROR: Command errored out with exit status 1: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' install --record 'C:\Users\la01043601\AppData\Local\Temp\pip-record-ok0x1q7g\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\la01043601\ml_cameravision\humandetection\env\include\site\python3.9\pycocotools' Check the logs for full command output.
  </code></pre>
  <p>I've tried installing Visual C++ Build Tools (2015 version recommended by many other answers), but got the error that it was unable to find/download setup package, so I've made sure I have updates to the 2019 build tools, and they are added to my path.
  Error I was getting is <a href="https://docs.microsoft.com/en-us/answers/questions/365971/unable-to-install-visual-c-build-tools.html" rel="nofollow noreferrer">like this one</a>. I also followed the video at the bottom of that solution and it didn't help.</p>
  <p>I've tried using the suggested windows install for pycocotools (pycocotools-windows), which gives the following error:</p>
  <pre><code>(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection&gt; pip install cocoapi-windows
  ERROR: Could not find a version that satisfies the requirement cocoapi-windows (from versions: none)
  ERROR: No matching distribution found for cocoapi-windows
  (env) PS C:\Users\la01043601\ML_CameraVision\humanDetection&gt; pip install pycocotools-windows
  ERROR: Could not find a version that satisfies the requirement pycocotools-windows (from versions: none)
  ERROR: No matching distribution found for pycocotools-windows
  </code></pre>
  <p>Python and pip are on my Windows path. I gave up on one tutorial due to this, just to find the next one has a pycocotools dependency too.</p>
  <p>(Also accepting suggestions for Tensorflow object detection tutorials that do not use pycocotools! Need a decent tutorial because I'm a beginner).</p>
  <p><strong>Edit:</strong> Have now also tried running the setup.py file the following way, still having issues with not finding a math.h file...</p>
  <pre><code>(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection\sandbox\cocoapi\PythonAPI&gt; python setup.py build_ext --inplace
  Compiling pycocotools/_mask.pyx because it changed.
  [1/1] Cythonizing pycocotools/_mask.pyx
  C:\Users\la01043601\ML_CameraVision\humanDetection\env\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\la01043601\ML_CameraVision\humanDetection\sandbox\cocoapi\PythonAPI\pycocotools\_mask.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  running build_ext
  building 'pycocotools._mask' extension
  creating build
  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.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\la01043601\ML_CameraVision\humanDetection\env\lib\site-packages\numpy\core\include -I../common -IC:\Users\la01043601\ML_CameraVision\humanDetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
  maskApi.c
  ../common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  </code></pre>
  <p><strong>Edit edit</strong> I forgot to mention that in the past couple days I also tried troubleshooting the <a href="https://stackoverflow.com/questions/24186647/c1083-cannot-open-include-file-math-h-no-such-file-or-directory">math.h error</a>, which suggests switching an include statement from &quot;math.h&quot; to &quot;cmath&quot;, and using &quot;quotes&quot; instead of angle brackets, and since this happens when installing from a downloaded repo I even forked the repo the made the change on <a href="https://github.com/Broccoli-Hunter/cocoapi" rel="nofollow noreferrer">my version</a> to download from there. Error as follows (now related to a missing 'crtdbg.h' file and I don't understand how everything works under the hood in Build Tools):</p>
  <pre><code>(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection&gt; pip install git+https://github.com/Broccoli-Hunter/cocoapi.git#subdirectory=PythonAPI
  Collecting git+https://github.com/Broccoli-Hunter/cocoapi.git#subdirectory=PythonAPI
    Cloning https://github.com/Broccoli-Hunter/cocoapi.git to c:\users\la01043601\appdata\local\temp\pip-req-build-atepfcnd
    Running command git clone -q https://github.com/Broccoli-Hunter/cocoapi.git 'C:\Users\la01043601\AppData\Local\Temp\pip-req-build-atepfcnd'
  Building wheels for collected packages: pycocotools
    Building wheel for pycocotools (setup.py) ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-atepfcnd\\PythonAPI\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-atepfcnd\\PythonAPI\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' bdist_wheel -d 'C:\Users\la01043601\AppData\Local\Temp\pip-wheel-4bje9txk'
         cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-atepfcnd\PythonAPI
    Complete output (20 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 -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\cocoeval.py -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\mask.py -&gt; build\lib.win-amd64-3.9\pycocotools
    copying pycocotools\__init__.py -&gt; build\lib.win-amd64-3.9\pycocotools
    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.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I../common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /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.30037\include\yvals.h(12): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
    ERROR: Failed building wheel for pycocotools
    Running setup.py clean for pycocotools
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-atepfcnd\\PythonAPI\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-atepfcnd\\PythonAPI\\setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' clean --all
         cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-atepfcnd
    Complete output (11 lines):
    Traceback (most recent call last):
      File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
      File &quot;C:\Users\la01043601\AppData\Local\Temp\pip-req-build-atepfcnd\PythonAPI\setup.py&quot;, line 25, in &lt;module&gt;
        cythonize(ext_modules)
      File &quot;c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py&quot;, line 965, in cythonize
        module_list, module_metadata = create_extension_list(
      File &quot;c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py&quot;, line 815, in create_extension_list
        for file in nonempty(sorted(extended_iglob(filepattern)), &quot;'%s' doesn't match any files&quot; % filepattern):
      File &quot;c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py&quot;, line 114, in nonempty
        raise ValueError(error_msg)
    ValueError: 'pycocotools/_mask.pyx' doesn't match any files
    ----------------------------------------
    ERROR: Failed cleaning build dir for pycocotools
  Failed to build pycocotools
  </code></pre>