cocodataset / cocoapi

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

_mask.so : undefined symbol: _Py_ZeroStruct #90

Closed leekyungmoon closed 10 months ago

leekyungmoon commented 6 years ago

After running the command 'make' under 'coco/PythonAPI', I tried running the script to create my own dataset using cocoAPI.

When running my script, I got an error : "pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct" in Ubuntu 16.04.

I'll appreciate it if you could help me, thanks.

FumingX commented 6 years ago

Cause of the Python version. If you use Python2.7, in PythonAPI/ floder, do: sudo make python setup.py build_ext install If you are using Python3, you need to modify the Makefile to change every 'python' to 'python3' and do: sudo make python3 setup.py build_ext install

wish you pass

cdluminate commented 6 years ago

@FumingX Thanks, it worked.

rishi8313 commented 6 years ago

What if I don't have sudo permissions.

salihkaragoz commented 6 years ago

@rishi8313 You can install on user' local with

pip install --user pycocotools

rishi8313 commented 6 years ago

Thanks a lot.. It worked..

Maxwell2016LeChouchou commented 5 years ago

hello, I installed it on my user local with pip install --user pycocotools

but I still have error with ImportError: /home/max/Downloads/MTCNN/models/research/pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct

JanithT-Lboro commented 5 years ago

Did you have any luck with this issue? I am having the same problem... @Maxwell2016LeChouchou

Harshad1409 commented 5 years ago

@Maxwell2016LeChouchou I am having same problem too.

Maxwell2016LeChouchou commented 5 years ago

@JanithT-Lboro @Harshad1409 Hello guys, use coco rather than cocoapi and i have solved the question by using follow command lines: 1st step: git clone https://github.com/pdollar/coco.git

2nd step: cd coco/PythonAPI sudo python3 setup.py build_ext --inplace

3rd step: sudo python3 setup.py build_ext install

4th step is to go back home directory by cd ~ and excute the following lines to see if your installation succeed or not: python3 import pycocotools

Hopefully this helps

nordllar commented 5 years ago

I work with cython and had the same problem, the solution worked for me - thanks!

kiad4631 commented 4 years ago

Hi. my problem not solved yet! please help me I am confused.

every time I run this command: https://github.com/tensorflow/models/blob/master/research/object_detection/legacy/eval.py

this error appear:

File "eval.py", line 52, in from object_detection.legacy import evaluator File "/home/partai/Davari/Tensorflow/models/research/object_detection/legacy/evaluator.py", line 24, in from object_detection import eval_util File "/home/partai/Davari/Tensorflow/models/research/object_detection/eval_util.py", line 33, in from object_detection.metrics import coco_evaluation File "/home/partai/Davari/Tensorflow/models/research/object_detection/metrics/coco_evaluation.py", line 25, in from object_detection.metrics import coco_tools File "/home/partai/Davari/Tensorflow/models/research/object_detection/metrics/coco_tools.py", line 51, in from pycocotools import coco File "/home/partai/Davari/Tensorflow/models/research/pycocotools/coco.py", line 55, in from . import mask as maskUtils File "/home/partai/Davari/Tensorflow/models/research/pycocotools/mask.py", line 3, in import pycocotools._mask as _mask ImportError: /home/partai/Davari/Tensorflow/models/research/pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct

what should I do??

kiad4631 commented 4 years ago

hello, I installed it on my user local with pip install --user pycocotools

but I still have error with ImportError: /home/max/Downloads/MTCNN/models/research/pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct

HI. I have too. what did you do for solving?

kiad4631 commented 4 years ago

After running the command 'make' under 'coco/PythonAPI', I tried running the script to create my own dataset using cocoAPI.

When running my script, I got an error : "pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct" in Ubuntu 16.04.

I'll appreciate it if you could help me, thanks.

me too.did you solve it?

ChaiShalev7 commented 4 years ago

HI. I have too problem. what did you do for solving?

mattkenefick commented 4 years ago

