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: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: WALinuxAgent
Version: 40
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Vitaly Kuznetsov
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-25 10:37 UTC by Karolina Surma
Modified: 2024-02-15 23:01 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
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.


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