NREL / GreenHEART

Other
2 stars 9 forks source link

Trying to make a path from something that is not a path #24

Closed jmartin4nrel closed 1 week ago

jmartin4nrel commented 1 month ago

Running examples/greenheart/reference_plants/01-onshore-steel-mn/onshore-steel-mn.py (But is also happening trying to run anything involving Floris in Windows): pathlib is trying to turn some non-path text into a Path: "<attrs generated init floris.core.farm.Farm" May not be throwing an error on non-Windows platforms because '<' and '>' are not valid path characters in Windows - but shouldn't be happening regardless

Traceback (most recent call last):
  File "C:\Users\jmartin4\Documents\Code\IEDO Iron\jonathan's sandbox\GreenHEART\examples\reference_plants\01-onshore-steel-mn\onshore-steel-mn.py", line 35, in <module>
    prob, config = run_greenheart(config, run_only=True)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\greenheart\tools\optimization\gc_run_greenheart.py", line 192, in run_greenheart
    prob.run_model()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\core\problem.py", line 689, in run_model
    self.model.run_solve_nonlinear()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\core\system.py", line 4749, in run_solve_nonlinear
    self._solve_nonlinear()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\core\group.py", line 3529, in _solve_nonlinear
    self._nonlinear_solver._solve_with_cache_check()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\solvers\nonlinear\nonlinear_runonce.py", line 26, in _solve_with_cache_check
    self.solve()  # don't use caching
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\solvers\nonlinear\nonlinear_runonce.py", line 45, in solve
    self._gs_iter()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\solvers\solver.py", line 897, in _gs_iter
    subsys._solve_nonlinear()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\core\explicitcomponent.py", line 297, in _solve_nonlinear
    self._compute_wrapper()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\core\explicitcomponent.py", line 271, in _compute_wrapper
    self.compute(self._inputs, self._outputs)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\core\system.py", line 2744, in _call_user_function
    raise err_type(
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\core\system.py", line 2738, in _call_user_function
    yield
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\openmdao\core\explicitcomponent.py", line 271, in _compute_wrapper
    self.compute(self._inputs, self._outputs)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\greenheart\tools\optimization\openmdao.py", line 108, in compute
    lcoe, lcoh, steel_finance, ammonia_finance = run_simulation(config)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\greenheart\simulation\greenheart_simulation.py", line 532, in run_simulation
    config, hi, wind_cost_results = setup_greenheart_simulation(config=config)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\greenheart\simulation\greenheart_simulation.py", line 515, in setup_greenheart_simulation
    hi = he_hopp.setup_hopp(
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\greenheart\tools\eco\hopp_mgmt.py", line 145, in setup_hopp
    hi = HoppInterface(hopp_config_internal)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\hopp\simulation\hopp_interface.py", line 37, in __init__
    self.reinitialize(configuration=configuration)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\hopp\simulation\hopp_interface.py", line 46, in reinitialize
    self.hopp = Hopp.from_dict(self.configuration)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\hopp\type_dec.py", line 188, in from_dict
    return cls(**kwargs)
  File "<attrs generated init hopp.simulation.hopp.Hopp>", line 7, in __init__
    self.__attrs_post_init__()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\hopp\simulation\hopp.py", line 33, in __attrs_post_init__
    self.system = HybridSimulation(
  File "<attrs generated init hopp.simulation.hybrid_simulation.HybridSimulation>", line 14, in __init__
    self.__attrs_post_init__()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\hopp\simulation\hybrid_simulation.py", line 216, in __attrs_post_init__
    self.wind = WindPlant(self.site, config=wind_config)
  File "<attrs generated init hopp.simulation.technologies.wind.wind_plant.WindPlant>", line 5, in __init__
    self.__attrs_post_init__()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\hopp\simulation\technologies\wind\wind_plant.py", line 90, in __attrs_post_init__
    system_model = Floris(self.site, self.config)
  File "<attrs generated init hopp.simulation.technologies.wind.floris.Floris>", line 4, in __init__
    self.__attrs_post_init__()
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\hopp\simulation\technologies\wind\floris.py", line 40, in __attrs_post_init__
    self.fi = FlorisModel(floris_input_file)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\floris\floris_model.py", line 81, in __init__
    self.core = Core.from_dict(self.configuration)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\floris\type_dec.py", line 227, in from_dict
    return cls(**kwargs)
  File "<attrs generated init floris.core.core.Core>", line 8, in __init__
    _setattr('farm', __attr_converter_farm(farm))
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\floris\type_dec.py", line 227, in from_dict
    return cls(**kwargs)
  File "<attrs generated init floris.core.farm.Farm>", line 8, in __init__
    _setattr('turbine_library_path', __attr_converter_turbine_library_path(turbine_library_path))
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\site-packages\floris\type_dec.py", line 159, in convert_to_path
    base_fn_sys = Path(inspect.stack()[1].filename).resolve().parent
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\pathlib.py", line 1215, in resolve
    s = self._flavour.resolve(self, strict=strict)
  File "C:\Users\jmartin4\AppData\Local\anaconda3\envs\green_iron\lib\pathlib.py", line 215, in resolve
    s = self._ext_to_normal(_getfinalpathname(s))
OSError: 'greenheart' <class GreenHeartComponent>: Error calling compute(), [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<attrs generated init floris.core.farm.Farm>'
johnjasa commented 1 month ago

@jmartin4nrel, I tried this on my Windows machine and the example ran without error (including the FLORIS part). Could you please share what version of Python you're using and the output of a conda list?

jmartin4nrel commented 1 month ago

Python 3.9.20 conda list: Name Version Build Channel about-time 4.2.1 pypi_0 pypi aiounittest 1.4.2 pypi_0 pypi alabaster 0.7.16 pypi_0 pypi alembic 1.13.3 pypi_0 pypi alive-progress 3.1.5 pypi_0 pypi anyio 4.6.2.post1 pypi_0 pypi appdirs 1.4.4 pypi_0 pypi argon2-cffi 23.1.0 pypi_0 pypi argon2-cffi-bindings 21.2.0 pypi_0 pypi arrow 1.3.0 pypi_0 pypi asttokens 2.4.1 pypi_0 pypi async-lru 2.0.4 pypi_0 pypi attrs 24.2.0 pypi_0 pypi autograd 1.7.0 pypi_0 pypi babel 2.16.0 pypi_0 pypi bayesian-optimization 1.4.0 pypi_0 pypi beautifulsoup4 4.12.3 pypi_0 pypi bleach 6.1.0 pypi_0 pypi bokeh 3.4.3 pypi_0 pypi ca-certificates 2024.9.24 haa95532_0 certifi 2024.8.30 pypi_0 pypi cffi 1.17.1 pypi_0 pypi cfgv 3.4.0 pypi_0 pypi charset-normalizer 3.4.0 pypi_0 pypi click 8.1.7 pypi_0 pypi cma 3.2.2 pypi_0 pypi colorama 0.4.0 pypi_0 pypi coloredlogs 15.0.1 pypi_0 pypi colorlog 6.8.2 pypi_0 pypi comm 0.2.2 pypi_0 pypi contourpy 1.3.0 pypi_0 pypi coolprop 6.6.0 pypi_0 pypi coverage 7.6.4 pypi_0 pypi cycler 0.12.1 pypi_0 pypi cython 3.0.11 pypi_0 pypi debugpy 1.8.7 pypi_0 pypi decorator 5.1.1 pypi_0 pypi defusedxml 0.7.1 pypi_0 pypi deprecated 1.2.14 pypi_0 pypi dill 0.3.9 pypi_0 pypi directsearch 1.0 pypi_0 pypi diskcache 5.6.3 pypi_0 pypi distlib 0.3.9 pypi_0 pypi docopt 0.6.2 pypi_0 pypi docutils 0.18.1 pypi_0 pypi electrolyzer 0.1.0 pypi_0 pypi entrypoints 0.4 pypi_0 pypi et-xmlfile 1.1.0 pypi_0 pypi exceptiongroup 1.2.2 pypi_0 pypi executing 2.1.0 pypi_0 pypi fastjsonschema 2.20.0 pypi_0 pypi fastkml 0.12 pypi_0 pypi filelock 3.16.1 pypi_0 pypi flexcache 0.3 pypi_0 pypi flexparser 0.3.1 pypi_0 pypi floris 4.1.1 pypi_0 pypi fonttools 4.54.1 pypi_0 pypi fqdn 1.5.1 pypi_0 pypi fsspec 2024.10.0 pypi_0 pypi future 1.0.0 pypi_0 pypi global-land-mask 1.0.0 pypi_0 pypi grapheme 0.6.0 pypi_0 pypi greenheart 0.1.0 pypi_0 pypi greenlet 3.1.1 pypi_0 pypi h11 0.14.0 pypi_0 pypi h3 4.1.1 pypi_0 pypi hopp 3.0 pypi_0 pypi httpcore 1.0.6 pypi_0 pypi httpx 0.27.2 pypi_0 pypi humanfriendly 10.0 pypi_0 pypi hybridbosse 0.9.6 pypi_0 pypi identify 2.6.1 pypi_0 pypi idna 3.10 pypi_0 pypi imagesize 1.4.1 pypi_0 pypi importlib-metadata 8.5.0 pypi_0 pypi importlib-resources 6.4.5 pypi_0 pypi iniconfig 2.0.0 pypi_0 pypi ipykernel 6.29.5 pypi_0 pypi ipympl 0.9.4 pypi_0 pypi ipyparallel 8.8.0 pypi_0 pypi ipython 8.18.1 pypi_0 pypi ipython-genutils 0.2.0 pypi_0 pypi ipywidgets 8.1.5 pypi_0 pypi isoduration 20.11.0 pypi_0 pypi jax 0.4.30 pypi_0 pypi jaxlib 0.4.30 pypi_0 pypi jedi 0.19.1 pypi_0 pypi jinja2 3.1.4 pypi_0 pypi joblib 1.4.2 pypi_0 pypi json5 0.9.25 pypi_0 pypi jsonpointer 3.0.0 pypi_0 pypi jsonschema 4.23.0 pypi_0 pypi jsonschema-specifications 2024.10.1 pypi_0 pypi jupyter-book 0.14.0 pypi_0 pypi jupyter-cache 0.6.1 pypi_0 pypi jupyter-client 8.6.3 pypi_0 pypi jupyter-core 5.7.2 pypi_0 pypi jupyter-events 0.10.0 pypi_0 pypi jupyter-lsp 2.2.5 pypi_0 pypi jupyter-server 2.14.2 pypi_0 pypi jupyter-server-terminals 0.5.3 pypi_0 pypi jupyterlab 4.2.5 pypi_0 pypi jupyterlab-pygments 0.3.0 pypi_0 pypi jupyterlab-server 2.27.3 pypi_0 pypi jupyterlab-widgets 3.0.13 pypi_0 pypi kiwisolver 1.4.7 pypi_0 pypi latexcodec 3.0.0 pypi_0 pypi lcoe 0.3.2 pypi_0 pypi linkify-it-py 2.0.3 pypi_0 pypi lxml 5.3.0 pypi_0 pypi mako 1.3.6 pypi_0 pypi markdown-it-py 2.2.0 pypi_0 pypi markupsafe 3.0.2 pypi_0 pypi marmot-agents 0.2.5 pypi_0 pypi matplotlib 3.9.2 pypi_0 pypi matplotlib-inline 0.1.7 pypi_0 pypi mdit-py-plugins 0.3.5 pypi_0 pypi mdurl 0.1.2 pypi_0 pypi mistune 3.0.2 pypi_0 pypi ml-dtypes 0.5.0 pypi_0 pypi multiprocessing-on-dill 3.5.0a4 pypi_0 pypi myst-nb 0.17.2 pypi_0 pypi myst-parser 0.18.1 pypi_0 pypi nbclient 0.7.4 pypi_0 pypi nbconvert 7.16.4 pypi_0 pypi nbformat 5.10.4 pypi_0 pypi nest-asyncio 1.6.0 pypi_0 pypi networkx 3.2.1 pypi_0 pypi nevergrad 1.0.5 pypi_0 pypi nodeenv 1.9.1 pypi_0 pypi notebook 7.2.2 pypi_0 pypi notebook-shim 0.2.4 pypi_0 pypi nrel-pysam 4.2.0 pypi_0 pypi num2words 0.5.13 pypi_0 pypi numexpr 2.10.1 pypi_0 pypi numpy 1.26.4 pypi_0 pypi numpy-financial 1.0.0 pypi_0 pypi numpydoc 1.6.0 pypi_0 pypi openmdao 3.35.0 pypi_0 pypi openpyxl 3.1.5 pypi_0 pypi openssl 3.0.15 h827c3e9_0 opt-einsum 3.4.0 pypi_0 pypi optuna 4.0.0 pypi_0 pypi orbit-nrel 1.1 pypi_0 pypi overrides 7.7.0 pypi_0 pypi packaging 24.1 pypi_0 pypi pandas 2.2.3 pypi_0 pypi pandocfilters 1.5.1 pypi_0 pypi parameterized 0.9.0 pypi_0 pypi parso 0.8.4 pypi_0 pypi patsy 0.5.6 pypi_0 pypi pillow 11.0.0 pypi_0 pypi pint 0.24.3 pypi_0 pypi pip 24.2 py39haa95532_0 platformdirs 4.3.6 pypi_0 pypi playwright 1.48.0 pypi_0 pypi plotly 5.24.1 pypi_0 pypi pluggy 1.5.0 pypi_0 pypi ply 3.11 pypi_0 pypi poap 0.1.26 pypi_0 pypi pre-commit 4.0.1 pypi_0 pypi profast 1.0.3 pypi_0 pypi prometheus-client 0.21.0 pypi_0 pypi prompt-toolkit 3.0.48 pypi_0 pypi psutil 6.1.0 pypi_0 pypi pure-eval 0.2.3 pypi_0 pypi pvmismatch 4.1 pypi_0 pypi pyaml 24.9.0 pypi_0 pypi pyarrow 17.0.0 pypi_0 pypi pybtex 0.24.0 pypi_0 pypi pybtex-docutils 1.0.3 pypi_0 pypi pycodestyle 2.12.1 pypi_0 pypi pycparser 2.22 pypi_0 pypi pydata-sphinx-theme 0.12.0 pypi_0 pypi pydocstyle 6.3.0 pypi_0 pypi pydoe2 1.3.0 pypi_0 pypi pydoe3 1.0.4 pypi_0 pypi pyee 12.0.0 pypi_0 pypi pygeoif 0.7 pypi_0 pypi pygments 2.18.0 pypi_0 pypi pymoo 0.6.1.3 pypi_0 pypi pyomo 6.8.0 pypi_0 pypi pyparsing 3.2.0 pypi_0 pypi pyproj 3.6.1 pypi_0 pypi pyreadline3 3.5.4 pypi_0 pypi pysolar 0.11 pypi_0 pypi pysot 0.3.3 pypi_0 pypi pytest 8.3.3 pypi_0 pypi python 3.9.20 h8205438_1 python-benedict 0.33.1 pypi_0 pypi python-dateutil 2.9.0.post0 pypi_0 pypi python-dotenv 1.0.1 pypi_0 pypi python-fsutil 0.14.1 pypi_0 pypi python-json-logger 2.0.7 pypi_0 pypi python-rapidjson 1.20 pypi_0 pypi python-slugify 8.0.4 pypi_0 pypi pytz 2024.2 pypi_0 pypi pywin32 308 pypi_0 pypi pywinpty 2.0.14 pypi_0 pypi pyyaml 6.0.2 pypi_0 pypi pyyaml-include 2.1 pypi_0 pypi pyzmq 26.2.0 pypi_0 pypi rainflow 3.2.0 pypi_0 pypi referencing 0.35.1 pypi_0 pypi requests 2.32.3 pypi_0 pypi rfc3339-validator 0.1.4 pypi_0 pypi rfc3986-validator 0.1.1 pypi_0 pypi rpds-py 0.20.0 pypi_0 pypi ruamel-yaml 0.18.6 pypi_0 pypi ruamel-yaml-clib 0.2.12 pypi_0 pypi scikit-learn 1.5.2 pypi_0 pypi scikit-optimize 0.10.2 pypi_0 pypi scipy 1.13.1 pypi_0 pypi send2trash 1.8.3 pypi_0 pypi setuptools 75.1.0 py39haa95532_0 shapely 2.0.6 pypi_0 pypi simpy 4.1.1 pypi_0 pypi six 1.16.0 pypi_0 pypi sniffio 1.3.1 pypi_0 pypi snowballstemmer 2.2.0 pypi_0 pypi soupsieve 2.6 pypi_0 pypi sphinx 5.0.2 pypi_0 pypi sphinx-book-theme 0.4.0rc1 pypi_0 pypi sphinx-comments 0.0.3 pypi_0 pypi sphinx-copybutton 0.5.2 pypi_0 pypi sphinx-design 0.3.0 pypi_0 pypi sphinx-external-toc 0.3.1 pypi_0 pypi sphinx-jupyterbook-latex 0.5.2 pypi_0 pypi sphinx-multitoc-numbering 0.1.3 pypi_0 pypi sphinx-sitemap 2.6.0 pypi_0 pypi sphinx-thebe 0.2.1 pypi_0 pypi sphinx-togglebutton 0.3.2 pypi_0 pypi sphinxcontrib-applehelp 2.0.0 pypi_0 pypi sphinxcontrib-bibtex 2.5.0 pypi_0 pypi sphinxcontrib-devhelp 2.0.0 pypi_0 pypi sphinxcontrib-htmlhelp 2.1.0 pypi_0 pypi sphinxcontrib-jsmath 1.0.1 pypi_0 pypi sphinxcontrib-qthelp 2.0.0 pypi_0 pypi sphinxcontrib-serializinghtml 2.0.0 pypi_0 pypi sqlalchemy 2.0.36 pypi_0 pypi sqlite 3.45.3 h2bbff1b_0 stack-data 0.6.3 pypi_0 pypi statsmodels 0.14.4 pypi_0 pypi tabulate 0.9.0 pypi_0 pypi tenacity 9.0.0 pypi_0 pypi terminado 0.18.1 pypi_0 pypi testflo 1.4.19 pypi_0 pypi text-unidecode 1.3 pypi_0 pypi threadpoolctl 3.5.0 pypi_0 pypi timezonefinder 6.5.4 pypi_0 pypi tinycss2 1.3.0 pypi_0 pypi tomli 2.0.2 pypi_0 pypi tornado 6.4.1 pypi_0 pypi tqdm 4.66.5 pypi_0 pypi traitlets 5.14.3 pypi_0 pypi types-python-dateutil 2.9.0.20241003 pypi_0 pypi typing-extensions 4.12.2 pypi_0 pypi tzdata 2024.2 pypi_0 pypi uc-micro-py 1.0.3 pypi_0 pypi uri-template 1.3.0 pypi_0 pypi urllib3 2.2.3 pypi_0 pypi utm 0.7.0 pypi_0 pypi vc 14.40 h2eaa2aa_1 virtualenv 20.27.0 pypi_0 pypi vs2015_runtime 14.40.33807 h98bb1dd_1 wcwidth 0.2.13 pypi_0 pypi webcolors 24.8.0 pypi_0 pypi webencodings 0.5.1 pypi_0 pypi websocket-client 1.8.0 pypi_0 pypi websockets 13.1 pypi_0 pypi wheel 0.44.0 py39haa95532_0 widgetsnbextension 4.0.13 pypi_0 pypi wrapt 1.16.0 pypi_0 pypi xlwings 0.33.3 pypi_0 pypi xyzservices 2024.9.0 pypi_0 pypi zipp 3.20.2 pypi_0 pypi

johnjasa commented 1 month ago

Awesome, thank you, I've reproduced it locally with your info. I'll dig into this now.

johnjasa commented 1 week ago

Resolved by bumping minimum Python version for HOPP