No module named pyrevit

I’ve installed pyrevit 4.8.13 in Revit 2022 and wanted to test a script
but in Dynamo I get this error “No module named pyrevit”

.

Do I need to install or configure other things?
I searched for information but i can’t find it.
Can someone please help me?

Hi! Are you just getting started with pyRevit? I ask because I haven’t seen it be referenced in a Dynamo script before. Though maybe that’s in the works?

Here’s a similar thread: Import pyrevit in dynamo node - Dynamo

And here’s a great place to get started with pyRevit: Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.

Hello,

I don’t understand your answer & links and/or could not find the solution.
I’ve installed pyRevit with this page (https://pyrevitlabs.notion.site/Install-pyRevit-98ca4359920a42c3af5c12a7c99a196d?pvs=25) and got no errors. (see log-file)

2024-06-12 20:38:23,107 INFO [pyrevit.loader.sessioninfo] pyRevit version: 4.8.13.23182+2215 - </> with :growing_heart: in ['pdx', 'hio', 'rno', 'sea']
2024-06-12 20:38:23,596 INFO [pyrevit.loader.sessioninfo] pyRevit Rocket Mode enabled. :rocket:
2024-06-12 20:38:23,618 INFO [pyrevit.loader.sessioninfo] Host is Autodesk Revit 2022.1.5 build: 20230915_1530(x64) pid: 9052
2024-06-12 20:38:23,621 INFO [pyrevit.loader.sessioninfo] Running on: 2.7.7 (IronPython 2.7.7 (2.7.7.0) on .NET 4.0.30319.42000 (64-bit))
2024-06-12 20:38:23,627 INFO [pyrevit.loader.sessioninfo] User is: mrosendal
2024-06-12 20:38:23,630 INFO [pyrevit.loader.sessioninfo] Home Directory is: C:\Users\Martin\AppData\Roaming\pyRevit-Master
2024-06-12 20:38:23,632 INFO [pyrevit.loader.sessioninfo] Session uuid is: 22933cf4-c652-476d-b763-229ab4e8f478
2024-06-12 20:38:23,637 INFO [pyrevit.loader.sessioninfo] Runtime assembly is: pyRevit_2022_336044d12ce5e5e0_PyRevitLabs.PyRevit.Runtime
2024-06-12 20:38:23,668 INFO [pyrevit.loader.sessioninfo] Config file is (User): C:\Users\Martin\AppData\Roaming\pyRevit\pyRevit_config.ini
2024-06-12 20:38:25,255 INFO [pyrevit.loader.sessionmgr] Extension assembly created: JVZ_tools
2024-06-12 20:38:25,307 INFO [pyrevit.loader.sessionmgr] Extension assembly created: pyRevitCore
2024-06-12 20:38:25,579 INFO [pyrevit.loader.sessionmgr] Extension assembly created: pyRevitTools
2024-06-12 20:38:25,606 INFO [pyrevit.loader.sessionmgr] Running startup tasks for pyRevitCore
2024-06-12 20:38:31,719 INFO [pyrevit.loader.sessionmgr] UI created for extension: JVZ_tools
2024-06-12 20:38:33,790 INFO [pyrevit.loader.sessionmgr] UI created for extension: pyRevitCore
2024-06-12 20:38:36,062 INFO [pyrevit.loader.sessionmgr] UI created for extension: pyRevitTools
2024-06-12 20:38:36,393 INFO [pyrevit.loader.sessionmgr] Load time: 13.3149719238 seconds :thumbs_up:

The script is given bij Erik Frits - link: https://pyrevitlabs.notion.site/Effective-Output-43baf34d2ca247ada8e040bcb86613a2
A far as I know is the script complete with no missing ‘actions’.

I started Revit Dynamo and added the text in a python-node (IronPython 2)

from pyrevit import script

output = script.get_output()

# assuming element is an instance of DB.Element
print(output.linkify(element.Id))

Then a Run the script and got the error ‘No module named pyrevit’.
Why does it not work?

Sorry, I should have been more clear. I don’t think pyRevit runs in Dynamo. Please read the “getting started” info in the second link I posted. Also, try searching “getting started with pyRevit” on YouTube and then follow along with a tutorial.

you can’t do that.
pyrevit modules are not compatible or designed to be used in dynamo.
The way you could expect to make it work is the following, but it won’t work.

import sys
sys.path.append(r'C:\pyRevit\_pi\pyRevit\pyrevitlib')
from pyrevit import revit

doc = revit.doc

As mentioned by @scartmell the two beasts: Dynamo and pyRevit, live in paralell universes

If you want to try a dynamo python script with references to dynamo libraries → Dynamo
if /// … pyrevit libraries → pyRevit

If you want to create buttons for testing purposes, I suggest you activate the Bundle Creator Extension, follow the instructions of the button, then al+click to locate the script of the new button and try your code from there.

1 Like

for more info: [new builtin extension] Bundles Creator Extension

This video helped me getting started with creating my own toolbars.
It has a good step-by-step explination for the basic structure
Video

Thanks @scartmell @Jean-Marc @MelleH
:+1:

(Never realized that pyRevit does not work in Dynamo.)

1 Like