Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aifc module is deprecated (and removed in Python 3.13) #144

Open
mgorny opened this issue Jun 13, 2024 · 5 comments · May be fixed by #145
Open

aifc module is deprecated (and removed in Python 3.13) #144

mgorny opened this issue Jun 13, 2024 · 5 comments · May be fixed by #145

Comments

@mgorny
Copy link

mgorny commented Jun 13, 2024

This package still uses the aifc module that is deprecated since Python 3.11, and was removed in Python 3.13.

As a result, the test suite fails with 3.13.0b2:

$ tox -e py313
py313: install_deps> python -I -m pip install pytest
.pkg: _optional_hooks> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True flit_core.buildapi
py313: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/audioread/.tox/.tmp/package/2/audioread-3.0.2.tar.gz
py313: commands[0]> pytest
========================================================= test session starts =========================================================
platform linux -- Python 3.13.0b2, pytest-8.2.2, pluggy-1.5.0
cachedir: .tox/py313/.pytest_cache
rootdir: /tmp/audioread
configfile: pyproject.toml
collected 4 items                                                                                                                     

test/test_audioread.py FFFF                                                                                                     [100%]

============================================================== FAILURES ===============================================================
__________________________________________________ test_audioread_early_exit[test-1] __________________________________________________

audiofile = <conftest.AudiofileSpec object at 0x7efcb006cad0>

    def test_audioread_early_exit(audiofile):
        """Abort the read before it is completed.
    
        This test guards against regressions such as
        https://github.com/beetbox/audioread/pull/78
    
        """
>       with audioread.audio_open(audiofile.path) as a:

test/test_audioread.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py313/lib/python3.13/site-packages/audioread/__init__.py:123: in audio_open
    backends = available_backends()
.tox/py313/lib/python3.13/site-packages/audioread/__init__.py:80: in available_backends
    from . import rawread
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    # This file is part of audioread.
    # Copyright 2011, Adrian Sampson.
    #
    # Permission is hereby granted, free of charge, to any person obtaining
    # a copy of this software and associated documentation files (the
    # "Software"), to deal in the Software without restriction, including
    # without limitation the rights to use, copy, modify, merge, publish,
    # distribute, sublicense, and/or sell copies of the Software, and to
    # permit persons to whom the Software is furnished to do so, subject to
    # the following conditions:
    #
    # The above copyright notice and this permission notice shall be
    # included in all copies or substantial portions of the Software.
    
    """Uses standard-library modules to read AIFF, AIFF-C, and WAV files."""
>   import aifc
E   ModuleNotFoundError: No module named 'aifc'

.tox/py313/lib/python3.13/site-packages/audioread/rawread.py:16: ModuleNotFoundError
__________________________________________________ test_audioread_early_exit[test-2] __________________________________________________

audiofile = <conftest.AudiofileSpec object at 0x7efcb001bc50>

    def test_audioread_early_exit(audiofile):
        """Abort the read before it is completed.
    
        This test guards against regressions such as
        https://github.com/beetbox/audioread/pull/78
    
        """
>       with audioread.audio_open(audiofile.path) as a:

test/test_audioread.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py313/lib/python3.13/site-packages/audioread/__init__.py:123: in audio_open
    backends = available_backends()
.tox/py313/lib/python3.13/site-packages/audioread/__init__.py:80: in available_backends
    from . import rawread
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    # This file is part of audioread.
    # Copyright 2011, Adrian Sampson.
    #
    # Permission is hereby granted, free of charge, to any person obtaining
    # a copy of this software and associated documentation files (the
    # "Software"), to deal in the Software without restriction, including
    # without limitation the rights to use, copy, modify, merge, publish,
    # distribute, sublicense, and/or sell copies of the Software, and to
    # permit persons to whom the Software is furnished to do so, subject to
    # the following conditions:
    #
    # The above copyright notice and this permission notice shall be
    # included in all copies or substantial portions of the Software.
    
    """Uses standard-library modules to read AIFF, AIFF-C, and WAV files."""
>   import aifc
E   ModuleNotFoundError: No module named 'aifc'

.tox/py313/lib/python3.13/site-packages/audioread/rawread.py:16: ModuleNotFoundError
_____________________________________________________ test_audioread_full[test-1] _____________________________________________________

audiofile = <conftest.AudiofileSpec object at 0x7efcafd8c2d0>

    def test_audioread_full(audiofile):
        """Read the audio data from the file."""
>       with audioread.audio_open(audiofile.path) as a:

test/test_audioread.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py313/lib/python3.13/site-packages/audioread/__init__.py:123: in audio_open
    backends = available_backends()
.tox/py313/lib/python3.13/site-packages/audioread/__init__.py:80: in available_backends
    from . import rawread
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    # This file is part of audioread.
    # Copyright 2011, Adrian Sampson.
    #
    # Permission is hereby granted, free of charge, to any person obtaining
    # a copy of this software and associated documentation files (the
    # "Software"), to deal in the Software without restriction, including
    # without limitation the rights to use, copy, modify, merge, publish,
    # distribute, sublicense, and/or sell copies of the Software, and to
    # permit persons to whom the Software is furnished to do so, subject to
    # the following conditions:
    #
    # The above copyright notice and this permission notice shall be
    # included in all copies or substantial portions of the Software.
    
    """Uses standard-library modules to read AIFF, AIFF-C, and WAV files."""
