I have two conda environments: One based on python 2.7 and the other based on python 3.5. I want to create a codebase (frequently used functions) that works with both Python versions. There is one module that gives me problems and that is GDAL. GDAL is somewhat more complex because it has a dependency on a C library and is not pure pythonic.

apt-get install python-gdal -y
apt-get install python3-gdal -y

I tried many ways to install GDAL for python and the command line tools and I was wondering which channel is preferred: Conda-forge or the default conda channel? Where to find more information about this and how to make this decision? Mixing channels is not a good idea as far as I understand since GDAL uses a C library.

In addition to the conda install statements I have also seen:

apt-get install python-gdal -y
apt-get install python3-gdal -y
apt-get install gdal-bin 

Why are these required?

  • You're asking two questions here conda-forge or conda (default) channels for gdal install and apt installs. Please ask only one question per question. (Note that apt and apt-get is only for systemwide installs on Debian based linux OS's, not for conda envs). – user2856 Apr 9 '18 at 0:25

Treat conda envs as disposable. If you have trouble installing gdal into an existing environment, ignore it and create a new env conda create -n mynew env gdal other packages etc...

Never install stuff into your default ("root") environment. Don't have 2 root conda installs (miniconda2 and miniconda3), just install one and use it to create separate python 2.7 and 3x environments.

Mixing conda-forge and default channels is ok, as long as conda can solve the environment requirements. You might get into trouble if you start mixing personal channels that could contain stuff built with a different compiler, but don't worry about it if you stick with conda-forge and default.

The decision to use conda-forge depends on whether you require a package (or package version) not available in the default (conda) channel. I use conda-forge as I need rasterio >= 1.0a12 and conda only has rasterio 0.3.6

| improve this answer | |

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