Pyrevit Subprocess module error while distribution to other machine

Hello,
Developers,

I experienced the following challenges while releasing the python package on a different machine. While distribution, I have used the subprocess module.

The error looks like below:

Could anyone suggest that other machines where the package is being distributed need to have Python installed as well to run this program??

Context please.

In you first window which looks like a 3.12 python shell, you are calling python?
That kind of an Inc3ption?

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)

Please let me know.

well.there is always a way.
I’d rather go a webapp path like making a streamlit app.
Less overhead.
What is your script doing exactly?

You can create a pyrevit library extension.

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.

1 Like

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.

1 Like

It’s almost OT, but I’d love to hear about this process of making a streamlit app and calling it from pyRevit. Is it akin to a REST call?