>   import aifc
E   ModuleNotFoundError: No module named 'aifc'

.tox/py313/lib/python3.13/site-packages/audioread/rawread.py:16: ModuleNotFoundError
_____________________________________________________ test_audioread_full[test-2] _____________________________________________________

audiofile = <conftest.AudiofileSpec object at 0x7efcafff7950>

    def test_audioread_full(audiofile):
        """Read the audio data from the file."""
>       with audioread.audio_open(audiofile.path) as a:

test/test_audioread.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py313/lib/python3.13/site-packages/audioread/__init__.py:123: in audio_open
    backends = available_backends()
.tox/py313/lib/python3.13/site-packages/audioread/__init__.py:80: in available_backends
    from . import rawread
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    # This file is part of audioread.
    # Copyright 2011, Adrian Sampson.
    #
    # Permission is hereby granted, free of charge, to any person obtaining
    # a copy of this software and associated documentation files (the
    # "Software"), to deal in the Software without restriction, including
    # without limitation the rights to use, copy, modify, merge, publish,
    # distribute, sublicense, and/or sell copies of the Software, and to
    # permit persons to whom the Software is furnished to do so, subject to
    # the following conditions:
    #
    # The above copyright notice and this permission notice shall be
    # included in all copies or substantial portions of the Software.
    
    """Uses standard-library modules to read AIFF, AIFF-C, and WAV files."""
>   import aifc
E   ModuleNotFoundError: No module named 'aifc'

.tox/py313/lib/python3.13/site-packages/audioread/rawread.py:16: ModuleNotFoundError
======================================================= short test summary info =======================================================
FAILED test/test_audioread.py::test_audioread_early_exit[test-1] - ModuleNotFoundError: No module named 'aifc'
FAILED test/test_audioread.py::test_audioread_early_exit[test-2] - ModuleNotFoundError: No module named 'aifc'
FAILED test/test_audioread.py::test_audioread_full[test-1] - ModuleNotFoundError: No module named 'aifc'
FAILED test/test_audioread.py::test_audioread_full[test-2] - ModuleNotFoundError: No module named 'aifc'
========================================================== 4 failed in 0.08s ==========================================================
py313: exit 1 (0.38 seconds) /tmp/audioread> pytest pid=97746
.pkg: _exit> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True flit_core.buildapi
  py313: FAIL code 1 (5.46=setup[5.08]+cmd[0.38] seconds)
  evaluation failed :( (5.57 seconds)
lucas42 added a commit to lucas42/lucos_media_import that referenced this issue Oct 11, 2024
Python 3.13 no longer includes `aifc` in standard libraries https://docs.python.org/3.13/whatsnew/3.13.html#whatsnew313-pep594
This is still used by audioread, a dependency of pyacousticid beetbox/audioread#144
@lucas42
Copy link

lucas42 commented Oct 14, 2024

It's worth mentioning that the sunau module is also deprecated and being removed at the same time.
(There was discussion about wave, but looks like they'd decided to keep it in python core)

There's an attempt to make the deprecated libraries available as pip dependencies: https://github.com/youknowone/python-deadlib However, it seems there's currently a couple of issues with that repository which means it won't work with 3.13 yet.

@lucas42
Copy link

lucas42 commented Oct 14, 2024

I've submitted a pull request to the python-deadlib library to try to get its aifc fork from the python core working on python 3.13: youknowone/python-deadlib#9

Another potential approach would be to handle the ModuleNotFoundError more gracefully here. That would reduce the range of file types supported on python3.13, but is still better than a hard error, even when aifc support isn't needed!

lucas42 added a commit to lucas42/lucos_media_import that referenced this issue Oct 25, 2024
…repo to prevent import errors on Python 3.13

Workaround for beetbox/audioread#144
@lucas42
Copy link

lucas42 commented Oct 30, 2024

The python-deadlib modules have now been fixed up and can be used to replace the missing modules from python core.

So a workaround to this issue is pip install standard-aifc standard-sunau

lucas42 added a commit to lucas42/audioread that referenced this issue Oct 30, 2024
…and above.

Python core removed these modules in 3.13 as part of PEP-594 https://peps.python.org/pep-0594/
The standard-* modules are forks of the modules that had previously been in the python core.
Fixes beetbox#144
@lucas42 lucas42 linked a pull request Oct 30, 2024 that will close this issue
@montvid
Copy link

montvid commented Dec 7, 2024

The library does not build on python 3.12 too Anjok07/ultimatevocalremovergui#1578 (comment)

pipx >(analyze_pip_output:311): pip seemed to fail to build package:
    audioread==3.0.0

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    ModuleNotFoundError: No module named 'imp'

@lucas42
Copy link

lucas42 commented Dec 8, 2024

@montvid I don't think your error is related to this issue.

Looks like that the imp issue might have been fixed in 3.0.1 (see #136 )
I'd guess ultimatevocalremovergui just needs to update its dependencies to the latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants