Tf-pose-estimation: installing pycocotools

Created on 8 May 2019  ·  16Comments  ·  Source: ildoonet/tf-pose-estimation

Most helpful comment

hi roopahtshree,

To resolve above issue you need to follow below steps.

step 1: While executing requirements.txt file remove pycocotools and proceed with rest of the installation.
step 2: Run command -> pip install --upgrade cython
step 3: Use this link to clone the recent coco module: https://github.com/philferriere/cocoapi
(git clone https://github.com/philferriere/cocoapi )

step 4: cd cocoapi/PythonAPI/
step 5: python setup.py install

thanks,
mayank

All 16 comments

(tfpose) C:UsersdharmaDesktoptf-openpose>pip3 install pycocotools
Collecting pycocotools
Using cached https://files.pythonhosted.org/packages/96/84/9a07b1095fd8555ba3f3d519517c8743c2554a245f9476e5e39869f948d2/pycocotools-2.0.0.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "", line 1, in
File "C:UsersdharmaAppDataLocalTemppip-install-s7qbge4mpycocotoolssetup.py", line 2, in
from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:UsersdharmaAppDataLocalTemppip-install-s7qbge4mpycocotools

(tfpose) C:\Users\dharma\Desktop\tf-openpose>pip3 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: Complete output from command 'c:\users\dharma\desktop\tf-openpose\tfpose\scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\dharma\AppData\Local\Temp\pip-install-t0xhj1a7\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\dharma\AppData\Local\Temp\pip-wheel-81vk9qru' --python-tag cp36:
ERROR: 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
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\dharma\desktop\tf-openpose\tfpose\lib\site-packages\numpy\core\include -Icommon -Ic:\users\dharma\appdata\local\programs\python\python36\include -Ic:\users\dharma\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\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: Complete output from command 'c:\users\dharma\desktop\tf-openpose\tfpose\scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\dharma\AppData\Local\Temp\pip-install-t0xhj1a7\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\dharma\AppData\Local\Temp\pip-record-6iworebn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\dharma\desktop\tf-openpose\tfpose\include\site\python3.6\pycocotools':
ERROR: 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
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\dharma\desktop\tf-openpose\tfpose\lib\site-packages\numpy\core\include -Icommon -Ic:\users\dharma\appdata\local\programs\python\python36\include -Ic:\users\dharma\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command "'c:\users\dharma\desktop\tf-openpose\tfpose\scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\dharma\AppData\Local\Temp\pip-install-t0xhj1a7\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\dharma\AppData\Local\Temp\pip-record-6iworebn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\dharma\desktop\tf-openpose\tfpose\include\site\python3.6\pycocotools'" failed with error code 1 in C:\Users\dharma\AppData\Local\Temp\pip-install-t0xhj1a7\pycocotools\

@roopahtshree You need to run pip3 install Cython before.

hi roopahtshree,

To resolve above issue you need to follow below steps.

step 1: While executing requirements.txt file remove pycocotools and proceed with rest of the installation.
step 2: Run command -> pip install --upgrade cython
step 3: Use this link to clone the recent coco module: https://github.com/philferriere/cocoapi
(git clone https://github.com/philferriere/cocoapi )

step 4: cd cocoapi/PythonAPI/
step 5: python setup.py install

thanks,
mayank

hi roopahtshree,

To resolve above issue you need to follow below steps.

step 1: While executing requirements.txt file remove pycocotools and proceed with rest of the installation.
step 2: Run command -> pip install --upgrade cython
step 3: Use this link to clone the recent coco module: https://github.com/philferriere/cocoapi
(git clone https://github.com/philferriere/cocoapi )

step 4: cd cocoapi/PythonAPI/
step 5: python setup.py install

thanks,
mayank

Searched a lot on this but nothing worked. Your solution worked like a charm ! Thanks a lot.

sorry bro @143mayank , can you explain the first step ?

hi roopahtshree,

To resolve above issue you need to follow below steps.

step 1: While executing requirements.txt file remove pycocotools and proceed with rest of the installation.
step 2: Run command -> pip install --upgrade cython
step 3: Use this link to clone the recent coco module: https://github.com/philferriere/cocoapi
(git clone https://github.com/philferriere/cocoapi )

step 4: cd cocoapi/PythonAPI/
step 5: python setup.py install

thanks,
mayank

adding to @143mayank 's answer, if someone is still getting error then do step 3.5: sudo apt install libc6-dev. It solved mine issue related to limits.h file not found error.

sorry bro @143mayank , can you explain the first step ?

@AHMEDSABER097
put the following lines into file name requirements.txt

dill
fire
matplotlib
numba
psutil
requests
scikit-image
scipy
slidingwindow
tqdm
git+https://github.com/ppwwyyxx/tensorpack.git

and then run command pip install -r requirements.txt

Hi @143mayank , could you please let me know the exact location of the requirements.txt file?

set DISTUTILS_USE_SDK=1

(tfpose) C:\Users\dharma\Desktop\tf-openpose>pip3 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: Complete output from command 'c:\users\dharma\desktop\tf-openpose\tfpose\scripts\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\dharma\AppData\Local\Temp\pip-install-t0xhj1a7\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\dharma\AppData\Local\Temp\pip-wheel-81vk9qru' --python-tag cp36:
ERROR: 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
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\dharma\desktop\tf-openpose\tfpose\lib\site-packages\numpy\core\include -Icommon -Ic:\users\dharma\appdata\local\programs\python\python36\include -Ic:\users\dharma\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\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: Complete output from command 'c:\users\dharma\desktop\tf-openpose\tfpose\scripts\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\dharma\AppData\Local\Temp\pip-install-t0xhj1a7\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\dharma\AppData\Local\Temp\pip-record-6iworebn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\dharma\desktop\tf-openpose\tfpose\include\site\python3.6\pycocotools':
ERROR: 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
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\dharma\desktop\tf-openpose\tfpose\lib\site-packages\numpy\core\include -Icommon -Ic:\users\dharma\appdata\local\programs\python\python36\include -Ic:\users\dharma\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj -Wno-cpp -Wno-unused-function -std=c99
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'

error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Command "'c:\users\dharma\desktop\tf-openpose\tfpose\scripts\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\dharma\AppData\Local\Temp\pip-install-t0xhj1a7\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\dharma\AppData\Local\Temp\pip-record-6iworebn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\dharma\desktop\tf-openpose\tfpose\include\site\python3.6\pycocotools'" failed with error code 1 in C:\Users\dharma\AppData\Local\Temp\pip-install-t0xhj1a7\pycocotools\

Hai, follow the below steps to install pycocotools, this method will work for sure.

  1. Install Microsoft Visula Studio C++ with following link - https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017 (Select community version)
  2. While installing select workloads of C++ builds and start installing visual studio.
  3. After installing there is small process for copying files and creating path in system path as follows.
    a) C:\Program Files (x86)\Windows Kits\10\bin\x64 add this particular path to your system
    path.
    b) copy these files rc.exe & rcdll.dll from C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86 to C:\Program Files (x86)\MIcrosoft Visual Studi 14.0\VC\bin
  4. Install git on your machine
    a) First install chocolatey through cmd- https://chocolatey.org/docs/installation
    b) then run choco install git through cmd
  5. Go to CMD run pip install Cython
  6. and then install pycocotools with the following
    pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

