-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pyinstaller in combination with ESRI's arcpy #576
Comments
Original date: 2012/07/17 There is no knwon issue with arcpy. I do not even know arcpy. To give you a more complete answer, please give more detailed information about arcpy and the problem. If it's some "licensing mechanism in arcpy", I suppose to ask ESR. PyInstaller does not implement any license management. |
Original date: 2014/04/21 I'm closing this ticket since there has been no feedback for 21 months now. |
Original date: 2014/06/09 arcpy is a licensed library from ESRI that is actually bindings to a C++ library. Arcpy is not actually installed in the python path, and in order for it to work, an installation of ArcGIS installs it's own version of python with a '.pth' file pointing to the arcpy folder within the ArcGIS installation folder. You can make ArcPy work with another python installation by including a .pth file in the python directory (usually something like C:\Python27) which points to the arcpy installation (in something like C:\ProgramFiles\ArcGIS). So, a workaround to get pyinstaller to work with ArcPy is to exclude the arcpy module from the build (using the excludes statement in the spec file) and include the .pth file in the distribution folder (or perhaps in the executable?). I haven't tested this, but it should make the python environment setup by the bootloader include the arcpy directory in it's path, so arcpy can be imported. Of course, this relies on the client machine having ArcGIS installed in the standard location. Basically, you are looking for a way to make an executable made with pyinstaller include modules which are not in the installation folder. |
I just wanted to update this issue with some additional information. I came across @JamesRamm's There were still a couple of issues such as needing to add a hidden Here's the runtime hook code: # ./hooks/rthooks/pyi_rth_arcpy.py
import sys
# Add arcpy's directories to sys.path
from archook import get_arcpy
get_arcpy()
# Additional tweaks to placate arcpy
from types import ModuleType
sys.path.append('./site-packages') # Add a dummy site-packages folder to sys.path
sys.modules['numpy'] = ModuleType('numpy') # Add a fake numpy module to sys.modules And here's the relevant part of my # ...
hiddenimports=['glob'],
runtime_hooks=['./hooks/rthooks/pyi_rth_arcpy.py'],
excludes=['arcpy'],
# ... Interested to see if anyone else has come up with another/better solution to using arcpy with a frozen executable. An official hook would be welcomed BTW! One question I have is how to both exclude Using |
Thanks, @blah238 and @JamesRamm for the workaround. It helped me bundle my python script with Arcpy functionalities into a .exe. I'm now able to run the exe on the same computer with ArcGIS installed, but I wanted to run it on a computer where ArcGIS is not installed (Basically Linux using Wine emulator). Can you help me? |
That would entail copying the ArcPy libs in whole or partially, in either case that breaks the ArcPy EULA and is not advisable. |
Hi @channabasavagola I believe you can install the 'ArcGIS API For Python' on any system (https://developers.arcgis.com/python/), but its functionality, specifically the 'arcpy' functionality will be limited without required licenses. Unless you have a specific need for reading ArcGIS proprietary data files then my recommendations on linux (or any OS for that matter) is always to use the open source OSGeo software. This includes QGis, but for developing your own scripts/software, GDAL alone will often provide all you need |
Original date: 2012/07/17
Original reporter: herberga AND noord DASH holland DOT nl
I run into problems with pyinstaller and arcpy. I think the licensing mechanism in arcpy causes the problems.
Are you aware of this issue and is there a solution to this problem?
I want to ditribute the application using pyQt en arcpy. The user's who use it have a valid arcview license for ArcGIS.
The text was updated successfully, but these errors were encountered: