pyrevitlabs/pyRevit

[Bug]: Dynamo cannot execute python node if pyRevit is installed

GiuseppeDotto opened this issue · 17 comments

✈ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a similar issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

All the computer of the office where I work have issue with executing python dynamo nodes since pyRevit is installed on their computer.

error messages

These are the errors that popup from their Dynamo:
image
(this pops up as soon as the python node is called)

image
(this pops up is the user does some operation, for example, change the engine to IronPython2 and then revert to CPython)

further info

  • The issue only occurs if the engine used by Dynamo is CPython. With IronPython 2 everything works just fine.
  • the script inside of the screenshotted python node is OUT=IN

researches

I read a similar issue unfortunately closed without answers: Errors in Dynamo Python Script.

⌨ Error/Debug Message

attempt to read or write protected memory.

♻️ To Reproduce

just open Dynamo and create python node

⏲️ Expected behavior

CPython in Dynamo should work properly

🖥️ Hardware and Software Setup (please complete the following information)

Windows 11

$pyrevit env

==> Registered Clones (full git repos)
==> Registered Clones (deployed from archive/image)
pyOMA | Deploy: "core" | Branch: "master" | Version: "4.8.16" | Path: "C:\Users\gdotto\AppData\Roaming\pyOMA"
==> Attachments
pyOMA | Product: "24.2" | Engine: DEFAULT (2711) | Path: "C:\Users\gdotto\AppData\Roaming\pyOMA"
pyOMA | Product: "23.1.3" | Engine: DEFAULT (2711) | Path: "C:\Users\gdotto\AppData\Roaming\pyOMA"
pyOMA | Product: "Autodesk Revit 2021" | Engine: DEFAULT (2711) | Path: "C:\Users\gdotto\AppData\Roaming\pyOMA"
==> Installed Extensions
DDeT | Type: Unknown | Repo: "" | Installed: "\\office-server\DDeT.extension"
pyOMA | Type: Unknown | Repo: "" | Installed: "\\office-server\pyOMA.extension"
pyRevitCore | Type: UIExtension | Repo: "" | Installed: "\\office-server\pyRevitCore.extension"
pyRevitTools | Type: UIExtension | Repo: "" | Installed: "\\office-server\pyRevitTools.extension"
==> Default Extension Search Path
C:\Users\gdotto\AppData\Roaming\pyRevit\Extensions
==> Extension Search Paths
C:\Users\gdotto\OneDrive - Office for Metropolitan Architecture\Documents\GitHub\myPrivate
\\office-server
==> Extension Sources - Default
https://github.com/pyrevitlabs/pyRevit/raw/master/extensions/extensions.json
==> Extension Sources - Additional
==> Installed Revits
24.2 | Version: 24.2.0.63 | Build: 20231029_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2024\"
23.1.3 | Version: 23.1.30.97 | Build: 20230828_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2023\"
Autodesk Revit 2021 | Version: 21.1.21.45 | Build: 20201116_1100(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2021\"
==> Running Revit Instances
PID: 3860 | 24.2 | Version: 24.2.0.63 | Build: 20231029_1515(x64) | Language: 0 | Path: "C:\Program Files\Autodesk\Revit 2024"
==> User Environment
Microsoft Windows 10 [Version 10.0.22631]
Executing User: OMA\gdotto
Active User:
Admin Access: No
%APPDATA%: "C:\Users\gdotto\AppData\Roaming"
Latest Installed .Net Framework: 4.8
No .Net Target Packs are installed.
No .Ne-Core Target Packs are installed.
pyRevit CLI v4.8.16.24121+2117.23a0b8cbc4babdeb29a0611e159d017bbe9cbad5

Additional context

No response

Version of revit used? Version of Dynamo?

Just saying here, The issue can be on both sides Dynamo or pyRevit
DynamoTeam is actually a team, so maybe asking on their forum or GH might make more sense.

I personaly never had this type of issue

Revit: 2024.2.0
Dynamo: v.2.19.3

We already opened a ticket with Autodesk that didn't get solved. Particularly hard case because I can't replicate it anywhere else except for the office computers.

I will definitely open again a blog post on Dynamo forum, here is the previous one.
In the meantime, any hint from your side is very welcome.

Just tried it on my machine, not reproductible. Revit 2024, latest everything.

ipy2-cpy3.mp4

wild guess, any other python installed on computers.
dynamo has its own python engines, pyrevit too.
Maybe you have vanilla python installs for other purposes and they do not behave nicely?

Thanks a lot for the reply.
on my computer there is a vanilla python installed, however I would exclude this is the cause because other users without python installed have the same issue. Additionally, this issue started upon pyRevit installation.

As you saw, the post on the dynamo forum is quite old. I will take care to run another test uninstalling pyRevit and I will let you know if the issue really depends on pyRevit installation.

I'm having the same issue. CPython nodes work when deactivating pyRevit, but not when pyRevit is active.

on my computer there is a vanilla python installed, however I would exclude this is the cause because other users without python installed have the same issue. Additionally, this issue started upon pyRevit installation.

maybe they have rhino GH + rhino inside revit?

I confirm the behavior, python on Dynamo works if pyRevit is not installed.
The computers with the issue don't have rhino inside revit.

I confirm the behavior, python on Dynamo works if pyRevit is not installed. The computers with the issue don't have rhino inside revit.

Can you precisely provide the steps you performed? @GiuseppeDotto

I need to be able to reproduce.

correct, sorry @jmcouffin for lacking information. The test was performed in 2 different scenario:

scenario 1

  1. starting from a computer without pyRevit installed
  2. Dynamo check => python works ✅
  3. install pyRevit using CLI
  4. Dynamo check => python doesn't work ❌

scenario 2

  1. starting from a computer with pyRevit already installed
  2. Dynamo check => python doesn't work ❌
  3. uninstall pyRevit and delete all the clones
  4. Dynamo check => python works ✅
  5. install pyRevit using CLI
  6. Dynamo check => python doesn't work ❌

how do we install pyRevit

the way we deploy pyRevit to all the office computer is simple as:

  1. install the latest pyRevit CLI with Admin rights
  2. run a BAT script to clone pyRevit core, attach to all the Revit versions and add our custom paths. See below for reference

pyrevit clone ourCloneName core --dest=%appdata%\ourCloneName
pyrevit attach ourCloneName 2711 --installed
pyrevit extensions paths add "\our\path\to\the\folder\with\extensions"

I'll add that in my case it's enough to disable the pyRevit addin-file and restart Revit for the CPython nodes to start working, and vice versa. No need to uninstall/reinstall for new behavior to appear.

and Revit 2024 Dynamo 2.19.3 right?
other versions too?

Yes, is still Revit 2024.2 and Dynamo 2.18.3.
I just tried with Revit 2023.1 and Dynamo 2.16.2 and the issue is still occurring.
The doesn't take place with Revit 2021, where the python engine was still IronPython.

Has anyone found a workaround this? im having same problems but doesn't matter if i use Cpython or IronPython. And everything work as soon as i turn of pyrevit for the current revit version and restart revit with it turned of.

At first I thought it was do to a windows update my company rolled out as everything stopped working last week around that time. Might still be a combination? Could there have been something in the windows update that is giving me problems with python in dynamo and pyrevit?

Has anyone found a workaround this? im having same problems but doesn't matter if i use Cpython or IronPython. And everything work as soon as i turn of pyrevit for the current revit version and restart revit with it turned of.

At first I thought it was do to a windows update my company rolled out as everything stopped working last week around that time. Might still be a combination? Could there have been something in the windows update that is giving me problems with python in dynamo and pyrevit?

I do think this is a different matter.

The thing is, I cannot reproduce on my computer. I did play with dynamo up and down in revit 2024 with the latest WIP installers and no issu switching from cpython to ironpython back and forth.

I actually had the same thought than @Oliver2201 , just our updates happened 1 year ago, and since then I tried to replicate the issue, without success, on many other computers out of my organization.
@jmcouffin , if you know about any possible method to display a more informative error message, I am very happy to test it out.

Apart from the revit journal and dynamo logs, no idea.
Maybe asking to the dynamo team? The error happens in dynamo after all