1

I would like to have on the same machine all my GIS software installations. Both ArcGIS Desktop and QGIS come with their own Python installations but I want another independent Python where I can play around and update its packages without messing up ArcGIS and QGIS Pythons. I understand that just installing the independent Python into another folder should suffice.

However, as I use GDAL installed from GISinternals files and pip to update packages, what should I be careful with in order to install GDAL Python bindings and pointing to the correct Python version?

I think I recall, when installing Python bindings it asks for the instance of Python you are to install it for, is that correct?

Also, when using pip for installing packages, how can I make sure I am using the independent Python's pip instead of, for example, ArcGIS's?

  • This reminded me of the old joke, "How do porcupines mate?" "Very carefully." I've never had a problem creating multiple Python installations, but I didn't spend any time adding packages. This is basically an exercise in PATH and other environment variable management, so you're at the edge of the slippery slope between GIS SE and Stack Overflow. – Vince May 4 '19 at 15:00
  • Can't you execute the full path to the pip.exe you want? In Python 2.7, pip is normally located here, C:\Python27\Scripts\pip.exe – klewis May 4 '19 at 17:00
  • For what it's worth, I use ArcGIS, QGIS, and multiple python environments on the same machine seamlessly - I use Anaconda, and I create conda environments using gdal with specific versions of python and it runs smoothly. I can also call arcpy from these environments if I copy my ArcGIS .pth file to my conda environment Lib/site-packages directory – mweber May 6 '19 at 23:42
2

Anaconda seems to be a great and popular resource for managing different environments. If you are still using python 2.7 for Arc, you can create a python 2.7 environment and a python 3.7 environment.

I recommend installing Anaconda in the root folder. For example, C:/Miniconda2. Don't make Anaconda your system python.

enter image description here

Once you have anaconda installed, you need to create your environments. Navigate to Anaconda Prompt (Similiar to Command Prompt, but allows usage of anaconda commands).

conda create --name Gdal python=3.7 spyder

Next, we have to install Gdal

conda install -c conda-forge gdal

Gdal now is installed and has it's own environment. You can install other packages into the Gdal environment, but pay attention to other packages being downgraded.

Now, if you have ArcGIS installed on your computer, here is the way you can link anaconda to ArcGIS's existing environment. Update the question mark with your current ArcGIS version.

conda create --name arcpy10-? python=2.7 spyder

In file explorer, navigate to C:\Python27\ArcGIS10.?\Lib\site-packages\Desktop10.?.pth. Copy the file to C:\Miniconda3\envs\arcpy10-?\Lib\site-packages. Create a text file named 'arcgis-python-site-packages.pth' within the C:\Miniconda3\envs\arcpy10-5\Lib\site-packages directory. Within the text file, input the string, C:\Python27\ArcGIS10.5\Lib\site-packages.

When using Anaconda, NEVER USE PIP! Also, Anaconda manage's it's own GDAL so no need to install it with GISInternals.

https://docs.conda.io/en/latest/miniconda.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.