cocodataset / cocoapi

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

building 'pycocotools._mask' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/ #410

Open shubhamsingh941889 opened 4 years ago

shubhamsingh941889 commented 4 years ago

Even though I already downloaded Microsoft Visual C++ 14.0 the issue persists image

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.

### 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.

MohammedAljahdali commented 3 years ago

@shubhamsingh941889 did you manage to fix this issue?

darshb34 commented 2 years ago

This worked for me pip install pycocotools-windows

andreped commented 2 years ago

@pdollar I could build binaries for all operating systems and ask the @dev-team to publish them in the new version. Then building from scratch would no longer be needed, and it should just work as it does for the other operating systems. Would that be of interest to you? I could make a github actions workflow that does all this and then for all future versions you can just use the artifacts (binaries) produced by the workflow.


EDIT: I setup a simple workflow. Had to modify the source code slightly, similar as done in pycocotools-windows. However, I made the setup.py more generic to be used for all operating systems dynamically. No need to have two separate projects for Windows and Linux/macOS.

The workflow produces an artifact which contains the binaries as python wheels (.whl) - see here. In addition, I made a pre-release here, where you can download and test the binaries if you would like.

I believe having these binaries within the PyPI would be great, as it totally removes the need to build the package from scratch when installing, independent of OS.

pdollar commented 2 years ago

Seems like a cool idea, thanks @andreped . However, I'm no longer maintaining this repo in any way. Maybe @tylin could help? Thanks!

andreped commented 2 years ago

@tylin I could make a PR and you can come with any suggestions for improvement, if you'd like (if this is at all relevant) :]

TLDR: This enables seemless install on all operating systems, completely removing the need for VS Build Tools when installing pycocotools on windows (relevant for Python). I could set the workflow up such that the generated artifact is made ready for publication on PyPI directly.

TomskDiver commented 1 year ago

@andreped please make wheel for python 3.10. Thanks.

andreped commented 1 year ago

@andreped please make wheel for python 3.10. Thanks.

@TomskDiver Here you go: https://github.com/andreped/cocoapi/releases/tag/v2.0

I built and released binaries for Python 3.6-3.11 and Win/Ubuntu/macOS.

Hope it helps! Let me know if there are any issues :]

TomskDiver commented 1 year ago

@andreped thanks. I try your build in Windows 11 (21H2) and Python 3.10.8 and latest TensorFlow Object Detection API. Tests work fine:

Ran 24 tests in 111.347s

OK (skipped=1)