I experienced the following challenges while releasing the python package on a different machine. While distribution, I have used the subprocess module.
Thank you Jean for helping me out! I appreciate this a lot.
I have a pyrevit button that calls a Python program which has Tkinter and other Cpython packages that cannot be run inside pyrevit
Hence I used subprocess run python and file path and calling that in helper function located outside .extension folder.
The first screenshot shows an output window of Python IDLE which gets installed from default Python installation. This screenshot is from one of my teammates computer
The second screenshot is from other teammates computer demonstrating the error while distributing the pyrevit button.
I am using the subprocess module and calling Python inside. Does that mean everyones machine must have python installed?
Please let me know if this information is suffice?
Are those installed and at the same location on every machine?
Yes
Python 3.12 (or whatever version you need) must be installed the same way as or your computer or you must resolve paths to python and the modules you are calling within your script.
Python and Cpython libraries are not installed on the same location on every machine.
Is there a way a specific Python version with necessary CPython packages like TKinter ,etc can be distributed along with the pyrevit extension as well where publishing it on everyone’s machine ( 15 colleagues will be using this tool)
Follow this guide to put all the needed files inside the .lib folder.
Tha guide uses conda, but you can do the same with a vanilla python distribution and a venv.
This is our current favorite as well. We tried having the venv on a network drive but it was too slow. So now we push the venv to users’ c:/ProgramData/pyRevit/venv via InnoSetup and a Scheduled Task. We use a bunch of modules including openai and langchain which adds 30+ modules total. It has been working really well.
edit: I’ll add that we kept with python 38 to be in line with pyRevit. I’m not positive this is necessary but it just keeps our dev environment a bit simpler.