vivi25-5
vivi25-5

Reputation: 55

VS Code error when importing pycocotools.coco

I'm trying to use VScode for image processing in Python, I cloned a repo from GitHub to try it out, but code fails at the line from pycocotools.coco import COCO . I Googled it, and installed the Visual C++ Build tools, and cloned the coco github repo (https://github.com/cocodataset/cocoapi), to install the library.
When running the command python3 PythonAPI/setup.py build_ext install
I get another error:

Traceback (most recent call last):
  File "C:\Users\barti\OneDrive\Documents\coco\PythonAPI\setup.py", line 23, in <module>
    cythonize(ext_modules)
  File "C:\Users\barti\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\Cython\Build\Dependencies.py", line 970, in cythonize
    module_list, module_metadata = create_extension_list(
  File "C:\Users\barti\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\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\barti\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty
    raise ValueError(error_msg)
ValueError: 'pycocotools/_mask.pyx' doesn't match any files.

At this point I can't find anything helpful on Google, if anyone has an idea how to solve it, I'm here to listen. Thank you!

Upvotes: 0

Views: 797

Answers (1)

MingJie-MSFT
MingJie-MSFT

Reputation: 9229

when you run command:

python3 PythonAPI/setup.py build_ext install

You should be inside the directory that setup.py was in.

I think you can try to install Visual C++ Build Tools according to this answer.

Upvotes: 0

Related Questions