Resolve scripting: "python 3.6 not found"

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

fab@toxixox

  • Posts: 10
  • Joined: Mon Jun 29, 2020 12:09 pm
  • Real Name: fab faivre

Resolve scripting: "python 3.6 not found"

PostTue Jun 30, 2020 9:45 am

Hi gang,

I'm struggling with scripting Resolve.

I'm using Resolve 16.1 (studio version, fully registered). my IDE is PyCharm2020 on macOX Mojave, I'm regularly using various Python flavors, 3.6, 3.7, 3.8 and sometimes 2.7 (using PyCharm venv feature).
Resolve environment variables are OK and I can run some basic scripts using python 2.7

But it always fails when I try with Python 3.6.
within Resolve console, I also get an error : 'Python 3.6 not found'

Python 2.7 is now obsolete and some package are no longer maintained.
any clue on what is the issue with python 3 ?

thanks,
Fab
Offline

wfolta

  • Posts: 625
  • Joined: Fri May 15, 2020 1:12 pm
  • Real Name: Wayne Folta

Re: Resolve scripting: "python 3.6 not found"

PostTue Jun 30, 2020 3:38 pm

I would guess it's a path issue. If you go to a Terminal and type
Code: Select all
python --version
you'll probably see 3.5 or 3.7.

That is, you can just use the
Code: Select all
python
command which gets whatever is the default, or you can specify
Code: Select all
python3
or
Code: Select all
python3.7
. I'm on Catalina and from the Mac command line if I type
Code: Select all
python3.6
I get an error, but typing
Code: Select all
python3.7
works as does
Code: Select all
python
and
Code: Select all
python3
.

So maybe your system doesn't have Python 3.6 on it. Or maybe wherever you're running from -- you didn't specify if this occurred in PyCharm, Resolve, or the Mac command line -- doesn't know about version 3.6.
Resolve Studio 17 latest, Fusion Studio 17 latest, macOS Big Sur latest, MacBook Pro 2020 64GB RAM and Radeon Pro 5600M 8GB VRAM
Offline

fab@toxixox

  • Posts: 10
  • Joined: Mon Jun 29, 2020 12:09 pm
  • Real Name: fab faivre

Re: Resolve scripting: "python 3.6 not found"

PostThu Jul 02, 2020 12:27 pm

my 'default' python is 3.7.5 but I do have python 2.7, 3.6 and 3.7 installed and running.
Python 3.6 is fully functional within PyCharm (or the terminal)

I really don't know why Resolve can't see Python3.6 but found Python2.7
Maybe should I try reinstalling resolve AFTER installing Python ?


Code: Select all
iMac-de-admin:~ imac22$ python
python             python2.7-config   python3.6          python3.6m-config  python3.7m         pythonw2.7
python-config      python3            python3.6-config   python3.7          python3.7m-config 
python2.7          python3-config     python3.6m         python3.7-config   pythonw

iMac-de-admin:~ imac22$ python -V
Python 3.7.5

Offline
User avatar

TheBloke

  • Posts: 1905
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Location: UK
  • Real Name: Tom Jobbins

Re: Resolve scripting: "python 3.6 not found"

PostThu Jul 02, 2020 1:55 pm

I've seen at least one forum post indicating that Resolve might have a general issue finding Python 3.6 on macOS, at least since 16.2.

Here's a link to a We Suck Less forum post. It just says "What about the issue with 16.2 where Resolve can't find Python 3 on macOS?" with one person saying they couldn't fix it.

But it does indicate it might be a wider problem.

I have Python 2.7 and 3.7 installed and Resolve sees 2.7 but not 3.7 - though I suppose even if there wasn't a general issue, it probably still wouldn't accept 3.7 vs 3.6. I use Homebrew and it doesn't have a 3.6 option any more, and I've not yet tried a standalone download of 3.6.
Resolve Studio 17.4.3 and Fusion Studio 17.4.3 on macOS 11.6.1

Hackintosh:: X299, Intel i9-10980XE, 128GB DDR4, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Disk: 2TB NVMe + 4TB RAID0 NVMe; NAS: 36TB RAID6
BMD Speed Editor
Offline
User avatar

iddos-l

  • Posts: 799
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Resolve scripting: "python 3.6 not found"

PostThu Jul 02, 2020 4:30 pm

I also had some troubles configuring some python path on a Mac and my guess it was a result of multiple python versions some were installed with brew.

But did you check the fusion settings menu in scripting?

Image


Sent from my iPhone using Tapatalk
Offline

