Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support for python API #9

Closed
willyd opened this issue Oct 19, 2015 · 25 comments
Closed

Windows support for python API #9

willyd opened this issue Oct 19, 2015 · 25 comments

Comments

@willyd
Copy link

willyd commented Oct 19, 2015

Please add windows support. Currently it is impossible to compile the python API with MSVC without modifications. I have made some modifications to fix the build. They can be viewed at https://github.com/pdollar/coco/compare/master...willyd:windows?expand=1.

@pdollar
Copy link
Collaborator

pdollar commented May 6, 2016

We will not be providing Windows support. Thanks and good luck!

@alexiskattan
Copy link

@willyd thank you!!!

@HarshalGarg
Copy link

https://github.com/philferriere/cocoapi

cocoapi with windows support

@HarshalGarg
Copy link

https://github.com/philferriere/cocoapi

coco api with windows support

@CHAMOD
Copy link

CHAMOD commented Jun 26, 2018

@HarshalGarg worked nicely

HedgehogCode added a commit to HedgehogCode/cocoapi that referenced this issue Jul 6, 2018
The decision that windows won't be supported has been made a long time ago (See issue cocodataset#9) but this is stated nowhere except this issue which leads to many confused people that think windows should be supported.
@yanfengliu
Copy link

yanfengliu commented Nov 12, 2018

The lack of support for Python API on Windows can be fixed with the following steps:

  1. Open setup.py
  2. Remove the line extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
  3. Runpython setup.py build_ext install

@DuaneNielsen
Copy link

You guys realize that one of your key sponsors is Microsoft, right?

@brannonbarr
Copy link

yanfengliu your solution worked for me, thanks for sharing it!

@yanfengliu
Copy link

yanfengliu commented Dec 7, 2018

@brannonbarr You are very welcome.

@Minxiangliu
Copy link

@yanfengliu I follow your step to build on Windows10 but I can't work.
Do you have any suggestions?
error message:

D:\cocoapi-master\cocoapi-master\PythonAPI>python setup.py build_ext install
running build_ext
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    ext_modules= ext_modules
  File "C:\Users\stust\Anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\stust\Anaconda3\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\stust\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\stust\Anaconda3\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\stust\Anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 78, in run
    _build_ext.run(self)
  File "C:\Users\stust\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "C:\Users\stust\Anaconda3\lib\distutils\command\build_ext.py", line 308, in run
    force=self.force)
  File "C:\Users\stust\Anaconda3\lib\distutils\ccompiler.py", line 1031, in new_compiler
    return klass(None, dry_run, force)
  File "C:\Users\stust\Anaconda3\lib\distutils\cygwinccompiler.py", line 285, in __init__
    CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Users\stust\Anaconda3\lib\distutils\cygwinccompiler.py", line 129, in __init__
    if self.ld_version >= "2.10.90":
TypeError: unorderable types: NoneType() >= str()

@yanfengliu
Copy link

@Minxiangliu I did some searching with the keyword

if self.ld_version >= "2.10.90":
TypeError: unorderable types: NoneType() >= str()

and it seems that this issue is not particularly related to MSCOCO. You might find this or this helpful though.

@zarabozdag
Copy link

@yanfengliu the solution works for me, thanks

@potoo0
Copy link

potoo0 commented Jun 5, 2019

The lack of support for Python API on Windows can be fixed with the following steps:

  1. Open setup.py
  2. Remove the line extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
  3. Runpython setup.py build_ext install

Excellent, it works. Thanks.

@maria-mh07
Copy link

I am following the steps of @yanfengliu (for Python API on Windows). But I get the following error:
fatal error C1083: Cannot open file include: 'math.h': No such file or directory
Any help?

@rafwaf
Copy link

rafwaf commented Jan 29, 2020

Hi @pdollar,
Obviously you don't owe us (the users of cocoAPI) any answers, and what you contribute to this project and which OS's you support is totally up to you and/or your employer... but, may we ask why is it not supported? what is the rationale? Is it not spreading resources too thin, committing to support more OS's? I'm merely curious about this. Thanks in advance.

p.s. to anyone who may care: @yanfengliu 's solution worked for me too and seems to be the easiest/fastest fix.

@quaesitor-scientiam
Copy link

@yanfengliu worked perfectly on Windows 10 Pro 1909 with VS 2019 installed and Python 3.7.4

@anonymouss
Copy link

