Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Mar 2024 17:41:13 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 277700] Numpy support should be enabled by default with the graphics/py-gdal port
Message-ID:  <bug-277700-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277700

            Bug ID: 277700
           Summary: Numpy support should be enabled by default with the
                    graphics/py-gdal port
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: sunpoet@FreeBSD.org
          Reporter: kyle.a.taylor@gmail.com
             Flags: maintainer-feedback?(sunpoet@FreeBSD.org)
          Assignee: sunpoet@FreeBSD.org

Hey All - I'm running into an issue with GDAL utilities packaged with the g=
dal
and pygdal utilities in ports (installed via pkg). This library is used to
read/write geospatial datasets and includes a number of utility scripts for
transforming raster data from the command line. If I run one of the gdal
utility commands... e.g.:

> gdal_calc.py -A 2023_30m_cdls.tif --outfile=3D2023_30m_cdls_greyscale.tif=
 --calc=3D"A*1" --NoDataValue=3D0 --co=3D"compress=3Dlzw"
Traceback (most recent call last):
  File "/usr/local/bin/gdal_calc.py", line 8, in <module>
    from osgeo_utils.gdal_calc import *  # noqa
  File "/usr/local/lib/python3.9/site-packages/osgeo_utils/gdal_calc.py", l=
ine
46, in <module>
    from osgeo import gdal, gdal_array
  File "/usr/local/lib/python3.9/site-packages/osgeo/gdal_array.py", line 1=
0,
in <module>
    from . import _gdal_array
ImportError: cannot import name '_gdal_array' from 'osgeo'
(/usr/local/lib/python3.9/site-packages/osgeo/__init__.py)

I get errors from _gdal_array in the osgeo python library. I did some
searching, and people report this issue with the version of numpy that gdal=
 was
built against. E.g., Gentoo folks report this same error when you build gdal
from source without having numpy available. When I search for gdal and pygd=
al
in pkg to check the version I have installed, it's compiled without the num=
py
flag by default:

> uname -a=20
FreeBSD *** 14.0-RELEASE-p5 FreeBSD 14.0-RELEASE-p5 #0: Tue Feb 13 23:37:36=
 UTC
2024=20=20=20=20
root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
amd64

> pkg info py39-gdal
py39-gdal-3.8.2
Name           : py39-gdal
Version        : 3.8.2
Installed on   : Tue Jan 16 08:27:46 2024 MST
Origin         : graphics/py-gdal
Architecture   : FreeBSD:14:amd64
Prefix         : /usr/local
Categories     : python graphics
Licenses       : MIT
Maintainer     : sunpoet@FreeBSD.org
WWW            : https://gdal.org/
Comment        : Python binding for GDAL
Options        :
        NUMPY          : off
Shared Libs required:
        libgdal.so.34
Annotations    :
        FreeBSD_version: 1400097
        build_timestamp: 2024-01-06T14:44:54+0000
        built_by       : poudriere-git-3.4.0
        cpe            : cpe:2.3:a:osgeo:gdal:3.8.2:::::freebsd14:x64
        flavor         : py39
        port_checkout_unclean: no
        port_git_hash  : 756e18783
        ports_top_checkout_unclean: no
        ports_top_git_hash: 756e18783
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 6.26MiB
Description    :
This port is the Python binding for GDAL (Geospatial Data Abstraction Libra=
ry).

> pkg info gdal-3.8.2_1
gdal-3.8.2_1
Name           : gdal
Version        : 3.8.2_1
Installed on   : Thu Feb  1 08:46:53 2024 MST
Origin         : graphics/gdal
Architecture   : FreeBSD:14:amd64
Prefix         : /usr/local
Categories     : graphics geography
Licenses       : MIT
Maintainer     : sunpoet@FreeBSD.org
WWW            : https://gdal.org/
Comment        : Translator library for raster geospatial data formats
Options        :

I can't imagine a situation where a developer would want to work with py-gd=
al
without numpy support. And omitting this flag breaks the several of the pyt=
hon
utilities distributed with gdal. Can we change this so that numpy array sup=
port
is included by default when building py-gdal.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277700-7788>