Jason Conrad

  • Posts: 797
  • Joined: Wed Aug 16, 2017 3:23 pm

Re: Resolve scripting: "python 3.6 not found"

PostThu Jul 02, 2020 6:03 pm

Somebody's gotta do it:

Image

Did you try starting Resolve from the command line, like I recommended in the other thread? Resolve inherits environment variables (such as $PYTHONPATH) when it launches. If you launch it from the Dock, it might not get them. And yeah, like above post, you have to make sure Resolve's looking for Py3 and not Py2. It will only use one or the other.

In the RESOLVE console, switch to the Py3 tab, and type:

Code: Select all
import sys
print (sys.version)


Now, do the same thing in the terminal built into your IDE. Is it the same version? I mean, is the Python that Resolve's finding the same one that your IDE is finding? If not, then you have a path problem. If so, then you still haven't ruled out a path problem.
-MacBook Pro (14,3) i7 2.9 GHz 16 GB, Intel 630, AMD 560 x1
-[DR 17.0 Beta9]
Offline
User avatar

Igor Riđanović

  • Posts: 1596
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: Resolve scripting: "python 3.6 not found"

PostThu Jul 02, 2020 10:17 pm

I still use 2.7 across all three OS-es and haven't had to deal with this.

However, why not just explicitly state which Python interpreter you want in your shebang line instead of depending on the Python ENV?
www.metafide.com - DaVinci Resolve™ Apps
Offline

Jason Conrad

  • Posts: 797
  • Joined: Wed Aug 16, 2017 3:23 pm

Re: Resolve scripting: "python 3.6 not found"

PostFri Jul 03, 2020 2:45 am

Igor Riđanović wrote:However, why not just explicitly state which Python interpreter you want in your shebang line instead of depending on the Python ENV?


True. I'm honestly not sure why my scripts would only run when I started resolve from the command line; it may have had less to do with finding the correct Python and more to do with finding RESOLVE_SCRIPT_LIB and RESOLVE_SCRIPT_API.

I just went back to check, and lo and behold, the old scripts I'd written were broken, which doesn't really surprise me because I've messed with a lot since then, including installing pyenv and pipenv. Anyway, I fixed them, and one of the things I did was to set "External Scripting Using" to "Local" in the General preferences. I probably switched that off at some point and forgot about it, but it was definitely part of the problem. So, fab@toxixox, you should check that.

Also, I noticed that the README.txt in the Scripting folder got updated in January 2020. IDK if that'll be new info to anyone here but me, but heads up anyway.

Screen Shot 2020-07-02 at 2052.png
Screen Shot 2020-07-02 at 2052.png (198.39 KiB) Viewed 7235 times
-MacBook Pro (14,3) i7 2.9 GHz 16 GB, Intel 630, AMD 560 x1
-[DR 17.0 Beta9]
Offline

fab@toxixox

  • Posts: 10
  • Joined: Mon Jun 29, 2020 12:09 pm
  • Real Name: fab faivre

Re: Resolve scripting:

PostTue Jul 07, 2020 1:45 pm

iddos-l wrote:But did you check the fusion settings menu in scripting?


Thanks iddo !
I did not checked the fusion settings. now it works with 3.6
that's a rather surprising location for an app-wide or project-wide setting.
And I don't open very often the fusion tab, I'd rather use fusion studio 'standalone' for compositing.

I'm very new to resolve scripting and I have a lot to learn,
Thank you all for your help !

Fab
Offline
User avatar

iddos-l

  • Posts: 799
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Resolve scripting: "python 3.6 not found"

PostTue Jul 07, 2020 2:21 pm

fab@toxixox wrote:that's a rather surprising location for an app-wide or project-wide setting.


I agree. I think the reason for that is that the resolve API is built on the fuscript API.


Sent from my iPhone using Tapatalk
Offline

Peter Müller

  • Posts: 7
  • Joined: Fri Jan 27, 2017 10:22 pm

Re: Resolve scripting: "python 3.6 not found"

PostFri Oct 22, 2021 3:51 pm

Am I understanding this correctly? I have to downgrade python to 3.6 otherwise it wont work?
Offline
User avatar

TheBloke

  • Posts: 1905
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Location: UK
  • Real Name: Tom Jobbins

Re: Resolve scripting: "python 3.6 not found"

PostFri Oct 22, 2021 4:05 pm

Peter Müller wrote:Am I understanding this correctly? I have to downgrade python to 3.6 otherwise it wont work?
Or install Python 3.6 separately. That's what I've done on macOS - I have Python 3.9 through Homebrew, and then I used the Python 3.6 installer from python.org, and in the installer I told it not to install the command line tools, only the libraries. That seems to co-exist OK with my main Python 3.

