Breakthrough-Energy / PreREISE

Generate input data for scenario framework
https://breakthrough-energy.github.io/docs/
MIT License
20 stars 28 forks source link

Update dependencies and python versions #307

Closed rouille closed 1 year ago

rouille commented 1 year ago

Pull Request doc

Purpose

Update version of powersimdata to 0.5.4 (latest). Closes #304.

What the code is doing

After updating powersimdata, some tests were failing because geographical constants could not be accessed anymore. This has been fixed using a ModelImmutables object.

Testing

Existing unit tests

Where to look

Usage Example/Visuals

N/A

Time estimate

5min

rouille commented 1 year ago

Just wonder the dependency issues for 3.10

Below is the error:

[~/CEM/PreREISE] (ben/update) brdo$ pipenv lock --python 3.10.3
Creating a virtualenv for this project...
Pipfile: /Users/brdo/CEM/PreREISE/Pipfile
Using /Users/brdo/.pyenv/versions/3.10.3/bin/python3 (3.10.3) to create virtualenv...
⠦ Creating virtual environment...created virtual environment CPython3.10.3.final.0-64 in 395ms
  creator CPython3Posix(dest=/Users/brdo/.local/share/virtualenvs/PreREISE-Yr21Ys7H, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/brdo/Library/Application Support/virtualenv)
    added seed packages: pip==22.2.2, setuptools==63.4.3, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment! 
Virtualenv location: /Users/brdo/.local/share/virtualenvs/PreREISE-Yr21Ys7H
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success! 
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed! 

CRITICAL:pipenv.patched.notpip._internal.resolution.resolvelib.factory:Could not find a version that satisfies the requirement nrel-pysam~=2.2 (from versions: 1.2.1, 2.1.1, 3.0.0, 3.0.1)
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/resolver.py", line 743, in _main
[ResolutionFailure]:       resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/resolver.py", line 704, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/resolver.py", line 685, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/utils.py", line 1398, in resolve_deps
[ResolutionFailure]:       results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/utils.py", line 1127, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/utils.py", line 905, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: No matching distribution found for nrel-pysam~=2.2

We would need to update nrel-pysam. Version 3.0.0 supports python 3.10 according to the release notes. I will try and update the PR if it works.

rouille commented 1 year ago

Just wonder the dependency issues for 3.10

Below is the error:

[~/CEM/PreREISE] (ben/update) brdo$ pipenv lock --python 3.10.3
Creating a virtualenv for this project...
Pipfile: /Users/brdo/CEM/PreREISE/Pipfile
Using /Users/brdo/.pyenv/versions/3.10.3/bin/python3 (3.10.3) to create virtualenv...
⠦ Creating virtual environment...created virtual environment CPython3.10.3.final.0-64 in 395ms
  creator CPython3Posix(dest=/Users/brdo/.local/share/virtualenvs/PreREISE-Yr21Ys7H, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/brdo/Library/Application Support/virtualenv)
    added seed packages: pip==22.2.2, setuptools==63.4.3, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment! 
Virtualenv location: /Users/brdo/.local/share/virtualenvs/PreREISE-Yr21Ys7H
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success! 
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed! 

CRITICAL:pipenv.patched.notpip._internal.resolution.resolvelib.factory:Could not find a version that satisfies the requirement nrel-pysam~=2.2 (from versions: 1.2.1, 2.1.1, 3.0.0, 3.0.1)
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/resolver.py", line 743, in _main
[ResolutionFailure]:       resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/resolver.py", line 704, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/resolver.py", line 685, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/utils.py", line 1398, in resolve_deps
[ResolutionFailure]:       results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/utils.py", line 1127, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2022.3.23/libexec/lib/python3.10/site-packages/pipenv/utils.py", line 905, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: No matching distribution found for nrel-pysam~=2.2

We would need to update nrel-pysam. Version 3.0.0 supports python 3.10 according to the release notes. I will try and update the PR if it works.

It works. I have updated the requirements.txt, Pipfile, setup.cfg and the .github/workflows/test.yml files and regenerated the Pifile.lock file