Registry / data / nrel-pysam

nrel-pysam

JSON →
library7.1.1.post1pypypi✓ verified 84d ago

PySAM is a Python wrapper for the National Renewable Energy Laboratory's System Advisor Model (SAM), enabling simulation of renewable energy systems including PV, wind, battery storage, and CSP. Version 7.1.1.post1 supports SAM version 2024.11.21. Release cadence follows SAM releases (2-3 per year).

pip install nrel-pysam
INSTALL
IMPORT
SIG · NREL-PYSAM
N
nrel-pysam
datapythonv7.1.1.post1
Install
5.6s avg
Import
18ms
Disk
235MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v7.1.1.post1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.6s · import 0.018s · 237MB
235MB installed
● package 235MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PySSC
import PySAM.PySSC as PySSC
import PySSC
PySSC is a submodule of PySAM
Pvwattsv8
import PySAM.Pvwattsv8 as Pvwattsv8
import Pvwattsv8
Modules are nested under PySAM package
Battery
from PySAM.Battery import Battery
from PySAM.Battery import Battery as BatteryModel
Class name matches module name, collision avoided via direct import
CustomGeneration
from PySAM.CustomGeneration import CustomGeneration
import PySAM.CustomGeneration
Must import the class, not just the module

Run a default PVWatts simulation and print annual energy. Replace 'file.csv' with a solar resource file.

import PySAM.Pvwattsv8 as pv # Create default system system_model = pv.default('FlatPlatePV-NoSDK') # Modify parameters system_model.SolarResource.solar_resource_file = 'file.csv' system_model.execute() print(system_model.Outputs.annual_energy)
Debug
Known issues
gotchaPySAM modules have two layers: the DataSet (inputs) and the Outputs (results). Direct attribute assignment on the module object after `execute()` may override inputs instead of reading outputs; always access outputs via `module.Outputs`.
fix
Use `system_model.Outputs.annual_energy` not `system_model.annual_energy`.
affects: all
gotchaCalling `module.value('param')` or `module.assign('param', val)` is legacy and fails in v7+. Use property access: `module.SolarResource.solar_resource_file = 'path'`.
fix
Use dot notation for inputs: `module.SolarResource.solar_resource_file = 'path'`.
affects: >=7.0
gotchaThe `default()` method does not automatically call `execute()`. Many users forget to call `execute()` and then inspect outputs that are still None.
fix
Call `system_model.execute()` after setting inputs.
affects: all
breakingIn PySAM v7, the `pvwattsv7` module was removed. Code using `import PySAM.pvwattsv7 as pv7` will fail.
fix
Migrate to `Pvwattsv8` (note capital P). See migration guide in docs.
affects: >=7.0
deprecatedThe `Singleowner` and `Thirdpartyownership` financial models are deprecated in favor of the unified `Cashloan` model.
fix
Use `Cashloan` instead: `from PySAM.Cashloan import Cashloan`.
affects: >=7.1
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'PySAM'
Package not installed or installed as 'nrel-pysam' but import as 'PySAM' (case-sensitive).
fix
Run `pip install nrel-pysam` and ensure import uses capital 'P' and 'S': `import PySAM`.
AttributeError: 'PySSC' object has no attribute 'execute'
Direct call to PySSC object instead of a module (e.g., Pvwattsv8) that has execute().
fix
Create a module via default() or new() and call execute on that module, not on PySSC.
TypeError: 'NoneType' object is not subscriptable
Accessing outputs before calling execute().
fix
Ensure `system_model.execute()` is called before accessing `system_model.Outputs`.
KeyError: 'solar_resource_file'
Trying to assign to an input using legacy string-based method like `module.value('solar_resource_file', 'path')` which is no longer supported.
fix
Use proper attribute access: `module.SolarResource.solar_resource_file = 'path'`.
Upgrade
Version history
7.1.1.post1latest on PyPI · released Apr 28, 2026
Audit
Dependencies
numpyrequiredNumerical arrays for input/output
pandasrequiredDataFrames for multi-year outputs
NsightoptionalGPU acceleration for certain modules (e.g., photovoltaic)
Agent activity
29 hits · last 30 days
node
28
OpenAI (training)
1
Resources
nrel-pysam — pip install nrel-pysam · libregistry