prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Test errors after tensorflow installation on Ubuntu 20.04
  Ubuntu20.04, Python 3.8.5 
  Installation of tensorflow (to enable skipped tests) results with tests errors.
  
  **Steps to reproduce:**
  ```
  git clone https://github.com/openvinotoolkit/datumaro 
  cd datumaro
  python3 -m pip install virtualenv
  python3 -m virtualenv venv
  . venv/bin/activate
  pip install datumaro
  python3 -m unittest -v
  //there are some skipped tests - required tensorflow and pandas)
  pip install tensorflow
  //during installation numpy 1.20.3 was uninstalled and 1.19.5 was installed
  python3 -m unittest -v
  ```
  **Expected result:**
  No test errors after installation libraries required to perform initially skipped tests.
  
  **Current result:**
  ```
  Ran 390 tests in 11.807s
  
  FAILED (errors=29, skipped=7)
  ```
  ```======================================================================
  ERROR: test_validate_annotations_segmentation (tests.test_validator.TestValidateAnnotations)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/home/sstrehlk/src/datum_p/tests/test_validator.py", line 803, in test_validate_annotations_segmentation
      actual_results = validate_annotations(self.dataset, 'segmentation',
    File "/home/sstrehlk/src/datum_p/datumaro/components/validator.py", line 1255, in validate_annotations
      stats = validator.compute_statistics(dataset)
    File "/home/sstrehlk/src/datum_p/datumaro/components/validator.py", line 1064, in compute_statistics
      _update_mask_stats_by_label(
    File "/home/sstrehlk/src/datum_p/datumaro/components/validator.py", line 1026, in _update_mask_stats_by_label
      area = ann.get_area()
    File "/home/sstrehlk/src/datum_p/datumaro/components/extractor.py", line 374, in get_area
      import pycocotools.mask as mask_utils
    File "/home/sstrehlk/src/datum_p/venv/lib/python3.8/site-packages/pycocotools/mask.py", line 3, in <module>
      import pycocotools._mask as _mask
    File "pycocotools/_mask.pyx", line 1, in init pycocotools._mask
  ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
  
  ----------------------------------------------------------------------
  ```
  It seems that there is incompatibility between numpy 1.19.5 and pycocotools 2.0.2. There is workaround for it: 
  ```
  pip install pycocotools==2.0.0
  ``` 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `setup.py`
  Content:
  ```
  1 
  2 # Copyright (C) 2019-2020 Intel Corporation
  3 #
  4 # SPDX-License-Identifier: MIT
  5 
  6 from distutils.util import strtobool
  7 import os
  8 import os.path as osp
  9 import re
  10 import setuptools
  11 
  12 # Snyk scan integration
  13 here = None
  14 
  15 
  16 def find_version(project_dir=None):
  17     if not project_dir:
  18         project_dir = osp.dirname(osp.abspath(__file__))
  19 
  20     file_path = osp.join(project_dir, 'datumaro', 'version.py')
  21 
  22     with open(file_path, 'r') as version_file:
  23         version_text = version_file.read()
  24 
  25     # PEP440:
  26     # https://www.python.org/dev/peps/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions
  27     pep_regex = r'([1-9]\d*!)?(0|[1-9]\d*)(\.(0|[1-9]\d*))*((a|b|rc)(0|[1-9]\d*))?(\.post(0|[1-9]\d*))?(\.dev(0|[1-9]\d*))?'
  28     version_regex = r'VERSION\s*=\s*.(' + pep_regex + ').'
  29     match = re.match(version_regex, version_text)
  30     if not match:
  31         raise RuntimeError("Failed to find version string in '%s'" % file_path)
  32 
  33     version = version_text[match.start(1) : match.end(1)]
  34     return version
  35 
  36 def get_requirements():
  37     requirements = [
  38         'attrs>=19.3.0',
  39         'defusedxml',
  40         'GitPython',
  41         'lxml',
  42         'matplotlib',
  43         'numpy>=1.17.3',
  44         'Pillow',
  45         'pycocotools; platform_system != "Windows"',
  46         'pycocotools-windows; platform_system == "Windows"',
  47         'PyYAML',
  48         'scikit-image',
  49         'tensorboardX',
  50     ]
  51     if strtobool(os.getenv('DATUMARO_HEADLESS', '0').lower()):
  52         requirements.append('opencv-python-headless')
  53     else:
  54         requirements.append('opencv-python')
  55 
  56     return requirements
  57 
  58 with open('README.md', 'r') as fh:
  59     long_description = fh.read()
  60 
  61 setuptools.dist.Distribution().fetch_build_eggs([
  62     'Cython>=0.27.3' # required for pycocotools and others, if need to compile
  63 ])
  64 
  65 setuptools.setup(
  66     name="datumaro",
  67     version=find_version(here),
  68     author="Intel",
  69     author_email="maxim.zhiltsov@intel.com",
  70     description="Dataset Management Framework (Datumaro)",
  71     long_description=long_description,
  72     long_description_content_type="text/markdown",
  73     url="https://github.com/openvinotoolkit/datumaro",
  74     packages=setuptools.find_packages(exclude=['tests*']),
  75     classifiers=[
  76         "Programming Language :: Python :: 3",
  77         "License :: OSI Approved :: MIT License",
  78         "Operating System :: OS Independent",
  79     ],
  80     python_requires='>=3.6',
  81     install_requires=get_requirements(),
  82     extras_require={
  83         'tf': ['tensorflow'],
  84         'tf-gpu': ['tensorflow-gpu'],
  85     },
  86     entry_points={
  87         'console_scripts': [
  88             'datum=datumaro.cli.__main__:main',
  89         ],
  90     },
  91 )
  92
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -42,8 +42,17 @@
           'matplotlib',
           'numpy>=1.17.3',
           'Pillow',
  -        'pycocotools; platform_system != "Windows"',
  +
  +        # Avoid 2.0.2 Linux binary distribution because of
  +        # a conflict in numpy versions with TensorFlow:
  +        # - TF is compiled with numpy 1.19 ABI
  +        # - pycocotools is compiled with numpy 1.20 ABI
  +        # Using a previous version allows to force package rebuilding.
  +        #
  +        # https://github.com/openvinotoolkit/datumaro/issues/253
  +        'pycocotools!=2.0.2; platform_system != "Windows"',
           'pycocotools-windows; platform_system == "Windows"',
  +
           'PyYAML',
           'scikit-image',
           'tensorboardX',
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -42,8 +42,17 @@\n         'matplotlib',\n         'numpy>=1.17.3',\n         'Pillow',\n-        'pycocotools; platform_system != \"Windows\"',\n+\n+        # Avoid 2.0.2 Linux binary distribution because of\n+        # a conflict in numpy versions with TensorFlow:\n+        # - TF is compiled with numpy 1.19 ABI\n+        # - pycocotools is compiled with numpy 1.20 ABI\n+        # Using a previous version allows to force package rebuilding.\n+        #\n+        # https://github.com/openvinotoolkit/datumaro/issues/253\n+        'pycocotools!=2.0.2; platform_system != \"Windows\"',\n         'pycocotools-windows; platform_system == \"Windows\"',\n+\n         'PyYAML',\n         'scikit-image',\n         'tensorboardX',\n", "issue": "Test errors after tensorflow installation on Ubuntu 20.04\nUbuntu20.04, Python 3.8.5 \r\nInstallation of tensorflow (to enable skipped tests) results with tests errors.\r\n\r\n**Steps to reproduce:**\r\n```\r\ngit clone https://github.com/openvinotoolkit/datumaro \r\ncd datumaro\r\npython3 -m pip install virtualenv\r\npython3 -m virtualenv venv\r\n. venv/bin/activate\r\npip install datumaro\r\npython3 -m unittest -v\r\n//there are some skipped tests - required tensorflow and pandas)\r\npip install tensorflow\r\n//during installation numpy 1.20.3 was uninstalled and 1.19.5 was installed\r\npython3 -m unittest -v\r\n```\r\n**Expected result:**\r\nNo test errors after installation libraries required to perform initially skipped tests.\r\n\r\n**Current result:**\r\n```\r\nRan 390 tests in 11.807s\r\n\r\nFAILED (errors=29, skipped=7)\r\n```\r\n```======================================================================\r\nERROR: test_validate_annotations_segmentation (tests.test_validator.TestValidateAnnotations)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/sstrehlk/src/datum_p/tests/test_validator.py\", line 803, in test_validate_annotations_segmentation\r\n    actual_results = validate_annotations(self.dataset, 'segmentation',\r\n  File \"/home/sstrehlk/src/datum_p/datumaro/components/validator.py\", line 1255, in validate_annotations\r\n    stats = validator.compute_statistics(dataset)\r\n  File \"/home/sstrehlk/src/datum_p/datumaro/components/validator.py\", line 1064, in compute_statistics\r\n    _update_mask_stats_by_label(\r\n  File \"/home/sstrehlk/src/datum_p/datumaro/components/validator.py\", line 1026, in _update_mask_stats_by_label\r\n    area = ann.get_area()\r\n  File \"/home/sstrehlk/src/datum_p/datumaro/components/extractor.py\", line 374, in get_area\r\n    import pycocotools.mask as mask_utils\r\n  File \"/home/sstrehlk/src/datum_p/venv/lib/python3.8/site-packages/pycocotools/mask.py\", line 3, in <module>\r\n    import pycocotools._mask as _mask\r\n  File \"pycocotools/_mask.pyx\", line 1, in init pycocotools._mask\r\nValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject\r\n\r\n----------------------------------------------------------------------\r\n```\r\nIt seems that there is incompatibility between numpy 1.19.5 and pycocotools 2.0.2. There is workaround for it: \r\n```\r\npip install pycocotools==2.0.0\r\n``` \n", "before_files": [{"content": "\n# Copyright (C) 2019-2020 Intel Corporation\n#\n# SPDX-License-Identifier: MIT\n\nfrom distutils.util import strtobool\nimport os\nimport os.path as osp\nimport re\nimport setuptools\n\n# Snyk scan integration\nhere = None\n\n\ndef find_version(project_dir=None):\n    if not project_dir:\n        project_dir = osp.dirname(osp.abspath(__file__))\n\n    file_path = osp.join(project_dir, 'datumaro', 'version.py')\n\n    with open(file_path, 'r') as version_file:\n        version_text = version_file.read()\n\n    # PEP440:\n    # https://www.python.org/dev/peps/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions\n    pep_regex = r'([1-9]\\d*!)?(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))*((a|b|rc)(0|[1-9]\\d*))?(\\.post(0|[1-9]\\d*))?(\\.dev(0|[1-9]\\d*))?'\n    version_regex = r'VERSION\\s*=\\s*.(' + pep_regex + ').'\n    match = re.match(version_regex, version_text)\n    if not match:\n        raise RuntimeError(\"Failed to find version string in '%s'\" % file_path)\n\n    version = version_text[match.start(1) : match.end(1)]\n    return version\n\ndef get_requirements():\n    requirements = [\n        'attrs>=19.3.0',\n        'defusedxml',\n        'GitPython',\n        'lxml',\n        'matplotlib',\n        'numpy>=1.17.3',\n        'Pillow',\n        'pycocotools; platform_system != \"Windows\"',\n        'pycocotools-windows; platform_system == \"Windows\"',\n        'PyYAML',\n        'scikit-image',\n        'tensorboardX',\n    ]\n    if strtobool(os.getenv('DATUMARO_HEADLESS', '0').lower()):\n        requirements.append('opencv-python-headless')\n    else:\n        requirements.append('opencv-python')\n\n    return requirements\n\nwith open('README.md', 'r') as fh:\n    long_description = fh.read()\n\nsetuptools.dist.Distribution().fetch_build_eggs([\n    'Cython>=0.27.3' # required for pycocotools and others, if need to compile\n])\n\nsetuptools.setup(\n    name=\"datumaro\",\n    version=find_version(here),\n    author=\"Intel\",\n    author_email=\"maxim.zhiltsov@intel.com\",\n    description=\"Dataset Management Framework (Datumaro)\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    url=\"https://github.com/openvinotoolkit/datumaro\",\n    packages=setuptools.find_packages(exclude=['tests*']),\n    classifiers=[\n        \"Programming Language :: Python :: 3\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Operating System :: OS Independent\",\n    ],\n    python_requires='>=3.6',\n    install_requires=get_requirements(),\n    extras_require={\n        'tf': ['tensorflow'],\n        'tf-gpu': ['tensorflow-gpu'],\n    },\n    entry_points={\n        'console_scripts': [\n            'datum=datumaro.cli.__main__:main',\n        ],\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "\n# Copyright (C) 2019-2020 Intel Corporation\n#\n# SPDX-License-Identifier: MIT\n\nfrom distutils.util import strtobool\nimport os\nimport os.path as osp\nimport re\nimport setuptools\n\n# Snyk scan integration\nhere = None\n\n\ndef find_version(project_dir=None):\n    if not project_dir:\n        project_dir = osp.dirname(osp.abspath(__file__))\n\n    file_path = osp.join(project_dir, 'datumaro', 'version.py')\n\n    with open(file_path, 'r') as version_file:\n        version_text = version_file.read()\n\n    # PEP440:\n    # https://www.python.org/dev/peps/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions\n    pep_regex = r'([1-9]\\d*!)?(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))*((a|b|rc)(0|[1-9]\\d*))?(\\.post(0|[1-9]\\d*))?(\\.dev(0|[1-9]\\d*))?'\n    version_regex = r'VERSION\\s*=\\s*.(' + pep_regex + ').'\n    match = re.match(version_regex, version_text)\n    if not match:\n        raise RuntimeError(\"Failed to find version string in '%s'\" % file_path)\n\n    version = version_text[match.start(1) : match.end(1)]\n    return version\n\ndef get_requirements():\n    requirements = [\n        'attrs>=19.3.0',\n        'defusedxml',\n        'GitPython',\n        'lxml',\n        'matplotlib',\n        'numpy>=1.17.3',\n        'Pillow',\n\n        # Avoid 2.0.2 Linux binary distribution because of\n        # a conflict in numpy versions with TensorFlow:\n        # - TF is compiled with numpy 1.19 ABI\n        # - pycocotools is compiled with numpy 1.20 ABI\n        # Using a previous version allows to force package rebuilding.\n        #\n        # https://github.com/openvinotoolkit/datumaro/issues/253\n        'pycocotools!=2.0.2; platform_system != \"Windows\"',\n        'pycocotools-windows; platform_system == \"Windows\"',\n\n        'PyYAML',\n        'scikit-image',\n        'tensorboardX',\n    ]\n    if strtobool(os.getenv('DATUMARO_HEADLESS', '0').lower()):\n        requirements.append('opencv-python-headless')\n    else:\n        requirements.append('opencv-python')\n\n    return requirements\n\nwith open('README.md', 'r') as fh:\n    long_description = fh.read()\n\nsetuptools.dist.Distribution().fetch_build_eggs([\n    'Cython>=0.27.3' # required for pycocotools and others, if need to compile\n])\n\nsetuptools.setup(\n    name=\"datumaro\",\n    version=find_version(here),\n    author=\"Intel\",\n    author_email=\"maxim.zhiltsov@intel.com\",\n    description=\"Dataset Management Framework (Datumaro)\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    url=\"https://github.com/openvinotoolkit/datumaro\",\n    packages=setuptools.find_packages(exclude=['tests*']),\n    classifiers=[\n        \"Programming Language :: Python :: 3\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Operating System :: OS Independent\",\n    ],\n    python_requires='>=3.6',\n    install_requires=get_requirements(),\n    extras_require={\n        'tf': ['tensorflow'],\n        'tf-gpu': ['tensorflow-gpu'],\n    },\n    entry_points={\n        'console_scripts': [\n            'datum=datumaro.cli.__main__:main',\n        ],\n    },\n)\n", "path": "setup.py"}]}