I know there are many questions about this issue , hence, I couldn't find working solution yet so I'm trying here as well...
I have cloned a git repo which one of the requiremed package there is to have gdal installed. The computer is Linux and I use vs code to connect reomtly.
at the beginning I naively tried to install gdal with:
pip install gdal
and then with :
pip install osgeo
and also :
pip install GDAL==3.3.2
but all gave me the same error:
note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure
× Encountered error while trying to install package. ╰─> GDAL
note: This is an issue with the package mentioned above, not pip.
Things I have tried to do :
- follow this instructions , everything run well beside the part of the actual gdal installing which failed (Same error)
- install Fiona before - didn't change anything (pip install fiona)
- install pygdal - got the same error
- use pip freeze to copy another environment that I have that has gdal working there (I don't remember how I made it work last time) - same error, doesn't install it.... 5.Trying to install osgeo_utils ...same results...same error
Weird thing is that when I print this on cmd:
>>>ogrinfo --version
GDAL 3.3.2, released 2021/09/01
which seems like it is already installed, so maybe I can find where is it lcoated?
in the end of the day I would like to be able to import gdal, this way:
from osgeo_utils import gdal_pansharpen
I know I can try maybe with conda but I am afraid it will create other bugs with the environment as it is cloned.
so, my goal is to be able to import gdal and use it in my notebooks :)
Edit: more info:
Linux distribution and version: Zorin OS 16.1
Created environment:
~/git/demo$ python3.10 -m venv .venv
...
~/git/demo$ pip install -r requirments.txt
I hope this information is good enough. Just to add more info - I found out the gdal is installed somewhere on the same OS but I couldn't use pip to install it and use it in python.