Not sure whether that works OK on other operating systems.
Resolve Studio 17.4.3 and Fusion Studio 17.4.3 on macOS 11.6.1

Hackintosh:: X299, Intel i9-10980XE, 128GB DDR4, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Disk: 2TB NVMe + 4TB RAID0 NVMe; NAS: 36TB RAID6
BMD Speed Editor
Offline

Peter Müller

  • Posts: 7
  • Joined: Fri Jan 27, 2017 10:22 pm

Re: Resolve scripting: "python 3.6 not found"

PostSat Oct 23, 2021 1:09 am

TheBloke wrote:
Peter Müller wrote:Am I understanding this correctly? I have to downgrade python to 3.6 otherwise it wont work?
Or install Python 3.6 separately. That's what I've done on macOS - I have Python 3.9 through Homebrew, and then I used the Python 3.6 installer from python.org, and in the installer I told it not to install the command line tools, only the libraries. That seems to co-exist OK with my main Python 3.

Not sure whether that works OK on other operating systems.


Oh right that should work, thanks.

Edit: If anyone else has this problem. The easiest solution (for me) was to call a lua file instead with 1 line os.execute("path/to/python.exe path/to/python/script.py")

It would be so much easier if it just had a field for cmd and it just ran that at the end. boom automatic compatibility with everything.
Offline

noyards

  • Posts: 2
  • Joined: Tue Jun 20, 2023 3:34 am
  • Real Name: David Landry

Re: Resolve scripting: "python 3.6 not found"

PostMon Jun 26, 2023 10:45 am

So almost 2 years later and still not sure if anything has been done to address this, but as I just started delving into an attempt at some Davinci scripting and ran into the 'aich ee double hockey sticks' of getting things to work enough to get started, here's what I (eventually) did (Windows 11, didn't try on Linux yet ... I wish they supported Linux better, a much faster platform, but DR loses some important functionality on Linux.)

It's not all that hard to do once you get past the confusion of 'python versions end of support' and claims of the Davinci APIs as to what python versions they 'require', so here's hopefully a concise (aka ignorance is bliss) way of getting this to work to the point you can start writing wonderful scripts.

BTW: do we have access to the transcription or captioning service through any of the APIs? Would be nice to make use of those services in Davinci ... better than paying for Amazon, Google, IBM, cloud services (some of them free but only for a limited number of hours per month.)

Anyway:

Code: Select all
* Installed DR Studio

Code: Select all
* Set up the preferences -> system -> general -> External scripting using 'local'


Code: Select all
* Installed python  3.10.11 (didn't try 3.11 or 3.12 as I read somewhere it doesn't work. But who really knows?)


Enviroment vars (user)
Code: Select all
PYTHONHOME = C:\Users\%USER%\AppData\Local\Programs\Python\Python310  (default install location for Python)


Code: Select all
RESOLVE_SCRIPT_API = %PROGRAMDATA%\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting


Code: Select all
RESOLVE_SCRIPT_LIB = C:\Program Files\Blackmagic Design\DaVinci Resolve\fusionscript.dll


Code: Select all
PYTHONPATH = %PYTHONPATH%;%RESOLVE_SCRIPT_API%\Modules\


Installing python modules for Davinci Resolve (not 100% sure this is needed once you set the environment variables, at least for the 'davinci_resolve_api' module, I think if you want to use 'pydavinci' module then you will need to use pip to install, but I don't think it hurts either way ... someone can try a test import without 'pip install' of the modules and report back?)

Code: Select all
pip install davinci_resolve_api --ignore-requires-version
pip install pydavinci --ignore-requires-version


Some quick test code to see if it's working:

(davinci_resolve_api) should create a new project in DR called 'Hello World"
Code: Select all
import DaVinciResolveScript as dvr_script
resolve = dvr_script.scriptapp("Resolve")
fusion = resolve.Fusion()
projectManager = resolve.GetProjectManager()
projectManager.CreateProject("Hello World")


(pydavinci) should print out the name of the 'Hello World' project, which o course will be 'Hello World'!
Code: Select all
resolve = davinci.Resolve()
project = resolve.project
project_manager = resolve.project_manager
media_pool = resolve.media_pool
media_storage = resolve.media_storage
print(project.name)

Return to DaVinci Resolve

Who is online

Users browsing this forum: gtempleman, kinggerald, Omar Mohammad, RikshaDriver, Shrinivas Ramani and 244 guests