Search code examples
installationvirtualenvgdallinux-mint

How to install gdal in virtuallenv?


Good morning, I have installed gdal in my computer hoping that it would work on my virtuallenv environment, but it is not working even though after the command sudo apt install gdal-bin python3-gdal I receive this message:

Lendo listas de pacotes... Pronto Construindo árvore de dependências
Lendo informação de estado... Pronto gdal-bin is already the newest version (2.4.2+dfsg-1~bionic0). python3-gdal is already the newest version (2.4.2+dfsg-1~bionic0). 0 pacotes atualizados, 0 pacotes novos instalados, 0 a serem removidos e 0 não atualizados.

According to this message, gdal should be installed, right? What am I doing wrong? How do I install it? By the way, I am using linux mint 19.0.


Solution

  • When you install python3-gdal you are actually installing it in your operating system's python, that means virtual enviroments can't see the library.

    You need to pip install gdal inside your enviroment so you can use it.

    If you have problems installing it you can try making a conda enviroment instead, and install all of your requirements through conda install.