Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1926090 - python-tabulate fails to build with Python 3.10: ImportError: cannot import name 'Iterable' from 'collections'
Summary: python-tabulate fails to build with Python 3.10: ImportError: cannot import n...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-tabulate
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Igor Raits
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10 1926075 1926078 1926079 1926080 1926092
TreeView+ depends on / blocked
 
Reported: 2021-02-08 07:45 UTC by Tomáš Hrnčiar
Modified: 2021-02-23 11:24 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-23 11:24:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github astanin python-tabulate issues 104 0 None open Deprecation warning when importing on Python 3.10 2021-02-08 09:42:32 UTC
Github astanin python-tabulate pull 105 0 None open Fix DeprecationWarning on Python 3.10 2021-02-08 09:42:32 UTC

Description Tomáš Hrnčiar 2021-02-08 07:45:43 UTC
python-tabulate fails to build with Python 3.10.0a5.

Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)) ... ERROR
Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)) ... ERROR
Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)) ... ERROR
Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)) ... ERROR

======================================================================
ERROR: Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py))
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib/python3.10/site-packages/nose/loader.py", line 416, in loadTestsFromName
    module = self.importer.importFromPath(
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/lib64/python3.10/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib64/python3.10/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 729, in _load
  File "<frozen importlib._bootstrap>", line 698, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 833, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_api.py", line 7, in <module>
    from tabulate import tabulate, tabulate_formats, simple_separated_format
  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)

======================================================================
ERROR: test_cli.test_script_from_stdin_to_stdout
Command line utility: read from stdin, print to stdout
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 119, in test_script_from_stdin_to_stdout
    out = run_and_capture_stdout(cmd, input=sample_input())
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 96, in run_and_capture_stdout
    raise IOError(err)
OSError: b'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>\n    from collections import Iterable\nImportError: cannot import name \'Iterable\' from \'collections\' (/usr/lib64/python3.10/collections/__init__.py)\n'

======================================================================
ERROR: test_cli.test_script_from_file_to_stdout
Command line utility: read from file, print to stdout
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 132, in test_script_from_file_to_stdout
    out = run_and_capture_stdout(cmd)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 96, in run_and_capture_stdout
    raise IOError(err)
OSError: b'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>\n    from collections import Iterable\nImportError: cannot import name \'Iterable\' from \'collections\' (/usr/lib64/python3.10/collections/__init__.py)\n'

======================================================================
ERROR: test_cli.test_script_from_file_to_file
Command line utility: read from file, write to file
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 152, in test_script_from_file_to_file
    out = run_and_capture_stdout(cmd)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 96, in run_and_capture_stdout
    raise IOError(err)
OSError: b'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>\n    from collections import Iterable\nImportError: cannot import name \'Iterable\' from \'collections\' (/usr/lib64/python3.10/collections/__init__.py)\n'

======================================================================
ERROR: test_cli.test_script_header_option
Command line utility: -1, --header option
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 172, in test_script_header_option
    out = run_and_capture_stdout(cmd, input=raw_table)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 96, in run_and_capture_stdout
    raise IOError(err)
OSError: b'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>\n    from collections import Iterable\nImportError: cannot import name \'Iterable\' from \'collections\' (/usr/lib64/python3.10/collections/__init__.py)\n'

======================================================================
ERROR: test_cli.test_script_sep_option
Command line utility: -s, --sep option
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 185, in test_script_sep_option
    out = run_and_capture_stdout(cmd, input=raw_table)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 96, in run_and_capture_stdout
    raise IOError(err)
OSError: b'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>\n    from collections import Iterable\nImportError: cannot import name \'Iterable\' from \'collections\' (/usr/lib64/python3.10/collections/__init__.py)\n'

======================================================================
ERROR: test_cli.test_script_floatfmt_option
Command line utility: -F, --float option
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 197, in test_script_floatfmt_option
    out = run_and_capture_stdout(cmd, input=raw_table)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 96, in run_and_capture_stdout
    raise IOError(err)
OSError: b'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>\n    from collections import Iterable\nImportError: cannot import name \'Iterable\' from \'collections\' (/usr/lib64/python3.10/collections/__init__.py)\n'

======================================================================
ERROR: test_cli.test_script_format_option
Command line utility: -f, --format option
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 209, in test_script_format_option
    out = run_and_capture_stdout(cmd, input=raw_table)
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_cli.py", line 96, in run_and_capture_stdout
    raise IOError(err)
OSError: b'Traceback (most recent call last):\n  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>\n    from collections import Iterable\nImportError: cannot import name \'Iterable\' from \'collections\' (/usr/lib64/python3.10/collections/__init__.py)\n'

======================================================================
ERROR: Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py))
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib/python3.10/site-packages/nose/loader.py", line 416, in loadTestsFromName
    module = self.importer.importFromPath(
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/lib64/python3.10/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib64/python3.10/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 729, in _load
  File "<frozen importlib._bootstrap>", line 698, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 833, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_input.py", line 7, in <module>
    from tabulate import tabulate
  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)

======================================================================
ERROR: Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py))
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib/python3.10/site-packages/nose/loader.py", line 416, in loadTestsFromName
    module = self.importer.importFromPath(
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/lib64/python3.10/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib64/python3.10/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 729, in _load
  File "<frozen importlib._bootstrap>", line 698, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 833, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_internal.py", line 7, in <module>
    import tabulate as T
  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)

======================================================================
ERROR: Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py))
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib/python3.10/site-packages/nose/loader.py", line 416, in loadTestsFromName
    module = self.importer.importFromPath(
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/lib64/python3.10/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib64/python3.10/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 729, in _load
  File "<frozen importlib._bootstrap>", line 698, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 833, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_output.py", line 7, in <module>
    import tabulate as tabulate_module
  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)

======================================================================
ERROR: Failure: ImportError (cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py))
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib/python3.10/site-packages/nose/loader.py", line 416, in loadTestsFromName
    module = self.importer.importFromPath(
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python3.10/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/usr/lib64/python3.10/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib64/python3.10/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 729, in _load
  File "<frozen importlib._bootstrap>", line 698, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 833, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/builddir/build/BUILD/tabulate-0.8.7/test/test_regression.py", line 7, in <module>
    from tabulate import tabulate, _text_type, _long_type, TableFormat, Line, DataRow
  File "/builddir/build/BUILD/tabulate-0.8.7/tabulate.py", line 16, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)

----------------------------------------------------------------------
Ran 12 tests in 0.360s

FAILED (errors=12)
Test failed: <unittest.runner.TextTestResult run=12 errors=12 failures=0>

bpo-37324: Remove deprecated aliases to Collections Abstract Base Classes
from the collections module.

https://docs.python.org/3.10/whatsnew/changelog.html#python-3-10-0-alpha-5

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01952498-python-tabulate/

For all our attempts to build python-tabulate with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-tabulate/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2021-02-08 09:42:33 UTC
So, tabulate already "fixed" this many years ago, but they do:

if python_version_tuple() >= ("3", "3", "0"):
    from collections.abc import Iterable
else:
    from collections import Iterable

And obviously, ("3", "10", "0a5") < ("3", "3", "0") because strings.

Since upstream fix is proposed for a while, I suggest we patch it in Fedora temporarily to:

from collections.abc import Iterable

Comment 3 Ben Cotton 2021-02-09 16:05:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.


Note You need to log in before you can comment on or make changes to this bug.