Resolved: Install GDAL on poetry project


I’m having trouble installing GDAL in a virtual environment managed by Poetry (working on an Ubuntu 18.04 distribution).
What I already found was:
  • this issue on poetry github’s repo; the pull request mentionned at the end seems to be stuck for now;
  • one unanswered question on SO related to the gdal version configuration on poetry.

For a “standard” installation, there are examples dealing with local paths using the “export” command.
So far, I haven’t found any working example on how to install GDAL in a poetry project.
Does anybody know how to handle this? (or if this is possible at all?)


A workaround is to :
  1. run the shell (and start the virtual environment configured by poetry);
  2. proceed to install gdal using pip (beeing aware of the versions and needed option as stated here for instance);
  3. exit the shell;
  4. proceed to mimic an new install through poetry (poetry add gdal==X.X.X);
  5. poetry should update the lock and toml files and conclude that no dependencies need to be installed or updated.

As I said this is a workaround (which needs to be referenced for now).
I hope a better solution will emerge and will keep this “solution” unaccepted for a while…

If you have better answer, please add a comment about this, thank you!


If you like this answer, you can give me a coffee by click here (view Ads)