[PYTHON] [Super rudimentary] I installed GDAL on Anaconda

What is GDAL?

I wanted to read a mosaic image (Geotiff image) created with Metashape (formerly Photoscan) and process the image with Python. I tried to install a library called ** GDAL ** that can play with rasters and vectors. I had a hard time installing it and it took me a whole day today, so I'll write it down as a memorandum.

Reference: https://gdal.org/ 「GDAL documentation」

Installation error occurred

If you check with "GDAL Python installation" etc., it seems that you can install it by typing the following command with the anaconda prompt.

Reference: https://anaconda.org/conda-forge/gdal 「conda-forge/packages/gdal」

conda install -c conda-forge gdal

However, when I run this command, I get an error that stops at Solving Environment ...

Reference: https://teratail.com/questions/262267 "I want to install Gdal with Anaconda"

Error resolution

First of all, refer to the following site and ** GDAL version may be different. **I thought.

Reference: https://sites.google.com/view/takagilab/manual/program-%E7%92%B0%E5%A2%83%E3%81%AE%E6%A7%8B%E7%AF%89 "Construction of Program Environment, National Land Information Processing Engineering Laboratory"

You can check the version with the following command.

conda search gdal

image.png

As a result of version search, if it is conda install conda-forge gdal, it will be ** ver3.1.2 **, but ** ver3.0.2 ** is the latest? Appropriate? It turned out to be.

Specify the version and execute the command as follows.

conda install gdal==3.0.2

When I did this, the ** Solving Environment error ** was resolved, but this time I got a ** Conflict error **.

Reference: https://teratail.com/questions/262267 "I want to install Gdal with Anaconda"

I saw this Conflict error and it seems to last forever, so I decided to finish the installation and update the library version.

conda update --all

You have now updated all the libraries in conda to the latest version. Finally, install the versioned GDAL again.

conda install gdal==3.0.2

Installation successful! I'm not sure why updating the library can also install GDAL, but let's do it.

Operation check

image.png

It was imported firmly! It may not be a fundamental solution, but one case is settled ~ Using this library, we will load Geotiff + image processing while referring to the following articles.

https://qiita.com/HidKamiya/items/d5e69fda61703abe1a58 "Importing and exporting GeoTiff images with Python"

If you find it helpful, please ** LGTM **!

Recommended Posts

[Super rudimentary] I installed GDAL on Anaconda
I installed tensorRT on Ubuntu 18.04
I installed ROS on Ubuntu 18.04
[Linux] I installed CentOS on VirtualBox
I installed Linux on my Mac
I installed TensorFlow (GPU version) on Ubuntu
I installed Kivy on a Mac environment
I installed OpenCV-Python on my Raspberry Pi
Theano on Anaconda
I tried to install scrapy on Anaconda and couldn't
[Streamlit] I installed it
I can't install Anaconda!
Anaconda on Windows Terminal
Install Anaconda on Windows 10
I installed Ubuntu on a USB stick on a dual boot PC
I installed the automatic machine learning library auto-sklearn on centos7
I installed FreeCAD on Linux (Ubuntu) and created an icon