Set interpreter when creating executable

18 views
Skip to first unread message

Adam Fackler

unread,
Mar 7, 2024, 4:42:45 AMMar 7
to PyInstaller

Hello all,

I built out a python script that utilizes a python library called ArcPy which is part of the ArcGIS Pro Desktop program. To run a script using this python library, I must run the script using the python interpreter found in the ArcGIS Pro folder structure, in this case the default being at "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe". I have been able to run it outside of the program as intended without issues by setting the interpreter to the above path, however I would like to push this script out as an executable. My clients are not tech savy firefighters and I want to make it as easy as humanly possible to "deploy" this tool on their computers and have this independent tool to do the needed data transformation. I will note that they WILL have ArcGIS Pro installed already on their computers (even if they don't know how to use it), so they will have the interpreter installed in the same default location.

I have been looking into using Pyinstaller to make the tool into an exe file so that they can click on the icon to open the program, get the GUI (all in tkinter) to input the data, and run the tool. The issue I have ran into is that Pyinstaller uses the default python interpreter and not the one I need it to, therefore the ArcPy library isn't brought in and the program explodes on the launch pad. So is there a way to tell Pyinstaller to "use this interpreter when running this python script"?

I know I can use a batch file to run the script using the interpreter, but that could be problematic with distributing the script out to them. Once again, the less files less buttons that need to be clicked, and the more graphicly enhanced (like an icon on the shortcut) the better, that's why I'm going the executable route.

Steve Barnes

unread,
Mar 7, 2024, 6:05:54 PMMar 7
to pyins...@googlegroups.com

Hi Adam,

 

Have you tried installing pyinstaller, and its dependencies, into the ArcGIS python and then using the ArcGIS python to build the executable. This should at least install the correct python interpreter into the exe bundle. You could then set the import path to the ArcGIS installation folder or folders. Might work!

 

Steve

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/ad961cca-9902-42d0-bcd0-a6447c25c855n%40googlegroups.com.

bwoodsend

unread,
Mar 7, 2024, 6:25:15 PMMar 7
to PyInstaller

If you expect to use a Python interpreter on the user’s machine then PyInstaller is completely the wrong tool. Assuming that Python interpreter is at a fixed location, you’re probably better off shipping your raw Python code along with a .bat file along the lines of:

cd /D "%~dp0" "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" your-code.py
Reply all
Reply to author
Forward
0 new messages