Python GDAL Installation – How to Install Rasterio and GDAL API in Virtualenv on Windows 10

gdalinstallationpythonrasteriowindows 10

Following rasterio installation guidelines (rasterio.readthedocs.io)
I downloaded the relevant wheel files from Cristoph's list (link)
and installed them successfully on my Windows 10 system. Yet I am failing to install them in my virtualenv I created using Pycharm. For sanity check, I tested I was able to install numpy with pip in the virtualenv.

$ pip install -U pip
$ pip install GDAL-1.11.2-cp27-none-win32.whl
$ pip install rasterio-0.24.0-cp27-none-win32.whl

Unfrutently the red error message is not very informative. I have checked the bases I know such as, the system, and python are 64, pip is linked to python 3.8. This is all I can think of. Below you can see a few of my steps.

enter image description here

Update:
It seems that setting up the virtual environment manual from the Command Prompt and not Pycharm paved the way to a successful GDFAL and Rasteiro installation.

  1. Download virtualenv: C:\Users\t>pip install –user virtualenv
  2. Create virtualenv: C:\Users\t\Downloads>python -m venv
  3. Activate: C:\Users\t\Downloads>test_virtual_env_i\env\Scripts\activate

Then installing the respective downloaded GDAL wheel worked out of the box:

  1. (env) C:\Users\t\Downloads>pip install GDAL-3.0.2-cp38-cp38-
    win_amd64.whl
  2. (env) C:\Users\esaiet\Downloads>pip install rasterio-1.1.1-cp38-cp38-win_amd64.whl

Before I can conclude the issue is resolved, the qyestion is what is the difference between the my virtualenv installation and Pycharm.

Best Answer

I followed these steps and it worked find for me.

  • OS: Microsoft Windows x64
  1. Install python 3.5
  2. Add x:\<python_directory>, x:\<python_directory>\Lib and x:\<python_directory>\Scripts to system environment variable PATH.
  3. Upgrade the pip by running code python -m pip install --upgrade pip
  4. Install compatible version of GDAL by python -m pip install GDAL-3.0.4-cp35-cp35m-win_amd64.whl
  5. Install compatible version of Rasterio by python -m pip install rasterio-1.1.2-cp35-cp35m-win_amd64.whl

Following images proves the result:

enter image description here

And when I ran the last command (number 5) following results were shown:

enter image description here