Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Version of python used by lua in lightroom

Community Beginner ,
Jun 24, 2025 Jun 24, 2025

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

TOPICS
macOS , SDK
430
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 24, 2025 Jun 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

...
Translate
Explorer ,
Jun 24, 2025 Jun 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 25, 2025 Jun 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 24, 2025 Jun 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:

johnrellis_0-1750790469127.png

 

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)

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 25, 2025 Jun 25, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 27, 2025 Jun 27, 2025

Hello John

 

Very good it works perfectly when i give the path of python 3.10.
Here is my code to call python script with a parameter (path of a lightroom image):

 

local scriptPath = '"/Volumes/....../myscript.py" '
local catalog = LrApplication:activeCatalog()
local image = catalog:getTargetPhoto() -- photo en cours
local path = '"'..image.path..'"'

local py = '"/Library/Frameworks/Python.framework/Versions/3.10/bin/python3" '
local command = py .. scriptPath .. path

 

local process = io.popen(command, 'r')
local output = process:read('*a')
local exitCode = process:close()

 

It is necessary to be VERY VERY careful with the blanks between parameters of the command, i lost much time for that.

 

Here is the result in lightroom

 

import sys OK

import os OK

python 3.10.1 (v3.10.1:2cd268a3a9, Dec  6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.0.29.3)]

 

Thank you so much for help

 

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 11, 2025 Dec 11, 2025
LATEST

Use PyInstaller to create either a Windows exe or an MacOs app version of your Python scripts.

This way you are independant of any Python version installed the computer of yourself or any client.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines