4

I'm trying to import GDAL to run in 64-bit spyder and am getting the following error: import gdal Traceback (most recent call last):

  File "<ipython-input-1-27bf4694dd2b>", line 1, in <module>
    import gdal

  File "C:\Users\Rdebbout\AppData\Local\Continuum\Anaconda\Lib\site-packages\gdal.py", line 2, in <module>
    from osgeo.gdal import deprecation_warn

  File "C:\Users\Rdebbout\AppData\Local\Continuum\Anaconda\Lib\site-packages\osgeo\__init__.py", line 32, in <module>
    _gdal = swig_import_helper()

  File "C:\Users\Rdebbout\AppData\Local\Continuum\Anaconda\Lib\site-packages\osgeo\__init__.py", line 28, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)

 ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

I downloaded gdal as a wheel file from gohlke's website and then used pip install GDAL-1.11.3-cp27-none-win_amd64.whl.

6
  • 1
    Have you tried conda install gdal instead of an external build? anaconda.org/osgeo/gdal
    – user2856
    Commented Oct 14, 2015 at 0:47
  • yes I have with no luck. Do you need to download GDAL core files before doing the conda install?
    – rickD
    Commented Oct 14, 2015 at 21:21
  • No, it should be self contained. Do you have the MS Visual C++ runtimes installed (VC++ 2008 and perhaps VC++ 2010)?
    – user2856
    Commented Oct 14, 2015 at 21:27
  • Yes. 2008 and 2010
    – rickD
    Commented Oct 14, 2015 at 23:29
  • Do you have a 32bit GDAL installed? Note: please edit your question with this and previous info so it's all in one place.
    – user2856
    Commented Oct 14, 2015 at 23:33

2 Answers 2

3

There is a problem with version 2.0. You can try installing a previous version conda install gdal=1.11.2 For more information see: https://github.com/ContinuumIO/anaconda-issues/issues/400

0

I had the same problem in installing GDAL package on Conda. Finally this strange solution worked.

I installed a fresh anaconda. I created a new environment on the default python. Finally, I installed only shapely, psycopg2, and fiona in one command with no version specification and then I saw that GDAL is also installed and it is working!!!

The Installed versions are:

   Python    = 3.12.3

1- Shapely   = 2.0.1
2- Fiona     = 1.9.5
3- Psycopg2  = 2.9.9
4- GDAL      = 3.6.2

I am able to import GDAL and work with it even if I did not mention it in the command of conda to install it!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.