WISDEM / WEIS

Wind Energy with Integrated Servo-controls Toolset
https://weis.readthedocs.io/en/latest/
Apache License 2.0
53 stars 40 forks source link

ImportError: cannot import name 'validate_without_defaults' from 'wisdem.inputs' #295

Closed TheMercer closed 1 month ago

TheMercer commented 4 months ago

Description

weis validation script, trying to reference scripts that dont exist in the repo.

This was working on my old laptop (dont have access to anymore), fresh install now have a problem

Steps to reproduce issue

I followed install instructions given on github

Current behavior

python weis_driver_same.py Traceback (most recent call last): File "~\weis_driver_same.py", line 5, in from weis.glue_code.runWEIS import run_weis File "C:\Users\ksm\WEIS\weis\glue_code\runWEIS.py", line 4, in from weis.glue_code.gc_LoadInputs import WindTurbineOntologyPythonWEIS File "C:\Users\ksm\WEIS\weis\glue_code\gc_LoadInputs.py", line 6, in import weis.inputs as sch File "C:\Users\ksm\WEIS\weis\inputs__init__.py", line 1, in from weis.inputs.validation import * File "C:\Users\ksm\WEIS\weis\inputs\validation.py", line 4, in from wisdem.inputs import load_yaml, write_yaml, validate_without_defaults, validate_with_defaults, simple_types ImportError: cannot import name 'validate_without_defaults' from 'wisdem.inputs' (C:\Miniconda3\envs\weis-env\Lib\site-packages\wisdem\inputs__init__.py)

non of this are in inputs, load_yaml, write_yaml, validate_without_defaults, validate_with_defaults, simple_types they are in validation, however these are not: validate_without_defaults, validate_with_defaults

Expected behavior

I should get this error

Code versions

List versions only if relevant

TheMercer commented 4 months ago

I have made this ticket on the WISDEM, I didn't realise until I made this post which repo I was looking at

gbarter commented 4 months ago

Yes, we are aware and resolving this issue as it was a change in WISDEM in the latest release over the weekend. For the next couple of days, you can use the fix_win branch of WEIS and the fix_scipy branch of ROSCO. We are hoping to push those changes to the master branches with the week.

gbarter commented 4 months ago

Alternatively, you can roll back WISDEM to v3.15

TheMercer commented 3 months ago

IMG_20240716_192756 Pulled the most recent develop branch and getting this error, did I install something wrong or own issue ?

gbarter commented 3 months ago

You probably need to update WISDEM & ROSCO too. If you look here, you will see the versions that are needed.

gbarter commented 3 months ago

(update RAFT too)

TheMercer commented 3 months ago

Oh okay will try that, thank you

TheMercer commented 3 months ago

Hey, also. When will this be fixed fully in main builds. So installing weis will "just" work again. Only reason I ask. Is having to balance weis, wisdem, rosco as all separate stuff. Gets hard to work with as my works security not allowing (Meson) the build of wisdem or rosco dll etc so it working through pip/conda install. Makes it much much easier and allows Weis to be "centre" hub of the packages

gbarter commented 3 months ago

We recently pushed the develop branch into master and will tag a new release. Pinning WEIS to specific versions of the dependencies, as linked above, will help stabilize things. A fresh install now should work, as our tests are now passing for the first time in a few months.

TheMercer commented 3 months ago

Oh okay brilliant, I will check in the morning tomorrow at work. 🤞🤞

Really appreciate your help.

TheMercer commented 3 months ago

Master, has got further through. Which is an known issue ? as I saw a different once before on something similar, I tried running Example 05 IEA15MW. fresh install (on windows)

-----------------------------------------------------------------------------
   Tuning a reference wind turbine controller using NREL's ROSCO toolbox
