Issue
gdal is correctly installed on my global system's python 3.5 packages. But now I'm trying to pip install gdal on my python 3.6 virtual environment, but I receive multiple errors.
After activating the virtual environment, I've tried the following:
pip install pygdal
orpip3 install pygdal
Error received:ERROR: Failed building wheel for pygdal
Tried following this guide, but the commands stated there are outdated
I've also tried this solution and this which failed
Installed older gdal versions but also didn't work.
Tried
pip3 install GDAL==$(gdal-config --version)
and I get the same error
I use
Ubuntu 16.04 and pip 21.0.1. Venv was created using virtualenv --python=/usr/bin/python3.6 my_venv
Solution
I've finally fixed the problem, and these are the steps I followed:
I uninstalled wheel from my venv
Then I pip installed gdal on the venv to check what error would appear
A wall of error text appeared, in which somewhere I noticed the
'x86_64-linux-gnu-gcc' failed with exit status 1
I typed
sudo apt-get install python3.6-dev
to install missing packages, as the solution suggests hereThen I ran
pip install GDAL=<version that appears on ogrinfo --version>
and it worked
Answered By - John Answer Checked By - David Goodson (WPSolving Volunteer)