https://github.com/philferriere/cocoapi

cocoapi with windows support

I installed it successfully with this repo on Windows 10

Full steps:

  1. install any dependency if missing like cython, etc.
  2. install Visual C++ 14/2015 build tools, NOTE: window 10 SDK is required to be selected if choose custom option (or windows 8.1 SDK depends on your system)
  3. pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

@tirthraj13
Copy link

(base) C:\Users\tmcde>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\tmcde\appdata\local\temp\pip-req-build-77lgppkj
Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj'
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\tmcde\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\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\tmcde\AppData\Local\Temp\pip-wheel-38f65ymy'
cwd: C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI
Complete output (20 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools_init_.py -> build\lib.win-amd64-3.7\pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\pycocotools
creating build\temp.win-amd64-3.7\common
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\tmcde\anaconda3\lib\site-packages\numpy\core\include -I../common -Ic:\users\tmcde\anaconda3\include -Ic:\users\tmcde\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.7\Release\pycocotools/_mask.obj
_mask.c
c:\users\tmcde\anaconda3\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\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
ERROR: Command errored out with exit status 1:
command: 'c:\users\tmcde\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' clean --all
cwd: C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj
Complete output (11 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py", line 25, in
cythonize(ext_modules)
File "c:\users\tmcde\anaconda3\lib\site-packages\Cython\Build\Dependencies.py", line 966, in cythonize
aliases=aliases)
File "c:\users\tmcde\anaconda3\lib\site-packages\Cython\Build\Dependencies.py", line 810, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "c:\users\tmcde\anaconda3\lib\site-packages\Cython\Build\Dependencies.py", line 109, 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\tmcde\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\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\tmcde\AppData\Local\Temp\pip-record-zmu70pen\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\tmcde\anaconda3\Include\pycocotools'
cwd: C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\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 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\tmcde\anaconda3\lib\site-packages\numpy\core\include -I../common -Ic:\users\tmcde\anaconda3\include -Ic:\users\tmcde\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.7\Release\pycocotools/_mask.obj
_mask.c
c:\users\tmcde\anaconda3\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\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: 'c:\users\tmcde\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\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\tmcde\AppData\Local\Temp\pip-record-zmu70pen\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\tmcde\anaconda3\Include\pycocotools' Check the logs for full command output.

i still facing this problem . so, plz help me to overcome this issue.

@TheVIbhav
Copy link

(base) C:\Users\tmcde>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\tmcde\appdata\local\temp\pip-req-build-77lgppkj
Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj'
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\tmcde\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\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\tmcde\AppData\Local\Temp\pip-wheel-38f65ymy'
cwd: C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI
Complete output (20 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.7\pycocotools
copying pycocotools__init__.py -> build\lib.win-amd64-3.7\pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\pycocotools
creating build\temp.win-amd64-3.7\common
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\tmcde\anaconda3\lib\site-packages\numpy\core\include -I../common -Ic:\users\tmcde\anaconda3\include -Ic:\users\tmcde\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.7\Release\pycocotools/_mask.obj
_mask.c
c:\users\tmcde\anaconda3\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\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
ERROR: Command errored out with exit status 1:
command: 'c:\users\tmcde\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' clean --all
cwd: C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj
Complete output (11 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py", line 25, in
cythonize(ext_modules)
File "c:\users\tmcde\anaconda3\lib\site-packages\Cython\Build\Dependencies.py", line 966, in cythonize
aliases=aliases)
File "c:\users\tmcde\anaconda3\lib\site-packages\Cython\Build\Dependencies.py", line 810, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "c:\users\tmcde\anaconda3\lib\site-packages\Cython\Build\Dependencies.py", line 109, 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\tmcde\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\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\tmcde\AppData\Local\Temp\pip-record-zmu70pen\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\tmcde\anaconda3\Include\pycocotools'
cwd: C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\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 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\tmcde\anaconda3\lib\site-packages\numpy\core\include -I../common -Ic:\users\tmcde\anaconda3\include -Ic:\users\tmcde\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.7\Release\pycocotools/_mask.obj
_mask.c
c:\users\tmcde\anaconda3\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\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: 'c:\users\tmcde\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-req-build-77lgppkj\PythonAPI\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\tmcde\AppData\Local\Temp\pip-record-zmu70pen\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\tmcde\anaconda3\Include\pycocotools' Check the logs for full command output.
i still facing this problem . so, plz help me to overcome this issue.

i am also facing a similar issue. Anyone has a solution to this?

mfrashad pushed a commit to mfrashad/cocostuffapi that referenced this issue Nov 5, 2020
* move common under pycocotools

* change build to pip install .

* update doc
@AdminQiang123
Copy link

Windows 上缺乏对 Python API 的支持可以通过以下步骤修复:

  1. 打开 setup.py
  2. 删除该行 extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
  3. 跑步python setup.py build_ext install

Thanks

@Gresliebear
Copy link

Please add in this support already users fixed why not just change the line?

@pdollar
Copy link
Collaborator

pdollar commented Jul 7, 2021

I'm no longer maintaining this code, but I'd be supportive of the change. (The bigger issue is this codebase isn't actively supported any longer...)

@Robotatron
Copy link

Robotatron commented Jul 29, 2022

https://github.com/philferriere/cocoapi
cocoapi with windows support

I installed it successfully with this repo on Windows 10

Full steps:

  1. install any dependency if missing like cython, etc.
  2. install Visual C++ 14/2015 build tools, NOTE: window 10 SDK is required to be selected if choose custom option (or windows 8.1 SDK depends on your system)
  3. pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

Does not work:

`Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Cloning https://github.com/philferriere/cocoapi.git to c:\users\sergiy.\appdata\local\temp\pip-req-build-cdg943ek
Running command git clone --filter=blob:none --quiet https://github.com/philferriere/cocoapi.git 'C:\Users\Sergiy.\AppData\Local\Temp\pip-req-build-cdg943ek'
Resolved https://github.com/philferriere/cocoapi.git to commit 2929bd2
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools_init_.py -> build\lib.win-amd64-3.8\pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\common
creating build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release\pycocotools
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\lib\site-packages\numpy\core\include -I../common -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\include -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.8\Release../common/maskApi.obj
maskApi.c
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\lib\site-packages\numpy\core\include -I../common -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\include -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.8\Release\pycocotools/_mask.obj
_mask.c
c:\users\sergiy.\miniconda3\envs\mmdet\include\pyconfig.h(205): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycocotools
Running setup.py clean for pycocotools
error: subprocess-exited-with-error

× python setup.py clean did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\Sergiy.\AppData\Local\Temp\pip-req-build-cdg943ek\PythonAPI\setup.py", line 25, in
cythonize(ext_modules)
File "C:\Users\Sergiy.\Miniconda3\envs\mmdet\lib\site-packages\Cython\Build\Dependencies.py", line 970, in cythonize
module_list, module_metadata = create_extension_list(
File "C:\Users\Sergiy.\Miniconda3\envs\mmdet\lib\site-packages\Cython\Build\Dependencies.py", line 816, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "C:\Users\Sergiy.\Miniconda3\envs\mmdet\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty
raise ValueError(error_msg)
ValueError: 'pycocotools/_mask.pyx' doesn't match any files
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed cleaning build dir for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
Running setup.py install for pycocotools ... error
error: subprocess-exited-with-error

× Running setup.py install for pycocotools did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
running install
C:\Users\Sergiy.\Miniconda3\envs\mmdet\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext
building 'pycocotools._mask' extension
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\lib\site-packages\numpy\core\include -I../common -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\include -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.8\Release../common/maskApi.obj
maskApi.c
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\lib\site-packages\numpy\core\include -I../common -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\include -IC:\Users\Sergiy.\Miniconda3\envs\mmdet\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.8\Release\pycocotools/_mask.obj
_mask.c
c:\users\sergiy.\miniconda3\envs\mmdet\include\pyconfig.h(205): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pycocotools

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.`

@WASasquatch
Copy link

WASasquatch commented Jun 21, 2023

Similar issues with the adding the fix here and the fork project

      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

I have 2015 build tools as well, but it doesn't seem to be using them over 2019.

It's pretty embarrassing how much stuff relies on pycocotools and it's pretty much abandoned without any real support for Windows.

@cannacak
Copy link

Here is the solution worked for me : Download the file beneath
https://drive.google.com/file/d/1KI0sfJBw8moRioFcLQrziS-BOXpy_KZt/view?usp=sharing

Copy these files to C:\Users\XXX\AppData\Local\Programs\Python\Python311\Lib\site-packages

In case you still can not solve the problem, do not hesitate to mail me !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests