r/pythonhelp • u/8a19 • Aug 16 '21
Pycocotools failed to build wheel
Hello everybody, I've recently begun to dip my feet into object detection and tensorflow. While it has proven challenging it feels quite enjoyable and I feel I've learnt a ton from it. Recently however Ive run into an issue I have yet to be able to solve.
I have been following this tutorial: Real Time Face Mask Detection with Tensorflow and Python | Custom Object Detection w/ MobileNet SSD - YouTube
When it gets to the part where we run the:
python Tensorflow/models/research/object_detection/model_main_tf2.py --model_dir=Tensorflow/workspace/models/my_ssd_mobnet --pipeline_config_path=Tensorflow/workspace/models/my_ssd_mobnet/pipeline.config --num_train_steps=5000command, I am instead getting the error that there is no module named pycocotools. I attempted to solve this by running the appropriate pip install command but when I do it I get this error:
ERROR: Command errored out with exit status 1:
command: 'c:\program files (x86)\microsoft visual studio\shared\python37_64\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-xfya3fgr\\pycocotools_b83c35bfc43b4320b51f4dfe9a656571\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-xfya3fgr\\pycocotools_b83c35bfc43b4320b51f4dfe9a656571\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\moham\AppData\Local\Temp\pip-wheel-8g0iskd2'
cwd: C:\Users\moham\AppData\Local\Temp\pip-install-xfya3fgr\pycocotools_b83c35bfc43b4320b51f4dfe9a656571\
Complete output (16 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
cythoning pycocotools/_mask.pyx to pycocotools_mask.c
C:\Users\moham\AppData\Roaming\Python\Python37\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\moham\AppData\Local\Temp\pip-install-xfya3fgr\pycocotools_b83c35bfc43b4320b51f4dfe9a656571\pycocotools_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
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/
----------------------------------------
ERROR: Failed building wheel for pycocotoolsI have happened upon some solutions online on github and such but I havent had much luck solving this. Any resources that may help me in understanding what this error is and how I can fix it is greatly appreciated. Thank you for your time and have a great day!
1
u/MrPhungx Aug 17 '21
As far as I know some python modules are just wrappers for some c/c++ libraries. So in order to use those you need to be able to build those programs. The Error Message actually tells you what is going wrong:
So basically you will need to Install the C++ build tools. For some more info you can have a look here: https://stackoverflow.com/questions/29846087/microsoft-visual-c-14-0-is-required-unable-to-find-vcvarsall-bat