From 3c0187afec24243b88d857c48c02678926ea39f7 Mon Sep 17 00:00:00 2001 From: Mohammad Kazemi Date: Mon, 28 Sep 2026 16:03:25 +0330 Subject: [PATCH 1/4] Support PySAM on Python 3.14 via nlr-pysam package - Update optional dependency from 'nrel-pysam' to 'nlr-pysam' - Uncomment nlr-pysam in Python 3.14 CI requirements - PySAM 8.0.0+ is distributed as nlr-pysam for Python 3.8-3.14 Note: test_fit_cec_sam shows minor numerical differences between nlr-pysam 8.0.0+ and nrel-pysam, particularly in the 'Adjust' parameter. This may indicate algorithmic changes in the newer nlr-pysam distribution that needs further investigation. Fixes #2871 --- ci/requirements-py3.11.yml | 2 +- ci/requirements-py3.12.yml | 2 +- ci/requirements-py3.13.yml | 2 +- ci/requirements-py3.14.yml | 2 +- pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/requirements-py3.11.yml b/ci/requirements-py3.11.yml index c14676ab2f..1892fb5041 100644 --- a/ci/requirements-py3.11.yml +++ b/ci/requirements-py3.11.yml @@ -24,5 +24,5 @@ dependencies: - scipy >= 1.7.2 - statsmodels - pip: - - nrel-pysam>=2.0 + - nlr-pysam - solarfactors diff --git a/ci/requirements-py3.12.yml b/ci/requirements-py3.12.yml index 1254dcb132..e1a376d780 100644 --- a/ci/requirements-py3.12.yml +++ b/ci/requirements-py3.12.yml @@ -24,5 +24,5 @@ dependencies: - scipy >= 1.7.2 - statsmodels - pip: - - nrel-pysam>=2.0 + - nlr-pysam - solarfactors diff --git a/ci/requirements-py3.13.yml b/ci/requirements-py3.13.yml index 6647d72196..30e6b95b3a 100644 --- a/ci/requirements-py3.13.yml +++ b/ci/requirements-py3.13.yml @@ -24,5 +24,5 @@ dependencies: - scipy >= 1.7.2 - statsmodels - pip: - - nrel-pysam>=2.0 + - nlr-pysam - solarfactors diff --git a/ci/requirements-py3.14.yml b/ci/requirements-py3.14.yml index 1b1501c66f..af76893662 100644 --- a/ci/requirements-py3.14.yml +++ b/ci/requirements-py3.14.yml @@ -24,5 +24,5 @@ dependencies: - scipy >= 1.7.2 - statsmodels - pip: - # - nrel-pysam>=2.0 # not available for py 3.14 as of 2025-11-03 + - nlr-pysam - solarfactors diff --git a/pyproject.toml b/pyproject.toml index de7fbb7fb8..3c145f9cfc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ dynamic = ["version"] optional = [ 'cython', 'ephem', - 'nrel-pysam', + 'nlr-pysam', 'numba >= 0.17.0', 'solarfactors >= 1.6.1', 'statsmodels', From acffc6cb43a86ecd8e61b26300955479b1e98248 Mon Sep 17 00:00:00 2001 From: Mohammad Kazemi Date: Sat, 24 Oct 2026 17:25:57 +0330 Subject: [PATCH 2/4] Fix stale PySAM install message --- pvlib/ivtools/sdm/cec.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pvlib/ivtools/sdm/cec.py b/pvlib/ivtools/sdm/cec.py index 881e51ebdb..0002ff1dcb 100644 --- a/pvlib/ivtools/sdm/cec.py +++ b/pvlib/ivtools/sdm/cec.py @@ -76,8 +76,10 @@ def fit_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, try: from PySAM import PySSC except ImportError: - raise ImportError("Requires NREL's PySAM package at " - "https://pypi.org/project/NREL-PySAM/.") + raise ImportError( + "Requires PySAM. Install 'nlr-pysam' for PySAM >= 8.0.0 " + "(older versions were distributed as 'NREL-PySAM')." + ) datadict = {'tech_model': '6parsolve', 'financial_model': None, 'celltype': celltype, 'Vmp': v_mp, From b2fe6bb690cf4310b98c0d82169706ca67720146 Mon Sep 17 00:00:00 2001 From: Mohammad Kazemi Date: Wed, 28 Oct 2026 12:13:07 +0330 Subject: [PATCH 3/4] Apply batched suggestions from code review change package names to lowercase versions Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com> --- pvlib/ivtools/sdm/cec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pvlib/ivtools/sdm/cec.py b/pvlib/ivtools/sdm/cec.py index 0002ff1dcb..21135ef242 100644 --- a/pvlib/ivtools/sdm/cec.py +++ b/pvlib/ivtools/sdm/cec.py @@ -52,7 +52,7 @@ def fit_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, Raises ------ ImportError - if NREL-PySAM is not installed. + if ``NLR-PySAM`` is not installed. RuntimeError if parameter extraction is not successful. @@ -77,7 +77,7 @@ def fit_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, from PySAM import PySSC except ImportError: raise ImportError( - "Requires PySAM. Install 'nlr-pysam' for PySAM >= 8.0.0 " + "Requires PySAM. Install 'NLR-PySAM' for PySAM >= 8.0.0 " "(older versions were distributed as 'NREL-PySAM')." ) From 7d33630be96c46a9d2a97041db72b97b7115fb81 Mon Sep 17 00:00:00 2001 From: Mohammad Kazemi Date: Wed, 28 Oct 2026 12:32:53 +0330 Subject: [PATCH 4/4] Add PySAM Python 3.14 support to v0.16.2 release notes --- docs/sphinx/source/whatsnew/v0.16.2.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.16.2.rst b/docs/sphinx/source/whatsnew/v0.16.2.rst index 834ef7ee37..3d07548694 100644 --- a/docs/sphinx/source/whatsnew/v0.16.2.rst +++ b/docs/sphinx/source/whatsnew/v0.16.2.rst @@ -27,6 +27,8 @@ Enhancements * Add ``dataset`` parameter to :py:func:`~pvlib.iotools.get_era5` allowing for choosing between ERA5 and ERA5-Land datasets. (:pull:`2780`) +* Support PySAM on Python 3.14 via the ``nlr-pysam`` package. + (:pull:`2872`) Documentation ~~~~~~~~~~~~~ @@ -68,6 +70,7 @@ Contributors * Adam R. Jensen (:ghuser:`AdamRJensen`) * Cliff Hansen (:ghuser:`cwhanse`) * Chen Yi (:ghuser:`chenyi6758-source`) +* Mohammad Kazemi (:ghuser:`mokazemi`) * Rajiv Daxini (:ghuser:`rdaxini`) * jason-writer (:ghuser:`jason-writer`) * :ghuser:`bfs2021`