-----------------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\system.py", line 2666, in _call_user_function
    yield
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\explicitcomponent.py", line 264, in _compute_wrapper
    self.compute(self._inputs, self._outputs,
  File "C:\Users\ksm\WEIS\weis\aeroelasticse\openmdao_openfast.py", line 615, in compute
    summary_stats, extreme_table, DELs, Damage, case_list, case_name, chan_time, dlc_generator  = self.run_FAST(inputs, discrete_inputs, fst_vt)
                                                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ksm\WEIS\weis\aeroelasticse\openmdao_openfast.py", line 1839, in run_FAST
    comm.send(data, dest=rank_j, tag=0)
  File "mpi4py\MPI\Comm.pyx", line 1406, in mpi4py.MPI.Comm.send
  File "mpi4py\MPI\msgpickle.pxi", line 211, in mpi4py.MPI.PyMPI_send
mpi4py.MPI.Exception: Invalid rank, error stack:
MPI_Send(buf=0x00000137087D6320, count=5611, MPI_BYTE, dest=1, tag=0, MPI_COMM_WORLD) failed
Invalid rank has value 1 but must be nonnegative and less than 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ksm\WEIS\examples\06_IEA-15-240-RWT\weis_driver_monopile.py", line 16, in <module>
    wt_opt, modeling_options, opt_options = run_weis(fname_wt_input, fname_modeling_options, fname_analysis_options)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ksm\WEIS\weis\glue_code\runWEIS.py", line 213, in run_weis
    wt_opt.run_model()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\problem.py", line 677, in run_model
    self.model.run_solve_nonlinear()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\system.py", line 4682, in run_solve_nonlinear
    self._solve_nonlinear()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\group.py", line 3458, in _solve_nonlinear
    self._nonlinear_solver._solve_with_cache_check()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\solvers\nonlinear\nonlinear_runonce.py", line 26, in _solve_with_cache_check
    self.solve()  # don't use caching
    ^^^^^^^^^^^^
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\solvers\nonlinear\nonlinear_runonce.py", line 45, in solve
    self._gs_iter()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\solvers\solver.py", line 865, in _gs_iter
    subsys._solve_nonlinear()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\group.py", line 3458, in _solve_nonlinear
    self._nonlinear_solver._solve_with_cache_check()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\solvers\nonlinear\nonlinear_runonce.py", line 26, in _solve_with_cache_check
    self.solve()  # don't use caching
    ^^^^^^^^^^^^
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\solvers\nonlinear\nonlinear_runonce.py", line 45, in solve
    self._gs_iter()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\solvers\solver.py", line 865, in _gs_iter
    subsys._solve_nonlinear()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\explicitcomponent.py", line 293, in _solve_nonlinear
    self._compute_wrapper()
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\explicitcomponent.py", line 247, in _compute_wrapper
    with self._call_user_function('compute'):
  File "C:\Miniconda3\envs\weis-env\Lib\contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "C:\Miniconda3\envs\weis-env\Lib\site-packages\openmdao\core\system.py", line 2672, in _call_user_function
    raise err_type(
          ^^^^^^^^^
  File "mpi4py\MPI\ExceptionP.pyx", line 7, in mpi4py.MPI.Exception.__init__
TypeError: an integer is required
gbarter commented 3 months ago

The mpi4py package is finicky on Windows and we have removed it from our testing workflow on windows. Things should still run well without it.

Also, I think we are clearly due for an update on the README install instructions. . .

TheMercer commented 3 months ago

Oh okay, yeha as when I did the base install. And tried running example 05 15mw, it complains about mpi4py. If I have time tomorrow, I will try grab the error

dzalkind commented 3 months ago

@gbarter, what kind of instructions should we include?

I've seen other cases (ROSCO) where Windows users are required to conda install mpi4py.

gbarter commented 3 months ago

Maybe we note in the ReadMe that mpi4py will cause some Windows installs to fail but others require it? Not sure how else to message it and it doesn't seem like we can firmly recommend one approach.

dzalkind commented 1 month ago

I added a note to this effect in the docs branch. I think the original issue has been resolve, too. Thanks!