Open gtzortzo opened 8 months ago
Hi @gtzortzo,
Could you please share your connect2server.spec
file?
Also it seems that pyinstaller
is not in the list of installed packages you provided for your environment. Are you sure it is the right environment?
Hi @gtzortzo, Writing here the conclusion for this issue following our call:
pip install pyinstaller
in the current venv.ansys/dpf/gatebin
binaries in the executable, resulting in runtime errors for your script. This was solved by modifying the .spec
file used when running pyinstaller connect2server.spec
, specifically the Analysis
object declaration, to include arguments hidden_imports=['ansys/dpf/gatebin']
and binaries=[(r'path_to_gatebin_DPFCLient_API.dll', 'ansys/dpf/gatebin'), (r'path_to_gatebin_Ans.Dpf.GrpcCLient.dll', 'ansys/dpf/gatebin')]
. This is required due to ansys-dpf-gatebin
being now included in ansys-dpf-core
but pyinstaller is not picking it up.Conclusion:
To build an executable with pyinstaller for pydpf-core, one needs to use a .spec
file and modify it as explained above to include the gatebin
binaries.
I'll raise a documentation issue to document the fix, but I'll also look into making pyinstaller discover the binaries automatically.
Before submitting the issue
Description of the bug
A simple python script which starts a local dpf server works smoothly in a Python IDE. However, when an executable is created out of this script using the pyinstaller package for instance, the following error appears:
When I exclude ansys.dpf.core package from the bundled executable, I get this error:
What I'm doing wrong? The end goal of the user is to create an executable to distribute to 3rd parties which would be able to launch PyDPF from its local PyDPF installation (not the one bundled in the executable). Is there a way to achieve this?
Thank you, George
Steps To Reproduce
1st error:
2nd error:
connect2server.txt
Which Operating System causes the issue?
Windows
Which DPF/Ansys version are you using?
Ansys 2023 R2
Which Python version causes the issue?
3.11
Installed packages
Package Version
ansys-dpf-core 0.10.1 cachetools 5.3.2 certifi 2023.11.17 charset-normalizer 3.3.2 colorama 0.4.6 contourpy 1.2.0 cycler 0.12.1 fonttools 4.47.2 google-api-core 2.15.0 google-api-python-client 2.115.0 google-auth 2.27.0 google-auth-httplib2 0.2.0 googleapis-common-protos 1.62.0 grpcio 1.60.0 httplib2 0.22.0 idna 3.6 imageio 2.28.0 imageio-ffmpeg 0.4.9 importlib-metadata 7.0.1 kiwisolver 1.4.5 matplotlib 3.8.2 numpy 1.26.3 packaging 23.2 pillow 10.2.0 pip 22.3.1 platformdirs 4.1.0 pooch 1.8.0 protobuf 4.25.2 psutil 5.9.8 pyasn1 0.5.1 pyasn1-modules 0.3.0 pyparsing 3.1.1 python-dateutil 2.8.2 pyvista 0.43.2 requests 2.31.0 rsa 4.9 scooby 0.9.2 setuptools 65.5.0 six 1.16.0 tqdm 4.66.1 uritemplate 4.1.1 urllib3 2.1.0 vtk 9.3.0 zipp 3.17.0