Bug 2246085 - WALinuxAgent fails to build with Python 3.13: ModuleNotFoundError: No module named 'crypt'
Summary: WALinuxAgent fails to build with Python 3.13: ModuleNotFoundError: No module ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: WALinuxAgent
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Vitaly Kuznetsov
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2291482 (view as bug list)
Depends On:
Blocks: F41FTBFS F41FailsToInstall PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-25 10:37 UTC by Karolina Surma
Modified: 2024-06-12 23:23 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-06-12 23:23:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2023-10-25 10:37:16 UTC
WALinuxAgent fails to build with Python 3.13.0a1.

+ /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -sP'
/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/version.py:65: SyntaxWarning: invalid escape sequence '\d'
  f5_version = re.compile("^Version: (\d+\.\d+\.\d+)")  # pylint: disable=W1401
/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/version.py:66: SyntaxWarning: invalid escape sequence '\w'
  f5_product = re.compile("^Product: ([\w-]+)")  # pylint: disable=W1401
/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/version.py:108: SyntaxWarning: invalid escape sequence '\-'
  release = re.sub('\-.*\Z', '', ustr(platform.release()))  # pylint: disable=W1401
/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/version.py:111: SyntaxWarning: invalid escape sequence '\-'
  release = re.sub('\-.*\Z', '', ustr(platform.release()))  # pylint: disable=W1401
/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/version.py:116: SyntaxWarning: invalid escape sequence '\-'
  release = re.sub('\-.*\Z', '', ustr(platform.release()))  # pylint: disable=W1401
/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/version.py:225: SyntaxWarning: invalid escape sequence '\.'
  AGENT_PKG_PATTERN = re.compile(AGENT_PATTERN+"\.zip")  # pylint: disable=W1401
/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/version.py:231: SyntaxWarning: invalid escape sequence '\d'
  EXT_HANDLER_PATTERN = b".*/WALinuxAgent-(\d+.\d+.\d+[.\d+]*).*-run-exthandlers"  # pylint: disable=W1401
Traceback (most recent call last):
  File "/builddir/build/BUILD/WALinuxAgent-2.9.1.1/setup.py", line 28, in <module>
    from azurelinuxagent.common.osutil import get_osutil
  File "/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/osutil/__init__.py", line 18, in <module>
    from azurelinuxagent.common.osutil.factory import get_osutil
  File "/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/osutil/factory.py", line 22, in <module>
    from azurelinuxagent.common.version import DISTRO_NAME, DISTRO_CODE_NAME, DISTRO_VERSION, DISTRO_FULL_NAME
  File "/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/version.py", line 23, in <module>
    import azurelinuxagent.common.conf as conf
  File "/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/conf.py", line 26, in <module>
    from azurelinuxagent.common.utils.fileutil import read_file #pylint: disable=R0401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/utils/fileutil.py", line 32, in <module>
    import azurelinuxagent.common.utils.textutil as textutil
  File "/builddir/build/BUILD/WALinuxAgent-2.9.1.1/azurelinuxagent/common/utils/textutil.py", line 20, in <module>
    import crypt
ModuleNotFoundError: No module named 'crypt'

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/06546753-WALinuxAgent/

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

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.

Comment 1 Cristian Delgado 2023-12-12 21:01:27 UTC
The PR was submitted upstream, replacing crypt for legacycrypt

https://github.com/Azure/WALinuxAgent/pull/2994#issuecomment-1850708656

Comment 2 Aoife Moloney 2024-02-15 23:01:47 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 3 Miro Hrončok 2024-05-24 11:10:39 UTC
legacycrypt is not yet packaged in Fedora.


However, crypt_r is. As a stopgap measure, (Build)Requiring python3-crypt-r will solve this problem, as the package offers the crypt module on Python 3.13+

https://github.com/fedora-python/crypt_r



If upstream wants to use legacycrypt, the long term solution is to package it.

Comment 4 Karolina Surma 2024-06-12 15:12:01 UTC
*** Bug 2291482 has been marked as a duplicate of this bug. ***

Comment 5 Jeremy Cline 2024-06-12 19:19:01 UTC
I've requested upstream switch over to crypt-r in https://github.com/Azure/WALinuxAgent/pull/3141, we'll see how that goes. Based on https://github.com/Azure/WALinuxAgent/pull/3070#issuecomment-2163647062 there will be a release around the end of the month.

Comment 6 Adam Williamson 2024-06-12 21:10:53 UTC
Note now we've merged the Python 3.13 tag, WALinuxAgent is FTI, and this breaks build of Azure images: https://kojipkgs.fedoraproject.org//work/tasks/8394/118928394/root.log - "nothing provides python3.12dist(distro) needed by WALinuxAgent-2.10.0.8-2.fc41.noarch from 4afab047d3744b579c4870c1bc9b83d6". So, this is somewhat more urgent now.

Comment 7 Miro Hrončok 2024-06-12 22:43:30 UTC
Note that crypt_r can be imported as crypt, so just adding (Build)Requires: python3-crypt-r will solve this for the current version in Fedora.

Comment 8 Adam Williamson 2024-06-12 22:53:10 UTC
Ah, we already went ahead and merged/built jcline's fix, but that's useful, thanks...maybe he can tweak his fix with that info. https://bodhi.fedoraproject.org/updates/FEDORA-2024-c484b23489 is built, waiting for signing.

Comment 9 Adam Williamson 2024-06-12 23:23:34 UTC
ok, it's stable now.


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