Bharath Ram
Bharath Ram

Reputation: 310

Unable to install GDAL with Anaconda + Pytorch (2020)

I want to install GDAL in an Anaconda environment along with Pytorch. I am using Ubuntu 18.04 LTS

I tried 3 versions of Anaconda (2019.03, 2019.07, 2020.11).

I followed the advice mentioned in previous questions - like ensuring that channel priority has been set to strict and using conda-forge channel explicitly (conda install gdal -c conda-forge).

I tried installing an earlier version of python (python 3.5, 3.6 etc) in the environment and then installing anaconda and then installing gdal.

Sometimes I also tried fresh Anaconda installations and didn't work.

In all of the permutations I tried, I had one of the following problems:

  1. Stuck at "Solving" (2+ hours)
  2. Some kind of version conflict
  3. Installation works but I am unable to import the gdal package in scripts. For eg I got this error in a couple of cases:

ImportError: libcharset.so.1: cannot open shared object file: No such file or directory"

I have been stuck with this for the past 3 days and will be really grateful if I could get some pointers on how to install Anaconda + GDAL + Pytorch.

Upvotes: 1

Views: 756

Answers (2)

Glottis4
Glottis4

Reputation: 1

You can install an old version:

conda create -n gdal_env python=3.6 gdal

Upvotes: 0

Bharath Ram
Bharath Ram

Reputation: 310

I found out from another post that the following commands might help:

sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal

Also, It turns out that setting channel_priority to strict resulted in version conflicts (conda config --set channel_priority false).

Upvotes: 1

Related Questions