Building PySAM Executable With PyInstaller

  • Jack
  • Topic Author
More
13 Aug 2021 19:41 #9931 by Jack
I am currently building an executable with PyInstaller that builds a python file that utilizes PySAM. The python script is very simple and takes a location and runs Marion snow loss estimates for it based on the closes station with weather data. I am running into an issue with the way PySAM behaves in the built executable. Despite specifying all of PySAM, PySAM-stub and add the defaults folder to the build, when I run the line 
d = PySAM.Pvsamv1.default("FlatPlatePVNone")
Python cannot find the default file for the config. The documentation is not clear on how pvsamv1 uses the default files or how it finds them, so I am unsure what I have been doing wrong for it to be unable to find these files.

I am building this as an executable instead of just a python script so team members without a python distribution on their computer can still run the file. Any help would be greatly appreciated. I've included my .spec file (as a .txt) for the PyInstaller build in case that is helpful 

Please Log in or Create an account to join the conversation.

  • Paul Gilman
More
16 Aug 2021 21:54 #9951 by Paul Gilman
Replied by Paul Gilman on topic Building PySAM Executable With PyInstaller
Hi Jack,

I am not familiar with PyInstaller. The defaults are stored as pandas DataFrames: You can find them in the Python installation folder at Lib/site-packages/PySAM/defaults (that path is from my Windows installation, it may be slightly different for different operating systems).

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • dguittet
More
19 Aug 2021 15:31 - 19 Aug 2021 15:33 #9970 by dguittet
Replied by dguittet on topic Building PySAM Executable With PyInstaller
Hi Jack,

The defaults files' relative path to the PySAM modules is fixed and that is how they are found. In my environment, the site-packages folder contains the NREL_PySAM library which contains PySAM -> defaults. All the .so files are the PySAM modules, such as Pvsamv1. The defaults folder should be at the same level as the Pvsamv1.cpython-38-<OS>.<ext> and the rest of the files, especially libSAM_api and libssc.

I would check the organization of the files produced by the pyinstaller.

Best,
Darice
Attachments:
Last edit: 19 Aug 2021 15:33 by dguittet.

Please Log in or Create an account to join the conversation.

Moderators: Paul Gilman
Powered by Kunena Forum