Archicad Python API
About automating tasks in Archicad using the Python API.
SOLVED!

Archicad – Python – and Anaconda/Miniconda

runxel
Legend
Archicad has a problem when you have Python installed via Anaconda/Miniconda.
It either reports error R6034 (which can be mitigated by renaming all "msvcr90.dll" files inside the *conda folder).
But afterwards, if you open the Python palette the search for an interpreter just stucks inside a loop, where it never finds one. What is even more funnier, because GS themself proposes to use Anaconda/Miniconda.

You can stop the ongoing search loop, but then the Python palette is worthless, since you can't use it. Not so dramatic either, since you can do everything in VSCode as well.
BUT if you try to close Archicad in the end: you can't! The files closes, but AC refuses to go away and has to be sniped from orbit with the taskmanager...

So, please either fix this, GS, or just let the user help and point to the right interpreter...
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
runxel wrote:
Seems like the registry key only helps, if AC already found an interpreter, otherwise it doesn't work – which is quite useless in a case like mine...
Thank you for pointing out this issue!
You're absolutely right. I added this to our bug database: DEF-1519 (PythonUI/CustomLocation registry key only helps if AC already found an interpreter)

Until we fix the bug, as a workaround I would suggest you to add at least one python interpreter path to the PATH environment variable. That way Archicad will be able to find an interpreter and you will be able to open Python Options to select the interpreter.

View solution in original post

9 REPLIES 9
Viktor Kovacs
Graphisoft
Graphisoft
Although not a in a very user friendly way, but there is an option to set a custom location for your Python interpreter.

You can set the PythonUI/CustomLocation (String Value) registy key to the location of the interpreter.

Hope it helps,
Viktor
runxel
Legend
Viktor wrote:
You can set the PythonUI/CustomLocation (String Value) registy key to the location of the interpreter.
Hey Viktor, thank you for this info!
Where exactly in registry shall this key be, tho? The regedit search didn't found it, and looking by hand it's definitely not in Computer\HKEY_CURRENT_USER\Software\GRAPHISOFT\

So what I did instead was making a new key named "PythonUI" inside of Computer\HKEY_CURRENT_USER\Software\GRAPHISOFT\ARCHICAD\ARCHICAD 24.0.0 GER R1\
And then a new string value named "CustomLocation" set to the path to the custom Python interpreter.

This however didn't work out, either....
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Minh Nguyen
Graphisoft Alumni
Graphisoft Alumni
Hi,

Thank you very much for reporting the issue, and I am very sorry about the experience!

I tried to replicate the issue, by removing any trace of Python in my computer. After that, I download the latest Anaconda installer (2020.7) from their website and install it. Upon checking in Archicad, the interpreter is loaded correctly, there was no constant loop or error message appear (as can be seen in the attached screenshot below).

Could you let me know at which point did you encounter the error R6034?

Thank you very much!

Best regards,
Minh

Minh Nguyen
Technical Support Engineer
GRAPHISOFT

runxel
Legend
Hi Minh!
Thank you so much for replying!

The R6034 error shouldn't actually matter. It is a well known problem, because there can be only one msvcr90.dll loaded at any time. Also the renaming helped with that and you don't need that dll anyway.

Since you had a nice and clean new install I think your default environment is already Python 3.x.
I did a lot of work on IronPython previously and I have an older install of Miniconda so my default environment is actually 2.7 – and Py3 is in a virtual env (because that's the reason to use Miniconda: the ability to have more than one Python version installed).
So it seems Archicad has problems finding the virtual env interpreter then, huh?

Do you know about the registry item? Maybe if you or Viktor can shine a bit more light on it I'm still able to use my current install.
It is also a bit dumb with *conda, because while you can install as many Python versions as you want, it doesn't support changing the default Python....
So yeah, maybe I still need to reinstall everything. Or maybe Pipenv is a good alternative....?
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Minh Nguyen
Graphisoft Alumni
Graphisoft Alumni
Hi,

Thank you very much for the clarification! I never have more than one Python environment installed, therefore I never encountered such errors. Let me ask for some help from the development team with this issue. As soon as I have an answer, I will get back to you!

Best regards,
Minh

Minh Nguyen
Technical Support Engineer
GRAPHISOFT

Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
runxel wrote:
Viktor wrote:
You can set the PythonUI/CustomLocation (String Value) registy key to the location of the interpreter.
So what I did instead was making a new key named "PythonUI" inside of Computer\HKEY_CURRENT_USER\Software\GRAPHISOFT\ARCHICAD\ARCHICAD 24.0.0 GER R1\
And then a new string value named "CustomLocation" set to the path to the custom Python interpreter.

This however didn't work out, either....
Hi,

The registry key should be created and set manually, so you did well.
I attached a screenshot from my registry and the python versions found by the Python Palette. In the Python Options dialog you can activate the desired python environment.
runxel
Legend
Tibor wrote:
The registry key should be created and set manually, so you did well.

Hi Tibor, thank you so much for clarification!
However I now see that there is a difference between what I want to achieve and what this technique can offer.
See, if one opens the Python palette, AC will try to find an Archicad interpreter but fails to do so. That's when I thought the registry key could help. But after you click on "abort the search" the palette opens like this (see attached image).
Seems like the registry key only helps, if AC already found an interpreter, otherwise it doesn't work – which is quite useless in a case like mine...
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
runxel wrote:
Seems like the registry key only helps, if AC already found an interpreter, otherwise it doesn't work – which is quite useless in a case like mine...
Thank you for pointing out this issue!
You're absolutely right. I added this to our bug database: DEF-1519 (PythonUI/CustomLocation registry key only helps if AC already found an interpreter)

Until we fix the bug, as a workaround I would suggest you to add at least one python interpreter path to the PATH environment variable. That way Archicad will be able to find an interpreter and you will be able to open Python Options to select the interpreter.
runxel
Legend
Tibor wrote:
Thank you for pointing out this issue!
You're absolutely right. I added this to our bug database
Great! Thanks again, Tibor! 🙂
For now I just use my Python from VSCode directly, which works like a charm.
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»