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

I can't install cocoapi on Windows 10 #185

Open
AdrianSalvador opened this issue Jun 28, 2018 · 13 comments
Open

I can't install cocoapi on Windows 10 #185

AdrianSalvador opened this issue Jun 28, 2018 · 13 comments

Comments

@AdrianSalvador
Copy link

I am using a virtual environment in Conda using python 3.5 and have already installed cython and the all dependencies. I tried to install pycocotools with the command pip install pycocotools, using the Github created fot Windows
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI.
And always I obtain the same error:

(py36_tf18) C:\Users\Adrian>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\adrian\appdata\local\temp\pip-req-build-xw8vs02j
Building wheels for collected packages: pycocotools
Running setup.py bdist_wheel for pycocotools ... error
Complete output from command C:\Users\Adrian\AppData\Local\Continuum\anaconda2\envs\py36_tf18\python.exe -u -c "import setuptools, tokenize;file='C:\Users\Adrian\AppData\Local\Temp\pip-req-build-xw8vs02j\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\Adrian\AppData\Local\Temp\pip-wheel-onof6vu2 --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.5\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.5\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.5\pycocotools
copying pycocotools_init_.py -> build\lib.win-amd64-3.5\pycocotools
running build_ext
building 'pycocotools._mask' extension
error: [WinError 2] El sistema no puede encontrar el archivo especificado


Failed building wheel for pycocotools
Running setup.py clean for pycocotools
Complete output from command C:\Users\Adrian\AppData\Local\Continuum\anaconda2\envs\py36_tf18\python.exe -u -c "import setuptools, tokenize;file='C:\Users\Adrian\AppData\Local\Temp\pip-req-build-xw8vs02j\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:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Adrian\AppData\Local\Temp\pip-req-build-xw8vs02j\PythonAPI\setup.py", line 25, in
cythonize(ext_modules)
File "C:\Users\Adrian\AppData\Local\Continuum\anaconda2\envs\py36_tf18\lib\site-packages\Cython\Build\Dependencies.py", line 897, in cythonize
aliases=aliases)
File "C:\Users\Adrian\AppData\Local\Continuum\anaconda2\envs\py36_tf18\lib\site-packages\Cython\Build\Dependencies.py", line 777, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "C:\Users\Adrian\AppData\Local\Continuum\anaconda2\envs\py36_tf18\lib\site-packages\Cython\Build\Dependencies.py", line 102, in nonempty
raise ValueError(error_msg)
ValueError: 'pycocotools/_mask.pyx' doesn't match any files


Failed cleaning build dir for pycocotools
Failed to build pycocotools

Installing collected packages: pycocotools
Running setup.py install for pycocotools ... error
Complete output from command C:\Users\Adrian\AppData\Local\Continuum\anaconda2\envs\py36_tf18\python.exe -u -c "import setuptools, tokenize;file='C:\Users\Adrian\AppData\Local\Temp\pip-req-build-xw8vs02j\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\Adrian\AppData\Local\Temp\pip-record-s00wlqn2\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running build_ext
building 'pycocotools._mask' extension
error: [WinError 2] El sistema no puede encontrar el archivo especificado

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

Command "C:\Users\Adrian\AppData\Local\Continuum\anaconda2\envs\py36_tf18\python.exe -u -c "import setuptools, tokenize;file='C:\Users\Adrian\AppData\Local\Temp\pip-req-build-xw8vs02j\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\Adrian\AppData\Local\Temp\pip-record-s00wlqn2\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Adrian\AppData\Local\Temp\pip-req-build-xw8vs02j\PythonAPI

Thanks for your attention

@HedgehogCode
Copy link

The maintainers won't provide support for Windows: #9 (comment)

@rawandeheliah
Copy link

did u fix it ? plz help

@HedgehogCode
Copy link

This fork compiles on Windows: https://github.com/philferriere/cocoapi

@zbiswas3
Copy link

From conda command prompt do these two commands. Just copy and paste and enter to run. It will install the pycocotools. Then you can use the demo files in the repository. Or just use google colab.
first:
conda install git
then:
pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

@xiuyangleiasp
Copy link

impoved py3.5 to py3.6 or greater, and tried again.It succeed!
follow:https://stackoverflow.com/questions/49841434/python3-5-i-cant-install-third-party-libraries-for-python-by-using-instructions

@CoryLai
Copy link

CoryLai commented Oct 1, 2019

Changing python3.5 to python3.6 works for me! Thanks!

@tirthraj13
Copy link

(base) C:\Users\tmcde>pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
Collecting pycocotools
Cloning https://github.com/philferriere/cocoapi.git to c:\users\tmcde\appdata\local\temp\pip-install-8euzqxwu\pycocotools
Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\tmcde\AppData\Local\Temp\pip-install-8euzqxwu\pycocotools'
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-install-8euzqxwu\pycocotools\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-install-8euzqxwu\pycocotools\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-snfqqtqb'
cwd: C:\Users\tmcde\AppData\Local\Temp\pip-install-8euzqxwu\pycocotools\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-install-8euzqxwu\pycocotools\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-install-8euzqxwu\pycocotools\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-install-8euzqxwu\pycocotools
Complete output (11 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\tmcde\AppData\Local\Temp\pip-install-8euzqxwu\pycocotools\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-install-8euzqxwu\pycocotools\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-install-8euzqxwu\pycocotools\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-9h6ofmdn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\tmcde\anaconda3\Include\pycocotools'
cwd: C:\Users\tmcde\AppData\Local\Temp\pip-install-8euzqxwu\pycocotools\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-install-8euzqxwu\pycocotools\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\tmcde\AppData\Local\Temp\pip-install-8euzqxwu\pycocotools\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-9h6ofmdn\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 the problem.so,please help me to overcome this issue.please help!!!!!!

@garvjeet11
Copy link

I was facing the same issue. I just changed pip to pip3 and it worked. Use "pip3 install git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI". Hope this works.

@richboy97
Copy link

richboy97 commented Dec 27, 2020

İ fix the problem i have been trying to fix this for a long time. if u get this problem always Failed building wheel for pycocotools, you should download and set up visual C++ 2015 bulid tools, i made this after that problem solved. here can help you https://github.com/philferriere/cocoapi

@musa-akbulut
Copy link

Hi, the problem has not been solved.Capable of Do you have?

@jainvipul820
Copy link

DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Cloning https://github.com/philferriere/cocoapi.git to c:\users\vipul\appdata\local\temp\pip-req-build-_nj6mcra
Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\vipul\AppData\Local\Temp\pip-req-build-_nj6mcra'
ERROR: Command errored out with exit status 1:
command: 'c:\users\vipul\anaconda3\envs\tensorflow\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\vipul\AppData\Local\Temp\pip-req-build-_nj6mcra\PythonAPI\setup.py'"'"'; file='"'"'C:\Users\vipul\AppData\Local\Temp\pip-req-build-_nj6mcra\PythonAPI\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\vipul\AppData\Local\Temp\pip-pip-egg-info-8qjzawg2'
cwd: C:\Users\vipul\AppData\Local\Temp\pip-req-build-_nj6mcra\PythonAPI
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\vipul\AppData\Local\Temp\pip-req-build-_nj6mcra\PythonAPI\setup.py", line 4, in
import numpy as np
ImportError: No module named 'numpy'
----------------------------------------
WARNING: Discarding git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Getting this issue! any solution?

@thinktu2
Copy link

Install cocoapi on Windows 10

When I attempt to install YOLOX, I can't install cocoapi on my PC.

I created an env yolox by using conda.

> conda activate yolox

Then following the yolox Installation tutorial

Like you guys, I stuck at pip3 install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'

Here is my solution. I hope it will be helpful :)

Environment

  • OS:Windows 10
  • python:3.8.12

Steps

  1. get cocoapi code from the official repo

    > git clone https://github.com/cocodataset/cocoapi.git

    or Download ZIP from official repo

  2. install cocoapi

    > cd <parent dir>/cocoapi/PythonAPI

    > python setup.py install

Problems

  1. Can't find vcversall.bat

    Install Visual Studio 2015

    By the way, I do not meet this problem. It may be because I have installed Visual Studio 2019

  2. Can't find argument -Wno-cpp and-Wno-unused-function

    Modify the file setup.py, delete '-Wno-cpp', '-Wno-unused-function', at line 12

    Run > python setup.py install again

  3. ModuleNotFoundError: No module named 'pycocotools._mask'

    When you open the python command line, type

    from pycocotools.coco import COCO

    The problem ModuleNotFoundError: No module named 'pycocotools._mask' occurs

    > cd <parent dir>/cocoapi/PythonAPI

    > python setup.py build_ext --inplace

Postscript

This method was obtained by searching information on the Internet, I just did a little integration work.

I hope it is useful, it solves my problem.

If this method is useless, please continue to search for solutions on the Internet. GOOD LUCK!

@armengot
Copy link

armengot commented Dec 24, 2022

I translated the decode function here: https://github.com/armengot/test_coco_api/blob/main/python/forkcocowin.py

But it works more slowly (C types in Python).

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