简体   繁体   中英

How to install GDAL on Google Colab fast?

I can install GDAL in Google Colab by running the cell:

%%shell
sudo yum -y update
sudo yum-config-manager --enable epel
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
cd /tmp
curl -L http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz | tar zxf -
cd gdal-2.0.0/
./configure --prefix=/usr/local --without-python
make -j4
sudo make install
cd /usr/local
tar zcvf ~/gdal-2.0.0-amz1.tar.gz *

Using this answer.

However, it takes way more than half an hour for this cell to complete.

How could I install gdal faster?

My aim is to run the code in this answer . I have managed to do it, but after a Colab kernel restart, I have to wait again for the above cell to run.

GDAL is already pre-installed in Google Colab, so you only have to import it when starting a notebook

import gdal
!gdalinfo --version

GDAL 2.2.3, released 2017/11/20

It's not the most recent version of GDAL though, but for your sample code it should be sufficient.

By the way, for a full list of pre-installed python libraries in Google Colab, run:

!pip freeze

Using install conda package to google colab , this works:

%%shell
wget -c https://repo.anaconda.com/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
chmod +x Miniconda3-4.5.4-Linux-x86_64.sh
bash ./Miniconda3-4.5.4-Linux-x86_64.sh -b -f -p /usr/local
conda install -q -y --prefix /usr/local python=3.6 gdal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM