
Fast-Track pyRevit Systemβ’

Lesson 6
Move Virtual Environments

Written Summary
Move Your Virtual Environments Out of Your Projects π§Ή
Hey, welcome back! Right now you've got VS Code and Cursor configured for the Revit API and pyRevit β but there's one annoying leftover. Your virtual environment folders are sitting inside your extension folder.
And here's the problem: if you create more than one extension, you'd have to duplicate those venvs into every single project. That gets really weird, really fast.
So in this lesson, we'll move your virtual environments to one central location on your computer. Every project connects to the same venvs, and they stop cluttering your project structure. This step is optional, but trust me β it makes your setup much better long-term.
Step 1: Create a central folder for your venvs
Let's begin by picking a home for your virtual environments.
Open File Explorer and go anywhere you like β Documents is fine. Honestly, anywhere works.
Create a new folder and name it something like
venv_RevitAPIorvenv_pyRevit. The name doesn't matter at all β call it whatever makes sense to you.Open the folder and copy its full path from the address bar.
π‘ Tip: Don't overthink the name or the location. The only thing that matters is that you know where it is and you've got the path copied.
πΌοΈ [IMAGE: File Explorer showing a new empty folder named "venv_RevitAPI" inside Documents, with the full path selected in the address bar]
Step 2: Point Cursor to the new location
Now we need to tell our editors where to look for virtual environments. Let's start with Cursor.
Press
Ctrl+Shift+Pto open the command palette (or click the settings gear β whatever you prefer).Type "user settings" and select Preferences: Open User Settings (JSON).
Add a new line for the
python.venvPathsetting and paste your path:
If you already have other settings in there, don't forget the comma at the end of the previous line.
β οΈ Important: You'll probably see your path highlighted as an error at first. That's because backslashes have a special meaning in code and they break paths. The fix is simple: double every backslash (
\\instead of\), just like in the snippet above.
Save the file and you're done with Cursor.
πΌοΈ [IMAGE: Cursor's settings.json open with the "python.venvPath" line highlighted, showing the doubled backslashes in the path]
Step 3: Do exactly the same in VS Code
Now switch over to VS Code and repeat the exact same thing:
Ctrl+Shift+Pβ type "user settings" β Preferences: Open User Settings (JSON).You'll see it's exactly the same kind of file. In my case it was empty, so I just dropped the same
python.venvPathline in there.Save it.
That's it. Both editors now know where your virtual environments will live.
Step 4: Move the venv folders
Time to actually move the folders. Right now your venvs are still sitting inside your project.
In your editor's file explorer, find your virtual environment folders.
Right-click one of them and choose Reveal in File Explorer β there they are.
Cut and paste them into the new central folder you created in Step 1.
And just like that, our project is clean. All the virtual environments live in their own separate folder, away from your extension code.
πΌοΈ [IMAGE: File Explorer side-by-side β the project folder now clean, and the new venv_RevitAPI folder containing the moved virtual environment folders]
Step 5: The moment of truth β does it still work? β¨
Let's check that the editors can still find everything.
Open the interpreter selection again (
Ctrl+Shift+Pβ Python: Select Interpreter) and hit the refresh button.You should still see your virtual environments in the list. They might not be activated though β so go ahead and activate one of them.
Now open a Python file and test the autocomplete:
Start typing Filt, press Ctrl+Space, and you should see FilteredElementCollector pop right up. That's your sign that everything works.
Then do the same in Cursor: reselect the interpreter and run the same test. By the way, you'll probably notice the same thing I did β Cursor is much snappier with these suggestions. A little bit nicer experience overall.
πΌοΈ *[IMAGE: Editor showing "from Autodesk.Revit.DB import " with the Ctrl+Space autocomplete dropdown listing FilteredElementCollector]
π‘ Tip: From now on, every new Revit API project you create can point at these same venvs. No duplication, no clutter β set it up once and forget about it.
What's next
In the next lesson we're coming back to these code editors for a proper introduction β we'll configure them the way we want, style them the way we want, and add a few extra extensions. Let's go configure it further!