Skip to content

RecursionError when loading file in python 3.14 #6762

@jfrost-mo

Description

@jfrost-mo

🐛 Bug Report

Whenever you try and load a file (at least for NetCDF files) in iris under python 3.14, the process crashes with a RecursionError.

How To Reproduce

Steps to reproduce the behaviour:

  1. Create a conda environment with python 3.14 and iris with conda create -n py314-iris python iris

  2. Save the following code into a file called test.py:

    #!/usr/bin/env python3
    """Test script for python 3.14 support in iris."""
    
    import sys
    import iris
    
    print(f"Using python {sys.version}")
    print(f"Using iris {iris.__version__}")
    cubes = iris.load("air_temp.nc")
    print(cubes)
  3. Download air_temp.nc and put it in the same directory as the test.py script.

  4. Activate the conda environment with conda activate py314-iris

  5. Run the script with python test.py

  6. Observe the RecursionError.

Expected behaviour

Iris successfully loads the file, and doesn't crash.

Environment

  • OS & Version: Red Hat Enterprise Linux 9.6 (Plow)
  • Iris Version: 3.13.1 (from conda-forge)
  • Python Version: 3.14.0 | packaged by conda-forge | (main, Oct 22 2025, 23:24:08) [GCC 14.3.0]

Additional context

The following traceback lines are repeated many times.

  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 138, in deepcopy
    y = copier(memo)
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/site-packages/iris/coords.py", line 2730, in __deepcopy__
    new_coord = copy.deepcopy(super(), memo)
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 157, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 234, in _reconstruct
    y = func(*args)
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 233, in <genexpr>
    args = (deepcopy(arg, memo) for arg in args)
            ~~~~~~~~^^^^^^^^^^^
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 138, in deepcopy
    y = copier(memo)
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/site-packages/iris/coords.py", line 2730, in __deepcopy__
    new_coord = copy.deepcopy(super(), memo)
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 157, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 234, in _reconstruct
    y = func(*args)
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 233, in <genexpr>
    args = (deepcopy(arg, memo) for arg in args)
            ~~~~~~~~^^^^^^^^^^^
  File "/home/users/james.frost/.conda/envs/py314-iris/lib/python3.14/copy.py", line 138, in deepcopy
    y = copier(memo)
RecursionError: maximum recursion depth exceeded

Please see log.txt for the full traceback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions