Bug 2283521 - python-rasterio fails to build with Python 3.13: test_create_sidecar_mask and test_update_tags fail
Summary: python-rasterio fails to build with Python 3.13: test_create_sidecar_mask and...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-rasterio
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Elliott Sales de Andrade
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13 2280823
TreeView+ depends on / blocked
 
Reported: 2024-05-27 15:33 UTC by Karolina Surma
Modified: 2024-06-14 19:06 UTC (History)
8 users (show)

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


Attachments (Terms of Use)

Description Karolina Surma 2024-05-27 15:33:37 UTC
python-rasterio fails to build with Python 3.13.0b1.

___________________________ test_create_sidecar_mask ___________________________

data = local('/tmp/pytest-of-mockbuild/pytest-0/test_create_sidecar_mask0')

    def test_create_sidecar_mask(data):
        """Write a .msk sidecar mask."""
        with rasterio.open(str(data.join('RGB.byte.tif')), 'r+') as dst:
            blue = dst.read(1, masked=False)
            mask = 255 * (blue == 0).astype('uint8')
            dst.write_mask(mask)
    
        # There should be a .msk file in this case.
        assert data.join('RGB.byte.tif').exists()
>       assert data.join('RGB.byte.tif.msk').exists()
E       AssertionError: assert False
E        +  where False = <bound method LocalPath.exists of local('/tmp/pytest-of-mockbuild/pytest-0/test_create_sidecar_mask0/RGB.byte.tif.msk')>()
E        +    where <bound method LocalPath.exists of local('/tmp/pytest-of-mockbuild/pytest-0/test_create_sidecar_mask0/RGB.byte.tif.msk')> = local('/tmp/pytest-of-mockbuild/pytest-0/test_create_sidecar_mask0/RGB.byte.tif.msk').exists
E        +      where local('/tmp/pytest-of-mockbuild/pytest-0/test_create_sidecar_mask0/RGB.byte.tif.msk') = <bound method LocalPath.join of local('/tmp/pytest-of-mockbuild/pytest-0/test_create_sidecar_mask0')>('RGB.byte.tif.msk')
E        +        where <bound method LocalPath.join of local('/tmp/pytest-of-mockbuild/pytest-0/test_create_sidecar_mask0')> = local('/tmp/pytest-of-mockbuild/pytest-0/test_create_sidecar_mask0').join

tests/test_mask_creation.py:44: AssertionError
------------------------------ Captured log call -------------------------------
DEBUG    rasterio._env:env.py:326 GDAL data files are available at built-in paths.
DEBUG    rasterio._env:env.py:326 PROJ data files are available at built-in paths.
DEBUG    rasterio._env:env.py:326 Started GDALEnv: self=<rasterio._env.GDALEnv object at 0x7f381ad60a60>.
DEBUG    rasterio._env:env.py:362 Stopped GDALEnv <rasterio._env.GDALEnv object at 0x7f381ad60a60>.
DEBUG    rasterio._env:env.py:326 GDAL data files are available at built-in paths.
DEBUG    rasterio._env:env.py:326 PROJ data files are available at built-in paths.
DEBUG    rasterio._env:env.py:326 Started GDALEnv: self=<rasterio._env.GDALEnv object at 0x7f381ad60f10>.
DEBUG    rasterio._env:env.py:362 Stopped GDALEnv <rasterio._env.GDALEnv object at 0x7f381ad60f10>.
_______________________________ test_update_tags _______________________________

data = local('/tmp/pytest-of-mockbuild/pytest-0/test_update_tags0')

    @pytest.mark.gdalbin
    def test_update_tags(data):
        tiffname = str(data.join('RGB.byte.tif'))
        with rasterio.open(tiffname, 'r+') as f:
            f.update_tags(a='1', b='2')
            f.update_tags(1, c=3)
            with pytest.raises(IndexError):
                f.update_tags(4, d=4)
            assert f.tags() == {'AREA_OR_POINT': 'Area', 'a': '1', 'b': '2'}
            assert ('c', '3') in f.tags(1).items()
        info = subprocess.check_output(["gdalinfo", tiffname]).decode('utf-8')
>       assert re.search(r'Metadata:\W+a=1\W+AREA_OR_POINT=Area\W+b=2', info)
E       AssertionError: assert None
E        +  where None = <function search at 0x7f384bcf0a40>('Metadata:\\W+a=1\\W+AREA_OR_POINT=Area\\W+b=2', 'Driver: GTiff/GeoTIFF\nFiles: /tmp/pytest-of-mockbuild/pytest-0/test_update_tags0/RGB.byte.tif\nSize is 791, 718\nCoo...CS_MAXIMUM=255\n    STATISTICS_MEAN=48.113056354743\n    STATISTICS_MINIMUM=0\n    STATISTICS_STDDEV=60.112778509941\n')
E        +    where <function search at 0x7f384bcf0a40> = re.search

tests/test_update.py:23: AssertionError
------------------------------ Captured log call -------------------------------
DEBUG    rasterio._env:env.py:326 GDAL data files are available at built-in paths.
DEBUG    rasterio._env:env.py:326 PROJ data files are available at built-in paths.
DEBUG    rasterio._env:env.py:326 Started GDALEnv: self=<rasterio._env.GDALEnv object at 0x7f381c1a0670>.
DEBUG    rasterio._env:env.py:362 Stopped GDALEnv <rasterio._env.GDALEnv object at 0x7f381c1a0670>.
DEBUG    rasterio._env:env.py:326 GDAL data files are available at built-in paths.
DEBUG    rasterio._env:env.py:326 PROJ data files are available at built-in paths.
DEBUG    rasterio._env:env.py:326 Started GDALEnv: self=<rasterio._env.GDALEnv object at 0x7f381bf085e0>.
INFO     rasterio._env:test_update.py:19 GDAL signalled an error: err_no=5, msg='RGB.byte.tif: GDALDataset::GetRasterBand(4) - Illegal band #\n'
DEBUG    rasterio._env:env.py:362 Stopped GDALEnv <rasterio._env.GDALEnv object at 0x7f381bf085e0>.

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/07495789-python-rasterio/

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

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 Adam Williamson 2024-06-14 06:10:40 UTC
The test_update_tags failure seems to be because the escaping changed somehow - it's looking for Metadata:\W+a=1\W+AREA_OR_POINT=Area\W+b=2 (with single backslashes) but we have Metadata:\\W+a=1\\W+AREA_OR_POINT=Area\\W+b=2 (with double backslashes). Not sure why that is or if it's the test or whatever generates the string that needs fixing. Will look at it more tomorrow.

Comment 2 Adam Williamson 2024-06-14 06:24:57 UTC
oh no, duh, those are regex specifiers of course. this is checking the output of gdalinfo on a TIFF file modified to add some tags...which kinda implies the modification no longer works as expected so we're not getting the expected output.

Comment 3 Adam Williamson 2024-06-14 19:06:34 UTC
Fixed in https://bodhi.fedoraproject.org/updates/FEDORA-2024-7a849ee186 .


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