cocodataset / cocoapi

COCO API - Dataset @ http://cocodataset.org/
Other
6.07k stars 3.75k forks source link

Error when pip install pycocotools on Win10 (64bit) #393

Open Longfei-Zhou opened 4 years ago

Longfei-Zhou commented 4 years ago

I meet this error when I run 'pip install pycocotools' on my win10. Could anyone help me?

Collecting pycocotools-fix Using cached pycocotools-fix-2.0.0.1.tar.gz (23 kB) Requirement already satisfied: setuptools>=18.0 in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from pycocotools-fix) (41.2.0) Requirement already satisfied: cython>=0.27.3 in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from pycocotools-fix) (0.29.15) Requirement already satisfied: matplotlib>=2.1.0 in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from pycocotools-fix) (3.2.1) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from matplotlib>=2.1.0->pycocotools-fix) (2.4.6) Requirement already satisfied: cycler>=0.10 in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from matplotlib>=2.1.0->pycocotools-fix) (0.10.0) Requirement already satisfied: numpy>=1.11 in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from matplotlib>=2.1.0->pycocotools-fix) (1.18.1) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from matplotlib>=2.1.0->pycocotools-fix) (1.1.0) Requirement already satisfied: python-dateutil>=2.1 in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from matplotlib>=2.1.0->pycocotools-fix) (2.8.1) Requirement already satisfied: six in c:\users\longfei\appdata\local\programs\python\python38\lib\site-packages (from cycler>=0.10->matplotlib>=2.1.0->pycocotools-fix) (1.14.0) Building wheels for collected packages: pycocotools-fix Building wheel for pycocotools-fix (setup.py) ... error ERROR: Command errored out with exit status 1: command: 'c:\users\longfei\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\setup.py'"'"'; file='"'"'C:\Users\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\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\Longfei\AppData\Local\Temp\pip-wheel-iiq4ettu' cwd: C:\Users\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\ Complete output (22 lines): 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 cythoning pycocotools/_mask.pyx to pycocotools_mask.c c:\users\longfei\appdata\local\programs\python\python38\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\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\pycocotools_mask.pyx tree = Parsing.p_module(s, pxd, full_module_name) building 'pycocotools._mask' extension creating build\temp.win-amd64-3.8 creating build\temp.win-amd64-3.8\Release creating build\temp.win-amd64-3.8\Release\common creating build\temp.win-amd64-3.8\Release\pycocotools C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\longfei\appdata\local\programs\python\python38\lib\site-packages\numpy\core\include -I./common -Ic:\users\longfei\appdata\local\programs\python\python38\include -Ic:\users\longfei\appdata\local\programs\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tc./common/maskApi.c /Fobuild\temp.win-amd64-3.8\Release./common/maskApi.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.24.28314\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Failed building wheel for pycocotools-fix Running setup.py clean for pycocotools-fix Failed to build pycocotools-fix Installing collected packages: pycocotools-fix Running setup.py install for pycocotools-fix ... error ERROR: Command errored out with exit status 1: command: 'c:\users\longfei\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\setup.py'"'"'; file='"'"'C:\Users\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\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\Longfei\AppData\Local\Temp\pip-record-btf2a9yt\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\longfei\appdata\local\programs\python\python38\Include\pycocotools-fix' cwd: C:\Users\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\ Complete output (20 lines): running install 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 skipping 'pycocotools_mask.c' Cython extension (up-to-date) building 'pycocotools._mask' extension creating build\temp.win-amd64-3.8 creating build\temp.win-amd64-3.8\Release creating build\temp.win-amd64-3.8\Release\common creating build\temp.win-amd64-3.8\Release\pycocotools C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\longfei\appdata\local\programs\python\python38\lib\site-packages\numpy\core\include -I./common -Ic:\users\longfei\appdata\local\programs\python\python38\include -Ic:\users\longfei\appdata\local\programs\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tc./common/maskApi.c /Fobuild\temp.win-amd64-3.8\Release./common/maskApi.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.24.28314\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Command errored out with exit status 1: 'c:\users\longfei\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\setup.py'"'"'; file='"'"'C:\Users\Longfei\AppData\Local\Temp\pip-install-tksjsr9a\pycocotools-fix\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\Longfei\AppData\Local\Temp\pip-record-btf2a9yt\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\longfei\appdata\local\programs\python\python38\Include\pycocotools-fix' Check the logs for full command output.

lusiifer commented 4 years ago

