X
5388

Using the IDL-Python Bridge on Windows

The purpose of this help article is to have a collection of the different versions of Python that have been tested on Windows and the environment variables that have been set. The basic environment variables that have been set can be found here. 


It is also worth mentioning that there are some situations that have a higher chance of causing problems and crashed for the IDL Python bridge than others. In general, be cautious when having print statements in batch files (they can sometimes cause crashes) and the best way to call IDL from Python is when using Python in a Command Prompt window.

NOTE: You may need to change the installation paths depending upon where you installed Python and IDL. Additionally, not all variations of Python may work with IDL. This is because Python is open source and there is a chance that each Python package is built differently and there may be other built in differences for each distribution that cause incompatibilities with IDL. These examples are meant as a general guideline to get the IDL-Python bridge to work and it may require some troubleshooting before it successfully works.


Anaconda with Python 2.7

The environment variables that you need to set will be different depending upon how you install Anaconda. If you select the option to make Anaconda the default Python Distribution, then you will not need to set PYTHONHOME and your variables should be:

set PATH=C:\Anaconda;C:\Program Files\Exelis\IDL85\bin\bin.x86_64;%PATH%
set PYTHONPATH=C:\Program Files\Exelis\IDL85\bin\bin.x86_64;C:\Program Files\Exelis\IDL85\lib\bridges

Otherwise, if you did not select to make Anaconda the default Python installation you will need to set PYTHONHOME and your variables should be:

set PATH=C:\Anaconda;C:\Program Files\Exelis\IDL85\bin\bin.x86_64;%PATH%
set PYTHONPATH=C:\Program Files\Exelis\IDL85\bin\bin.x86_64;C:\Program Files\Exelis\IDL85\lib\bridges
set PYTHONHOME=C:\Anaconda



WinPython

For WinPython it was necessary to set the PYTHONHOME variable in order to get this to work as expected. Here are the variables that were set:

set PATH=C:\Users\Norm3596\WinPython\python-3.4.3.amd64;C:\Program Files\Exelis\IDL85\bin\bin.x86_64;%PATH%
set PYTHONPATH=C:\Program Files\Exelis\IDL85\bin\bin.x86_64;C:\Program Files\Exelis\IDL85\lib\bridges



Python 2.7 from ArcGIS (ArcPy)

Using  the IDL-Python bridge with Python 2.7 from ArcGIS works as expected, but there is an important difference in the environment variables that needs to be mentioned. Python from ArcGIS is a 32-bit application so you will need to use 32-bit IDL instead of 64 bit IDL for the bridge. This means that PYTHONPATH and PATH will need to point to the bin.x86 directory instead of bin.x86_64 for the IDL installation.  Additionally, it is possible that you may need to set PYTHONHOME to get the bridge to work. Here are the environment variables that were used for testing:

set PATH=C:\Users\Norm3596\python_installs\ArcPy\ArcGIS10.3;C:\Program Files\Exelis\IDL85\bin\bin.x86;%PATH%
set PYTHONPATH=C:\Program Files\Exelis\IDL85\bin\bin.x86;C:\Program Files\Exelis\IDL85\lib\bridges
set PYTHONHOME=C:\Users\Norm3596\python_installs\ArcPy\ArcGIS10.3

 

Pycharm Community Edition

One thing to note about Pycharm is that it does not come with a python installation like some other Python IDE's. Instead, Pycharm uses a Python installation from your machine that gets installed separately which means that you will need to set the environment for the Python installation that you decide to use. There is a good chance that you should be able to call IDL from Python without a problem, but there was one issue when using Pycharm. The Pycharm Python command line crashed when an IDL startup file was specified. This may be because the startup file displayed information when IDL would be started, but it is still unclear. If you want to use Pycharm make sure that you disable any startup files for IDL and you should not run into any problems.


Reviewed by DS 11/7/2016