How do I set a specific version of pyRevit as an argument in the CLI when cloning? I see that I can use a custom clone via specific github URL or archive file, but I don’t know how to get the URL for a specific pyRevit version.
The reason why I’m asking is that we have remotely deployed pyRevit using the CLI tool to a large number of users over the last year or so. The CLI tool reports that attachments are correct, but for some users, pyRevit fails to load (“Can not find cpython engines” error). One thing I want to isolate as a variable is the version to see if its a pyRevit bug or something its wrong with the computer itself. So far, the working versions seem to be 4.8.13 and 4.8.14 and the non-working versions seem to be 4.8.16. I’d like to try to install an older version on one of the non-working computers to see if that solves the issue.
Are you using a pyrevit deployment like basepublic? Or a straight clone? You can download an older non-CLI installer for older version, but not really good solution. 4.8.16 should work after some troubleshooting.
this command should work for at least Revit 2020-2024 using “pyRevit_CLI_4.8.16.24121_admin_signed.exe”
If that still doesn’t work then try manually deleting any %appdata%\pyrevit" folders and uninstall any pyrevit versions shown in add/remove programs and try again.
Our current setup script was based on the method documented in pyRevit for Teams , so I’m assuming straight clone. Truncated install script below.
I’m avoiding installing using the non-CLI .exe because I want everyone to have more or less the same installation (as well as admin permission issues I won’t get into here), and I also need to be able to update our custom extensions remotely.
$pyrevitroot = "C:\pyRevit"
$ourclonename = "main"
$pyrevitcoredest = $(Join-Path $pyrevitroot $ourclonename)
$pyrevitexts = $(Join-Path $pyrevitroot "Extensions")
# ...
function Clone-PyRevit() {
# make sure paths exist and are clean
Confirm-Path $pyrevitroot
Confirm-Path $pyrevitexts
# close all open Revits first
Write-Output "Closing All Revits..."
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit revits killall
# forget all previous pyRevit clones if any
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit clones forget $ourclonename > $null
# clone pyRevit now
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit clone $ourclonename --dest=$pyrevitcoredest
}
function Attach-PyRevit() {
Write-Output "Attaching pyRevit to Installed Revits..."
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit attach $ourclonename 2711 --installed --allusers
Write-Output "Attachment Complete."
}
# ...
Write-Output "Starting Installation Process..."
Clone-PyRevit
Install-Extensions
Configure-PyRevit
Attach-PyRevit
Write-Output "Installation Complete!"
I tried yesterday to manually clone the repo through GitBash, then checkout the commit version from the release of 4.8.13, then setting --source=\path\to\local_repo, but that failed for some reason.
use the basepublic deployment instead of clone using my command above. But delete all %appdata% and %programdata% pyrevit folders and remove all pyrevits from add/remove programs first.
Looks like you haven’t tried that yet because you are calling the CLI from an absolute path in the script instead of installing as part of the installation of pyrevit ribbon.
I install .net framework and CLI everytime script runs, since it takes just a couple seconds. was going to add a check for installed dependencies, but not even worth the trouble.
Can you please post the entire commands you use and the output error, if any? I did add a clone of a local folder a few weeks ago and it woked fine.
You’re right that the clone of another version version isn’t implemented, since it would need to checkout the tag on the main branch (git checkout tags/<version> -b master), and there’s no option for that in the pyrevit cli.
I suppose the main use case of pyrevit clone was to be able to quickly switch to a development version and test out new features, so the only thing needed was to switch to another branch and not back in time.
I don’t think its very obvious in the documentation that the deployments are the recommended way to install pyRevit. Its kind of mentioned in passing, after you follow a link to a different page, but then the powershell example does a straight clone instead
At my company, somebody else had already created the installation CLI scripts and ribbon when I took it over, but I’ve been maintaining our ribbon for a couple years now and been through the documentation frontways and back and had no idea the deployments were even a thing.
Only reason I found out was when I had 200+ deployments using clones with the 277 engine, IT decided to install Revit 2024 + reinstallation of our ribbon company wide with out mentioning it to me on Monday morning after the DLLs had been removed the Friday prior. So there I was standing with my **** in my hand…
Maybe we could add some bold font in there or something?
OK, so I never figured out how to install an older version with CLI, but following @jpitts original comment seemed to resolve the underlying issues. Here is the final version of our installation script with those changes.
I don’t know why this version works when the older didn’t but, hey, installation works so that’s good enough for me.
Thanks!
# pyRevit installation based on https://pyrevitlabs.notion.site/pyRevit-For-Teams-ddc6c312d6f6488691eed2ec7704fd97
# note this script relies on having already run the pyRevit CLI installer script on the target machine
# D. Howard, Feb/March 2023
# dhoward@ballinger.com https://github.com/bger-dhoward
# updated June 2023 based on feedback from https://discourse.pyrevitlabs.io/t/clone-older-version-of-pyrevit-using-cli/3156/2
# for whatever reason, Ninja PowerShell scripts don't seem to be recognizing the pyRevit directory in the PATH variable, so...
# we're just going to make a variable out of it!
$pyrevit = C:\'Program Files'\'pyRevit CLI'\bin\pyrevit
# never mind, doesn't work with this powershell environment... will use full path instead
#######################
### setup functions ###
#######################
# confirms target path exists and is empty. removes existing if found
function Confirm-Path ([string] $targetpath) {
Write-Output "Confirming $($targetpath)"
If (Test-Path $targetpath) {
Remove-Item -Path $targetpath -Recurse -Force
}
New-Item -ItemType Directory -Force -Path $targetpath > $null
}
# clone pyRevit
function Clone-PyRevit() {
# make sure paths exist and are clean
Confirm-Path $pyrevitroot
Confirm-Path $pyrevitexts
# close all open Revits first
Write-Output "Closing All Revits..."
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit revits killall
# forget all previous pyRevit clones if any
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit clones forget $ballingerclonename > $null
# clone pyRevit now
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit clone $ballingerclonename basepublic --dest=$pyrevitcoredest --debug ## UPDATED HERE BASED ON FORUM FEEDBACK
}
# install extensions
function Install-Extensions() {
# make sure paths exist and are clean
Confirm-Path $pyrevitexts
# install extensions now
Write-Output "Cloning Extensions..."
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit extend ui $baltools_name $baltools_path --branch='main' --dest=$pyrevitexts --token=$baltools_token
}
# config pyrevit
function Configure-PyRevit() {
Write-Output "Configuring pyRevit..."
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit configs logs none
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit configs checkupdates disable
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit configs autoupdate disable
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit configs rocketmode enable
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit configs filelogging disable
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit configs loadbeta disable
#Write-Output "Seeding pyRevit configs..."
#$pyrevit configs seed
#Write-Output "Seeding Complete."
}
function Attach-PyRevit() {
Write-Output "Attaching pyRevit to Installed Revits..."
C:\'Program Files'\'pyRevit CLI'\bin\pyrevit attach $ballingerclonename default --installed --allusers --debug ## UPDATED HERE BASED ON FORUM FEEDBACK
Write-Output "Attachment Complete."
}
#######################
### setup variables ###
#######################
$pyrevitroot = "C:\pyRevit"
$ballingerclonename = "main"
$pyrevitcoredest = $(Join-Path $pyrevitroot $ballingerclonename)
$pyrevitexts = $(Join-Path $pyrevitroot "Extensions")
$baltools_name = "BAL-TOOLS"
$baltools_path = "REDACTED GITHUB REPO ADDRESS"
# fine-grained access token for BAL-TOOLS github repo
# expires Dec 31, 2024 - updated on 2024-01-22
$baltools_token = "REDACTED GITHUB ACCESS TOKEN"
#######################
### start process ###
#######################
Write-Output "Starting Installation Process..."
Clone-PyRevit
Install-Extensions
Configure-PyRevit
Attach-PyRevit
Write-Output "Installation Complete!"