Failed building wheel for pycocotools ubuntu

We list some potential troubles encountered by users and developers, along with their corresponding solutions. Feel free to enrich the list if you find any frequent issues and contribute your solutions to solve them. If you have any trouble with environment configuration, model training, etc, please create an issue using the provided templates and fill in all required information in the template.

MMCV/MMDet/MMDet3D Installation¶

  • If you faced the error shown below when importing open3d:

    OSError: /lib/x86_64-linux-gnu/libm.so.6: version 'GLIBC_2.27' not found

    please downgrade open3d to 0.9.0.0, because the latest open3d needs the support of file ‘GLIBC_2.27’, which only exists in Ubuntu 18.04, not in Ubuntu 16.04.

  • If you faced the error when importing pycocotools, this is because nuscenes-devkit installs pycocotools but mmdet relies on mmpycocotools. The current workaround is as below. We will migrate to use pycocotools in the future.

    pip uninstall pycocotools mmpycocotools
    pip install mmpycocotools
    

    NOTE: We have migrated to use pycocotools in mmdet3d >= 0.13.0.

  • If you face the error shown below, and your environment contains numba == 0.48.0 with numpy >= 1.20.0:

    TypeError: expected dtype object, got 'numpy.dtype[bool_]'

    please downgrade numpy to < 1.20.0 or install numba == 0.48 from source, because in numpy == 1.20.0, np.dtype produces subclass due to API change. Please refer to here for more details.

  • If you face the error shown below when importing pycocotools:

    ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

    please downgrade pycocotools to 2.0.1 because of the incompatibility between the newest pycocotools and numpy < 1.20.0. Or you can compile and install the latest pycocotools from source as below:

    pip install -e "git+https://github.com/cocodataset/cocoapi#egg=pycocotools&subdirectory=PythonAPI"

    or

    pip install -e "git+https://github.com/ppwwyyxx/cocoapi#egg=pycocotools&subdirectory=PythonAPI"

How to annotate point cloud?¶

MMDetection3D does not support point cloud annotation. Some open-source annotation tool are offered for reference:

  • SUSTechPOINTS

  • LATTE

Besides, we improved LATTE for better use. More details can be found here.

(CV202001) PS C:\Users\niu> pip install pycocotools

Collecting pycocotools

  Using cached https://files.pythonhosted.org/packages/96/84/9a07b1095fd8555ba3f3d519517c8743c2554a245f9476e5e39869f948d2/pycocotools-2.0.0.tar.gz

Building wheels for collected packages: pycocotools

  Building wheel for pycocotools (setup.py) ... error

  ERROR: Command errored out with exit status 1:

   command: 'D:\ProgramData\Anaconda3\envs\CV202001\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\niu\AppData\Local\Temp\pip-wheel-_fwfwnii' --python-tag cp36

       cwd: C:\Users\niu\AppData\Local\Temp\pip-install-f24aas2b\pycocotools\

  Complete output (19 lines):

  running bdist_wheel

  running build

  running build_py

  creating build

  creating build\lib.win-amd64-3.6

  creating build\lib.win-amd64-3.6\pycocotools

  copying pycocotools\coco.py -> build\lib.win-amd64-3.6\pycocotools

  copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.6\pycocotools

  copying pycocotools\mask.py -> build\lib.win-amd64-3.6\pycocotools

  copying pycocotools\__init__.py -> build\lib.win-amd64-3.6\pycocotools

  running build_ext

  building 'pycocotools._mask' extension

  creating build\temp.win-amd64-3.6

  creating build\temp.win-amd64-3.6\Release

  creating build\temp.win-amd64-3.6\Release\pycocotools

  creating build\temp.win-amd64-3.6\Release\common

  D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\ProgramData\Anaconda3\envs\CV202001\lib\site-packages\numpy\core\include -Icommon -ID:\ProgramData\Anaconda3\envs\CV202001\include -ID:\ProgramData\Anaconda3\envs\CV202001\include "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99

  cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”

  error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 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: 'D:\ProgramData\Anaconda3\envs\CV202001\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\niu\AppData\Local\Temp\pip-record-8f1bp3n2\install-record.txt' --single-version-externally-managed --compile

         cwd: C:\Users\niu\AppData\Local\Temp\pip-install-f24aas2b\pycocotools\

    Complete output (19 lines):

    running install

    running build

    running build_py

    creating build

    creating build\lib.win-amd64-3.6

    creating build\lib.win-amd64-3.6\pycocotools

    copying pycocotools\coco.py -> build\lib.win-amd64-3.6\pycocotools

    copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.6\pycocotools

    copying pycocotools\mask.py -> build\lib.win-amd64-3.6\pycocotools

    copying pycocotools\__init__.py -> build\lib.win-amd64-3.6\pycocotools

    running build_ext

    building 'pycocotools._mask' extension

    creating build\temp.win-amd64-3.6

    creating build\temp.win-amd64-3.6\Release

    creating build\temp.win-amd64-3.6\Release\pycocotools

    creating build\temp.win-amd64-3.6\Release\common

    D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\ProgramData\Anaconda3\envs\CV202001\lib\site-packages\numpy\core\include -Icommon -ID:\ProgramData\Anaconda3\envs\CV202001\include -ID:\ProgramData\Anaconda3\envs\CV202001\include "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\\winrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99

    cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”

    error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------

ERROR: Command errored out with exit status 1: 'D:\ProgramData\Anaconda3\envs\CV202001\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"'; __file__='"'"'C:\\Users\\niu\\AppData\\Local\\Temp\\pip-install-f24aas2b\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\User