Bug 2271059 - cloud-init fails to build with Python 3.13: ModuleNotFoundError: No module named 'crypt', AttributeError: module 'passlib' has no attribute 'hash'
Summary: cloud-init fails to build with Python 3.13: ModuleNotFoundError: No module na...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: cloud-init
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Major Hayden 🤠
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-03-22 13:24 UTC by Karolina Surma
Modified: 2024-05-24 11:07 UTC (History)
9 users (show)

Fixed In Version: 24.1.4-2
Clone Of:
Environment:
Last Closed: 2024-05-24 11:07:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-03-22 13:24:23 UTC
cloud-init fails to build with Python 3.13.0a5.

==================================== ERRORS ====================================
_______________ ERROR collecting tests/unittests/test_upgrade.py _______________
cloudinit/sources/DataSourceAzure.py:54: in <module>
    import crypt
E   ModuleNotFoundError: No module named 'crypt'

During handling of the above exception, another exception occurred:
/usr/lib/python3.13/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.13/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.13/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.13/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.13/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.13/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3.13/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.13/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
/usr/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
tests/unittests/test_upgrade.py:20: in <module>
    from cloudinit.sources.DataSourceAzure import DataSourceAzure
cloudinit/sources/DataSourceAzure.py:63: in <module>
    blowfish_hash = passlib.hash.sha512_crypt.hash
E   AttributeError: module 'passlib' has no attribute 'hash'
________ ERROR collecting tests/unittests/cmd/devel/test_net_convert.py ________
cloudinit/sources/DataSourceAzure.py:54: in <module>
    import crypt
E   ModuleNotFoundError: No module named 'crypt'

During handling of the above exception, another exception occurred:
/usr/lib/python3.13/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.13/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.13/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.13/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.13/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.13/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3.13/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.13/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
/usr/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
tests/unittests/cmd/devel/test_net_convert.py:8: in <module>
    from cloudinit.cmd.devel import net_convert
cloudinit/cmd/devel/net_convert.py:22: in <module>
    from cloudinit.sources import DataSourceAzure as azure
cloudinit/sources/DataSourceAzure.py:63: in <module>
    blowfish_hash = passlib.hash.sha512_crypt.hash
E   AttributeError: module 'passlib' has no attribute 'hash'
=============================== warnings summary ===============================
../../../../usr/lib/python3.13/site-packages/_pytest/config/__init__.py:1316
  /usr/lib/python3.13/site-packages/_pytest/config/__init__.py:1316: PytestRemovedIn8Warning: The --strict option is deprecated, use --strict-markers instead.
    self.issue_config_time_warning(

tests/unittests/helpers.py:545
  /builddir/build/BUILD/cloud-init-23.4.4/tests/unittests/helpers.py:545: DeprecationWarning: Accessing jsonschema.__version__ is deprecated and will be removed in a future release. Use importlib.metadata directly to query for jsonschema's version.
    int(part) for part in jsonschema.__version__.split(".")  # type: ignore

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/unittests/test_upgrade.py - AttributeError: module 'passlib' has ...
ERROR tests/unittests/cmd/devel/test_net_convert.py - AttributeError: module ...
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
======================== 2 warnings, 2 errors in 3.84s =========================

According to https://docs.python.org/3.13/whatsnew/3.13.html:

PEP 594: Remove the crypt module and its private _crypt extension, deprecated in Python 3.11.
The hashlib module is a potential replacement for certain use cases.
Otherwise, the following PyPI projects can be used:
- bcrypt: Modern password hashing for your software and your servers.
- passlib: Comprehensive password hashing framework supporting over 30 schemes.
- argon2-cffi: The secure Argon2 password hashing algorithm.
- legacycrypt: Wrapper to the POSIX crypt library call and associated functionality.
(Contributed by Victor Stinner in gh-104773.)


https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07197658-cloud-init/

For all our attempts to build cloud-init with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/cloud-init/

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.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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.


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