X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



157 Rate this article:
No rating

Configuring IDL Python Bridge with venv Virtual Python environment on Windows

If you have difficulties to configure IDL Python bridge with a virtual venv Python environment, it may be due to the fact that such virtual environments are missing almost all of the required Libs, site-packages, and DLLs. They all come from the parent environment. The IDL Python bridge does not know that it is a virtual environment and assumes that everything is located within the Python venv directory.

Notes: if you are using Anaconda Virtual Environments, this article is not relevant. It is only relevant for Venv Virtual Environments.

 

Below is a link about how to create and activate a venv virtual Python environment on Windows:

https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html

 

Various errors may be encountered while using the IDL Python bridge with such venv virtual Python environment on Windows:

 

  • Error about missing the numpy library when calling IDL from Python
(ModuleNotFoundError: No module named 'numpy'

 

  • Error about missing the Python bridge DLL when calling Python from IDL
% PYTHON::RUN: DLM_LOAD: Error loading sharable executable.
    Symbol: IDL_Load, File = C:\Program Files\NV5\IDL90\bin\bin.x86_64\idl_python311.dll
The specified module could not be found.

 

  • Error about Python configuration failure when calling Python from IDL
% Loaded DLM: PYTHON311.
% PYTHON_INIT: C:\Users\Public\Python_venv\env3112.
% PYTHON::RUN: PYTHON_INIT: Py_InitializeFromConfig failed..

 

Those errors are usually related to missing paths in the PATH and/or PYTHONPATH environment variables. The following steps show how to fix such errors.

 

In the example below

- the virtual venv Python environment is located in C:\_BERANGERE\vmpython

- the parent Python environment is located in C:\Users\berangere\AppData\Local\Programs\Python\Python311\

 

In case you do not know where the parent Python directory resides, you can use the commands below to determine its location from the Python venv environment

C:\_BERANGERE\venvpython>.\venv\Scripts\activate
(venv) C:\_BERANGERE\venvpython>python
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.base_prefix
'C:\\Users\\berangere\\AppData\\Local\\Programs\\Python\\Python311'

 

You now need to add the below directories to your PATH environment variable

  • Path to the Scripts directory of your Python venv environment: C:\_BERANGERE\vmpython\venv\Scripts;
  • Paths to these two parent Python installation directories:
    C:\Users\berangere\AppData\Local\Programs\Python\Python311\Scripts\;
    C:\Users\berangere\AppData\Local\Programs\Python\Python311\;
  • Path to the IDL directory
    C:\Program Files\NV5\IDL91\bin\bin.x86_64\;
     

You also need to define the PYTHONPATH environment variable including the following parent Python installation directories:

C:\Users\berangere\AppData\Local\Programs\Python\Python311\DLLs;
C:\Users\berangere\AppData\Local\Programs\Python\Python311\Lib;
C:\Users\berangere\AppData\Local\Programs\Python\Python311\Lib\site-packages;

 

Afterwards you can use the Python-to-IDL and the IDL-to-Python bridges with your virtual venv Python environment

  • Activate your venv virtual Python environment in the terminal session
C:\_BERANGERE\venvpython>.\venv\Scripts\activate
  • Launch Python and add the IDL bridges path to system PATH
(venv) C:\_BERANGERE\venvpython>python
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> sys.path.append('C:\\Program files\\nv5\\idl91\\lib\\bridges')
  • Launch IDL into Python
>>> from idlpy import *
IDL 9.1.0 (Win32 x86_64 m64).
(c) 2024, NV5 Geospatial Solutions, Inc.
  • Test the Python to IDL bridge
>>> p=IDL.plot(TEST=1)
% Loaded DLM: SVG.
% Loaded DLM: LAPACK.
>>> exit()
  • Launch IDL:
(venv) C:\_BERANGERE\venvpython>idl
IDL 9.1.0 (Win32 x86_64 m64).
(c) 2024, NV5 Geospatial Solutions, Inc.
Licensed for use by: NV5 Geospatial Internal Use Only
License:xxxxxx-internal
  • Test the IDL to Python bridge, bridging to your virtual Python venv environment
IDL> >>>2+2
% Loaded DLM: PYTHON311.
% PYTHON_INIT: C:\_BERANGERE\venvpython\venv.
4
IDL> >>>
>>> import numpy as np
>>> arr=np.random.rand(100)
>>> print(arr.mean())
0.4763549858054967
>>>

 



---------------------------------------------

created by BC on 2/19/2025

reviewed by BC (US) on 2/27/2025
 

Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »