Skip to main content
Known Participant
June 24, 2025
Answered

Version of python used by lua in lightroom

  • June 24, 2025
  • 2 replies
  • 392 views

Hello,

 

i wrote a python script (version3.10 in my computer) which is called by a lua script in lightroom 14.4. The python version called by the lua script is version 3.9.6 of python, that i dont find in my computer

my command in my lua file is: 

local command = 'python3 ' ..'"'.. scriptPath .. '" ' ..'"'.. path .. '"'

 

The question is where is the version of python that lua lightroom uses ? Is it possible to change it ?

 

Thank you very much

Correct answer johnrellis

[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]

 

LR doesn't include "python3". The built-in Aperture/iPhoto Importer Plugin runs Python scripts, but it relies on the standard version of Python included with Mac OS.  (The plugin doesn't run on Windows.)

 

LrTasks.execute() runs its scripts in an environment with a default PATH variable that's not the PATH set by your login shell. So you're getting the default Mac OS "python3" (3.9.6 on Mac OS 15).

 

You can see this explicitly by placing the following Lua script "which-python.lua" in the Lightroom Scripts folder:

~/Library/Application Support/Adobe/Lightroom/Scripts

restarting LR, and then doing the menu command Scripts > which-python.  It will show this:

 

So your LrTasks.execute() will have to explicitly set a different PATH or refer to the absolute path of the desired "python3".

 

which-python.lua:

local LrDialogs = import "LrDialogs"
local LrFileUtils = import "LrFileUtils"
local LrPathUtils = import "LrPathUtils"
local LrTasks = import "LrTasks"

LrTasks.startAsyncTask (function ()
    local out = LrPathUtils.standardizePath ("~/Desktop/out.txt")
    local cmd = "(/bin/echo -n 'which: '; which -a python3; " ..  
        "/bin/echo -n 'Version: '; python3 -V; " .. 
        "/bin/echo 'PATH: ' $PATH) >" .. out
    LrTasks.execute (cmd)
    LrDialogs.message ("Output", LrFileUtils.readFile (out))
    end)

 

 

2 replies

johnrellis
johnrellisCorrect answer
Legend
June 24, 2025

[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]

 

LR doesn't include "python3". The built-in Aperture/iPhoto Importer Plugin runs Python scripts, but it relies on the standard version of Python included with Mac OS.  (The plugin doesn't run on Windows.)

 

LrTasks.execute() runs its scripts in an environment with a default PATH variable that's not the PATH set by your login shell. So you're getting the default Mac OS "python3" (3.9.6 on Mac OS 15).

 

You can see this explicitly by placing the following Lua script "which-python.lua" in the Lightroom Scripts folder:

~/Library/Application Support/Adobe/Lightroom/Scripts

restarting LR, and then doing the menu command Scripts > which-python.  It will show this:

 

So your LrTasks.execute() will have to explicitly set a different PATH or refer to the absolute path of the desired "python3".

 

which-python.lua:

local LrDialogs = import "LrDialogs"
local LrFileUtils = import "LrFileUtils"
local LrPathUtils = import "LrPathUtils"
local LrTasks = import "LrTasks"

LrTasks.startAsyncTask (function ()
    local out = LrPathUtils.standardizePath ("~/Desktop/out.txt")
    local cmd = "(/bin/echo -n 'which: '; which -a python3; " ..  
        "/bin/echo -n 'Version: '; python3 -V; " .. 
        "/bin/echo 'PATH: ' $PATH) >" .. out
    LrTasks.execute (cmd)
    LrDialogs.message ("Output", LrFileUtils.readFile (out))
    end)

 

 

Known Participant
June 25, 2025

Thank you i will try it and i say you what happens.

Known Participant
June 24, 2025

What do you get when you run these commands (in bold) from Terminal?
$ which python3
/opt/homebrew/bin/python3
$  $(which python3) -V
Python 3.13.5

Known Participant
June 25, 2025

These are the responses:

marcbarbier@iMac-de-Marc ~ % which python3

/Library/Frameworks/Python.framework/Versions/3.10/bin/python3

marcbarbier@iMac-de-Marc ~ % $(which python3) -V

Python 3.10.1