{"action":"created","issue":{"url":"https://api.github.com/repos/OSGeo/gdal/issues/822","repository_url":"https://api.github.com/repos/OSGeo/gdal","labels_url":"https://api.github.com/repos/OSGeo/gdal/issues/822/labels{/name}","comments_url":"https://api.github.com/repos/OSGeo/gdal/issues/822/comments","events_url":"https://api.github.com/repos/OSGeo/gdal/issues/822/events","html_url":"https://github.com/OSGeo/gdal/issues/822","id":346740132,"node_id":"MDU6SXNzdWUzNDY3NDAxMzI=","number":822,"title":"[suggestion] Python GDAL bindings","user":{"login":"Daniel-M","id":669787,"node_id":"MDQ6VXNlcjY2OTc4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/669787?v=4","gravatar_id":"","url":"https://api.github.com/users/Daniel-M","html_url":"https://github.com/Daniel-M","followers_url":"https://api.github.com/users/Daniel-M/followers","following_url":"https://api.github.com/users/Daniel-M/following{/other_user}","gists_url":"https://api.github.com/users/Daniel-M/gists{/gist_id}","starred_url":"https://api.github.com/users/Daniel-M/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daniel-M/subscriptions","organizations_url":"https://api.github.com/users/Daniel-M/orgs","repos_url":"https://api.github.com/users/Daniel-M/repos","events_url":"https://api.github.com/users/Daniel-M/events{/privacy}","received_events_url":"https://api.github.com/users/Daniel-M/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-01T19:40:27Z","updated_at":"2018-08-01T19:49:38Z","closed_at":null,"author_association":"NONE","body":"\r\nHi GDAL developers.\r\nI appreciate your work in developing this awesome library/tool. The past days I've been working for hours to get compiled GDAL python bindings running on virtual environments and docker containers. I always encountered an error related to `_gdal_array` module not to be found when deploying the app build upon gdal. After an intensive search it turns out that the package `numpy` and python headers are a prerequisite to get GDAL fully functional. I found this at the link [https://pypi.org/project/GDAL/](https://pypi.org/project/GDAL/) which isn't related at all with my problem in search engines. As far as I know, this gotcha is not documented at the official [www.gdal.org](www.gdal.org) web page, nor described in the Readme of this repo or the official Wiki. I just came by to say that if you are responsible for the deployment of the GDAL module to PyPI, add the `numpy` module as a requirement , or at least make it show message to stdout which warns about the missing `_gdal_array` error related to a lack of numpy or the python-dev headers.\r\n\r\nOn the other hand, the `./configure --with-python=...` does not check if  numpy is available in the system or for the indicated python binary.\r\n\r\nThe error raises when trying to access the raster bands of a gdal.Dataset, and might look like this,\r\n\r\n```\r\n  File \"/usr/local/lib/python3.5/dist-packages/osgeo/gdal.py\", line 2549, in WriteArray\r\n    from . import gdalnumeric\r\n  File \"/usr/local/lib/python3.5/dist-packages/osgeo/gdalnumeric.py\", line 1, in <module>\r\n    from osgeo.gdal_array import *\r\n  File \"/usr/local/lib/python3.5/dist-packages/osgeo/gdal_array.py\", line 28, in <module>\r\n    _gdal_array = swig_import_helper()\r\n  File \"/usr/local/lib/python3.5/dist-packages/osgeo/gdal_array.py\", line 20, in swig_import_helper\r\n    import _gdal_array\r\nImportError: No module named '_gdal_array\r\n```\r\n\r\nAs a comparison, here's how `/usr/local/lib/python3.5/dist-packages/osgeo/` looks when \r\nnumpy is not availabe \r\n```\r\nroot@bc5c55cd2daf:/# ls -la /usr/local/lib/python3.5/dist-packages/osgeo/\r\ntotal 6068\r\ndrwxr-sr-x 3 root staff    4096 Jul 31 17:34 .\r\ndrwxrwsr-x 1 root staff    4096 Aug  1 00:52 ..\r\n-rw-r--r-- 1 root staff     777 Apr 14  2017 __init__.py\r\ndrwxr-sr-x 2 root staff    4096 Jul 31 17:34 __pycache__\r\n-rwxr-xr-x 1 root staff 2049776 Jul 31 17:33 _gdal.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff  217864 Jul 31 17:33 _gdalconst.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff  323816 Jul 31 17:33 _gnm.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff 2165920 Jul 31 17:33 _ogr.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff  932960 Jul 31 17:33 _osr.cpython-35m-x86_64-linux-gnu.so\r\n-rw-r--r-- 1 root staff  139138 Jul 31 17:33 gdal.py\r\n-rw-r--r-- 1 root staff   18841 Jul 31 17:34 gdal_array.py\r\n-rw-r--r-- 1 root staff   15338 Aug 16  2017 gdalconst.py\r\n-rw-r--r-- 1 root staff      51 Apr 14  2017 gdalnumeric.py\r\n-rw-r--r-- 1 root staff   10868 Jul 31 17:34 gnm.py\r\n-rw-r--r-- 1 root staff  252079 Jul 31 17:33 ogr.py\r\n-rw-r--r-- 1 root staff   46183 Aug 16  2017 osr.py\r\n```\r\nHere's how it looks when `numpy` is available prior GDAL installation,\r\n\r\n```\r\nroot@e3fbb273422d:/app# ls -la /usr/local/lib/python3/dist-packages/osgeo/\r\ntotal 6348\r\ndrwxr-sr-x 3 root staff    4096 Aug  1 18:53 .\r\ndrwxr-sr-x 5 root staff    4096 Aug  1 18:53 ..\r\n-rw-r--r-- 1 root staff     777 Sep 15  2017 __init__.py\r\ndrwxr-sr-x 2 root staff    4096 Aug  1 18:53 __pycache__\r\n-rwxr-xr-x 1 root staff 2049808 Aug  1 18:53 _gdal.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff  286560 Aug  1 18:53 _gdal_array.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff  217880 Aug  1 18:53 _gdalconst.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff  323840 Aug  1 18:53 _gnm.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff 2165936 Aug  1 18:53 _ogr.cpython-35m-x86_64-linux-gnu.so\r\n-rwxr-xr-x 1 root staff  932960 Aug  1 18:53 _osr.cpython-35m-x86_64-linux-gnu.so\r\n-rw-r--r-- 1 root staff  139138 Aug  1 18:52 gdal.py\r\n-rw-r--r-- 1 root staff   18867 Aug  1 18:52 gdal_array.py\r\n-rw-r--r-- 1 root staff   15338 Sep 15  2017 gdalconst.py\r\n-rw-r--r-- 1 root staff      51 Sep 15  2017 gdalnumeric.py\r\n-rw-r--r-- 1 root staff   10868 Aug  1 18:52 gnm.py\r\n-rw-r--r-- 1 root staff  252079 Aug  1 18:52 ogr.py\r\n-rw-r--r-- 1 root staff   46183 Sep 15  2017 osr.py\r\n```\r\n## Operating system\r\n\r\nDebian testing with linux kernel 4.16\r\n\r\n## GDAL version and provenance\r\n\r\nSource for GDAL 2.2.2\r\n"},"comment":{"url":"https://api.github.com/repos/OSGeo/gdal/issues/comments/409699400","html_url":"https://github.com/OSGeo/gdal/issues/822#issuecomment-409699400","issue_url":"https://api.github.com/repos/OSGeo/gdal/issues/822","id":409699400,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTY5OTQwMA==","user":{"login":"rouault","id":1192433,"node_id":"MDQ6VXNlcjExOTI0MzM=","avatar_url":"https://avatars2.githubusercontent.com/u/1192433?v=4","gravatar_id":"","url":"https://api.github.com/users/rouault","html_url":"https://github.com/rouault","followers_url":"https://api.github.com/users/rouault/followers","following_url":"https://api.github.com/users/rouault/following{/other_user}","gists_url":"https://api.github.com/users/rouault/gists{/gist_id}","starred_url":"https://api.github.com/users/rouault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rouault/subscriptions","organizations_url":"https://api.github.com/users/rouault/orgs","repos_url":"https://api.github.com/users/rouault/repos","events_url":"https://api.github.com/users/rouault/events{/privacy}","received_events_url":"https://api.github.com/users/rouault/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T19:49:38Z","updated_at":"2018-08-01T19:49:38Z","author_association":"MEMBER","body":"Where would you this to be documented ? This is documented in https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/README.txt"}}
{"actor":{"display_login":"rouault"}}