This process will sort the error for, let me know if you face any error.

running install
running build
running build_py
running build_ext
building 'pycocotools._mask' extension
error: Unable to find vcvarsall.bat

C:UserskiranDesktopwindows_v1.8.0cocoapi-masterPythonAPI>python setup.py install
running install
running build
running build_py
running build_ext
building 'pycocotools._mask' extension
C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.25.28610binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Userskirananaconda3libsite-packagesnumpycoreinclude -I../common -IC:Userskirananaconda3include -IC:Userskirananaconda3include "-IC:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.25.28610include" /Tcpycocotools/_mask.c /Fobuildtemp.win-amd64-3.7Releasepycocotools/_mask.obj
_mask.c
C:Userskirananaconda3includepyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe' failed with exit status 2

i had solve this problem by installing visual studio build tools
download link
http://go.microsoft.com/fwlink/?LinkId=691126
How to deal with the pain of “unable to find vcvarsall.bat”
https://devblogs.microsoft.com/python/unable-to-find-vcvarsall-bat/

To install and compile to your anaconda/python site-packages, simply run:
$ pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Note that the original compile flags below are GCC flags unsupported by the Visual C++ 2015 build tools.
They can safely be removed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guofuzheng picture guofuzheng  ·  6Comments

khaerulumam42 picture khaerulumam42  ·  6Comments

siddharthrajpatel picture siddharthrajpatel  ·  4Comments

Minotaur-CN picture Minotaur-CN  ·  4Comments

vladbelo picture vladbelo  ·  4Comments