Also looking for assistance. I've followed all recommendations successfully, but it still hasn't resolved the issue.

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/dist-packages/prodigy/__main__.py", line 58, in <module>
    recipe = get_recipe(command, path=path)
  File "cython_src/prodigy/core.pyx", line 279, in prodigy.core.get_recipe
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/prodigy-recipes/image/tf_odapi/image_train.py", line 25, in <module>
    from object_detection.model_lib import create_model_fn
  File "/opt/models/research/object_detection/model_lib.py", line 27, in <module>
    from object_detection import eval_util
  File "/opt/models/research/object_detection/eval_util.py", line 33, in <module>
    from object_detection.metrics import coco_evaluation
  File "/opt/models/research/object_detection/metrics/coco_evaluation.py", line 25, in <module>
    from object_detection.metrics import coco_tools
  File "/opt/models/research/object_detection/metrics/coco_tools.py", line 51, in <module>
    from pycocotools import coco
  File "/opt/models/research/pycocotools/coco.py", line 55, in <module>
    from . import mask as maskUtils
  File "/opt/models/research/pycocotools/mask.py", line 3, in <module>
    import pycocotools._mask as _mask
ImportError: /opt/models/research/pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct

I've successfully compiled, installed, etc for python and python3 but it hasn't made a difference in the above error.

ndinarvand commented 4 years ago

After running the command 'make' under 'coco/PythonAPI', I tried running the script to create my own dataset using cocoAPI.

When running my script, I got an error : "pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct" in Ubuntu 16.04.

I'll appreciate it if you could help me, thanks.

I changed python to python3 (in /Mask_RCNN/samples/coco/PythonAPI/make) and make again...Problem solved.

shiva2410 commented 4 years ago

Hi I tired all suggestions given in this thread still I am not able to resolve my issue """ File "demo_large_image.py", line 1, in from mmdet.apis import init_detector, inference_detector, show_result, draw_poly_detections File "/home/shiva/work/AerialDetection/mmdet/apis/init.py", line 2, in from .train import train_detector File "/home/shiva/work/AerialDetection/mmdet/apis/train.py", line 10, in from mmdet import datasets File "/home/shiva/work/AerialDetection/mmdet/datasets/init.py", line 1, in from .custom import CustomDataset File "/home/shiva/work/AerialDetection/mmdet/datasets/custom.py", line 11, in from .extra_aug import ExtraAugmentation File "/home/shiva/work/AerialDetection/mmdet/datasets/extra_aug.py", line 5, in from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps File "/home/shiva/work/AerialDetection/mmdet/core/init.py", line 1, in from .anchor import * # noqa: F401, F403 File "/home/shiva/work/AerialDetection/mmdet/core/anchor/init.py", line 2, in from .anchor_target import anchor_target, anchor_inside_flags File "/home/shiva/work/AerialDetection/mmdet/core/anchor/anchor_target.py", line 3, in from ..bbox import assign_and_sample, build_assigner, PseudoSampler, bbox2delta File "/home/shiva/work/AerialDetection/mmdet/core/bbox/init.py", line 1, in from .bbox import bbox_overlaps_cython ImportError: /home/shiva/work/AerialDetection/mmdet/core/bbox/bbox.so: undefined symbol: _Py_ZeroStruct """

Please see to it my environment information -

""" PyTorch version: 1.5.0+cu101 Is debug build: No CUDA used to build PyTorch: 10.1

OS: Ubuntu 20.04 LTS GCC version: (Ubuntu 9.3.0-10ubuntu2) 9.3.0 CMake version: Could not collect

Python version: 3.8 Is CUDA available: Yes CUDA runtime version: 10.1.243 GPU models and configuration: GPU 0: GeForce 940MX Nvidia driver version: 440.64 cuDNN version: Could not collect

Versions of relevant libraries: [pip3] numpy==1.18.4 [pip3] torch==1.5.0+cu101 [pip3] torchvision==0.6.0+cu101 [conda] Could not collect """

Please help

ghost commented 4 years ago

@JanithT-Lboro @Harshad1409 Hello guys, use coco rather than cocoapi and i have solved the question by using follow command lines: 1st step: git clone https://github.com/pdollar/coco.git

2nd step: cd coco/PythonAPI sudo python3 setup.py build_ext --inplace

3rd step: sudo python3 setup.py build_ext install

4th step is to go back home directory by cd ~ and excute the following lines to see if your installation succeed or not: python3 import pycocotools

Hopefully this helps

Man you ARE THE BESSSTTTTTTT!!! I WAS TRYING TO RUN IT ON AWS BUT DUE TO SOME ISSUES I WAS'NT ABLE TO TO DO THAT... AMAZING ANSWER