cannot install osgeo

EdBerth
EdBerth Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 15 ✭✭
edited July 16 in Setup & Configuration

Hello community,

I can't install the python library osgeo in a code env.

× Encountered error while trying to install package.
╰─> osgeo
note: This is an issue with the package mentioned above, not pip.

Do you have any solutions ?

Best Answer

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,090 Neuron
    edited July 17 Answer ✓

    Well the error is pretty clear to me:

    Exception: In order to be able to run `from osgeo import gdal`,
    You were probably trying to install `gdal` by running `pip install osgeo`
    
    Instead, you should either `pip install gdal` or replace `osgeo` with `gdal` in your requirements.

    And it's also clearly stated in the package in PyPi:

    https://pypi.org/project/osgeo/#description

    Here is the actual package you want to install:

    https://pypi.org/project/GDAL/

    Review the package notes before installing it.

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,090 Neuron

    Please post the full error from the code environment log file.

  • EdBerth
    EdBerth Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 15 ✭✭
    edited July 17

    Hello,

    trying to rebuild env

          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 34, in <module>
            File "/tmp/pip-install-8xx6_643/osgeo_ded985180de24ba49434cf194363a88e/setup.py", line 32, in <module>
              setup(
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
              return distutils.core.setup(**attrs)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
              return run_commands(dist)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
              dist.run_commands()
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
              self.run_command(cmd)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/dist.py", line 1208, in run_command
              super().run_command(command)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
              cmd_obj.run()
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 360, in run
              self.run_command("install")
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
              self.distribution.run_command(command)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/dist.py", line 1208, in run_command
              super().run_command(command)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
              cmd_obj.run()
            File "/tmp/pip-install-8xx6_643/osgeo_ded985180de24ba49434cf194363a88e/setup.py", line 27, in run
              raise Exception(error_msg)
          Exception: In order to be able to run `from osgeo import gdal`,
          You were probably trying to install `gdal` by running `pip install osgeo`.
      Building wheel for osgeo (setup.py): finished with status 'error'
      Running setup.py clean for osgeo
    Failed to build osgeo
    Installing collected packages: wcwidth, simplegeneric, pytz, ptyprocess, pickleshare, osgeo, ipython_genutils, backcall, zope.interface, urllib3, traitlets, tornado, six, pyzmq, pyparsing, pyodbc, pygments, prompt-toolkit, pillow, pexpect, parso, packaging, oauthlib, numpy, kiwisolver, idna, fonttools, decorator, cycler, click, charset-normalizer, certifi, attrs, affine, snuggs, shapely, requests, python-dateutil, pyproj, matplotlib-inline, jupyter_core, jedi, datetime, contourpy, cligj, click-plugins, requests_oauthlib, rasterio, pandas, matplotlib, jupyter_client, ipython, fiona, ipykernel, geopandas
          Instead, you should either `pip install gdal` or replace `osgeo` with `gdal` in your requirements.
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
      ERROR: Failed building wheel for osgeo
      error: subprocess-exited-with-error
      
      × Running setup.py install for osgeo did not run successfully.
      │ exit code: 1
      ╰─> [25 lines of output]
          running install
          /data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
            warnings.warn(
          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 34, in <module>
            File "/tmp/pip-install-8xx6_643/osgeo_ded985180de24ba49434cf194363a88e/setup.py", line 32, in <module>
              setup(
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
              return distutils.core.setup(**attrs)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
              return run_commands(dist)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
              dist.run_commands()
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
              self.run_command(cmd)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/dist.py", line 1208, in run_command
              super().run_command(command)
            File "/data/dataiku/datadir/code-envs/python/py310_SentinelHub/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
              cmd_obj.run()
            File "/tmp/pip-install-8xx6_643/osgeo_ded985180de24ba49434cf194363a88e/setup.py", line 27, in run
              raise Exception(error_msg)
      Running setup.py install for osgeo: started
          Exception: In order to be able to run `from osgeo import gdal`,
          You were probably trying to install `gdal` by running `pip install osgeo`.
          Instead, you should either `pip install gdal` or replace `osgeo` with `gdal` in your requirements.
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: legacy-install-failure
    × Encountered error while trying to install package.
    ╰─> osgeo
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for output from the failure.
    [notice] A new release of pip available: 22.3.1 -> 24.0
    [notice] To update, run: /data/dataiku/datadir/code-envs/python/py310_SentinelHub/bin/python -m pip install --upgrade pip
      Running setup.py install for osgeo: finished with status 'error'
  • EdBerth
    EdBerth Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 15 ✭✭

    THANKS.
    I have other projects outside of Dataiku where I work with osgeo and in which "import osgeo" works fine, I wasn't suspicious.

Setup Info
    Tags
      Help me…