Collecting pycocotools Using cached pycocotools-2.0.0.tar.gz (1.5 MB) Building wheels for collected packages: pycocotools Building wheel for pycocotools (setup.py) ... error ERROR: Command errored out with exit status 1: command: 'c:\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\MANTHA~1\AppData\Local\Temp\pip-install-oxopzdjb\pycocotools\setup.py'"'"'; file='"'"'C:\Users\MANTHA~1\AppData\Local\Temp\pip-install-oxopzdjb\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\MANTHA~1\AppData\Local\Temp\pip-wheel-dxk9tw0q' cwd: C:\Users\MANTHA~1\AppData\Local\Temp\pip-install-oxopzdjb\pycocotools\ Complete output (13 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 error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

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:\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\MANTHA~1\AppData\Local\Temp\pip-install-oxopzdjb\pycocotools\setup.py'"'"'; file='"'"'C:\Users\MANTHA~1\AppData\Local\Temp\pip-install-oxopzdjb\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\MANTHA~1\AppData\Local\Temp\pip-record-k9einb9q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python36\Include\pycocotools' cwd: C:\Users\MANTHA~1\AppData\Local\Temp\pip-install-oxopzdjb\pycocotools\ Complete output (13 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 error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

ERROR: Command errored out with exit status 1: 'c:\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\MANTHA~1\AppData\Local\Temp\pip-install-oxopzdjb\pycocotools\setup.py'"'"'; file='"'"'C:\Users\MANTHA~1\AppData\Local\Temp\pip-install-oxopzdjb\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\MANTHA~1\AppData\Local\Temp\pip-record-k9einb9q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python36\Include\pycocotools' Check the logs for full command output.

lusiifer commented 4 years ago

i am also getting similar kind of error can anyone fix it...?

Longfei-Zhou commented 4 years ago

I found this solution works for me. Try it.

pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

lusiifer commented 4 years ago

it's not working

virafpatrawala commented 4 years ago

If you are working in Conda, you can follow the below steps to be able to install, import and use this library quite smoothly.

On Windows, you must have the Visual C++ 2015 build tools on your path. If you don't, make sure to install them from here

### Enter the below in your Conda Command Prompt ###
# Create a new environment
conda create -n <envName>
# Activate the environment
conda activate <envName>
# Install cython
pip install cython
# Install git
conda install -c anaconda git
# Install pycocotools from this GitHub rep
pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

Additionally, I have recently written an entire post on exploring and manipulating the COCO dataset. Do have a look.

sajjadh commented 3 years ago

it's not working

did u find any solution?

Divjyot commented 3 years ago

If you are working in Conda, you can follow the below steps to be able to install, import and use this library quite smoothly.

### Enter the below in your Conda Command Prompt ###
# Create a new environment
conda create -n <envName>
# Activate the environment
conda activate <envName>
# Install cython
pip install cython
# Install git
conda install -c anaconda git
# Install pycocotools from this GitHub rep
pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

Additionally, I have recently written an entire post on exploring and manipulating the COCO dataset. Do have a look.

Above has to be installed before installing pycocotools:

On Windows, you must have the Visual C++ 2015 build tools on your path. If you don't, make sure to install them from here

alsheabi commented 3 years ago

If you are working in Conda, you can follow the below steps to be able to install, import and use this library quite smoothly.

### Enter the below in your Conda Command Prompt ###
# Create a new environment
conda create -n <envName>
# Activate the environment
conda activate <envName>
# Install cython
pip install cython
# Install git
conda install -c anaconda git
# Install pycocotools from this GitHub rep
pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

Additionally, I have recently written an entire post on exploring and manipulating the COCO dataset. Do have a look.

This has to be installed before installing pycocotools:

On Windows, you must have the Visual C++ 2015 build tools on your path. If you don't, make sure to install them from here

This solution works well and solved the problem. @Divjyot many Thanks

michavandermeer commented 3 years ago

Working +1!

yeshapatel356 commented 3 years ago

Any solution?

nikmace commented 3 years ago

Has anyone solved this yet?

Divjyot commented 3 years ago

@yeshapatel356 @nikmace https://github.com/cocodataset/cocoapi/issues/393#issuecomment-773037508

Hemanthkumar2112 commented 3 years ago

Any solution?

Has anyone solved this yet?

try this matepip install pycocotools-windows if you are using win platform

else conda install cython before pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

@yassersouri

CloneHub94 commented 3 years ago

I keep getting an error when building pycocotools: image image

I use the same commands: conda install cython before pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

And followed multiple tutorials. But I keep getting the same problem over and over again.

Does anyone know how I can solve this?

Petros626 commented 3 years ago

I keep getting an error when building pycocotools: image image

I use the same commands: conda install cython before pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

And followed multiple tutorials. But I keep getting the same problem over and over again.

Does anyone know how I can solve this?

me too dude me too :(

rozhix commented 3 years ago

I keep getting an error when building pycocotools: image image I use the same commands: conda install cython before pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI And followed multiple tutorials. But I keep getting the same problem over and over again. Does anyone know how I can solve this?

me too dude me too :(

did u solve it?

Petros626 commented 3 years ago

@rozhix yes I think I install pycocotools with the command "pip install pycocotool-windows" and or download the whole file from internet and paste it into the folder where the environment and the site-packages are located.

shsh9625 commented 2 years ago

Any solution?

Has anyone solved this yet?

try this matepip install pycocotools-windows if you are using win platform

else conda install cython before pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI

@yassersouri

Heyyy, you saved my life! thanks!!

rageSpin commented 1 year ago

Hi everyone, previous methods don't work for me.

I solved with (on Windows 10 2H22) conda install pycocotools -c conda-forge

MarNe2021 commented 1 year ago

Hi everyone, previous methods don't work for me.

I solved with (on Windows 10 2H22) conda install pycocotools -c conda-forge

worked for me on win 11. I first installed cython then pycocotools and last tf-models-official

maxiuw commented 1 year ago

check if:

tnmthai commented 1 year ago

You should try this first: conda install pycocotools -c conda-forge

It works for me.