From 53058251ae84df2953405e3c271f297dbfb65040 Mon Sep 17 00:00:00 2001 From: Garrett Barter Date: Wed, 19 Jan 2022 10:36:27 -0700 Subject: [PATCH] Squashed 'WISDEM/' changes from 77e6ce293..f5fbac50f f5fbac50f pyoptsparse not available for windows. . . dcf67c305 rely on conda version of pyoptsparse f4c6f2b89 Merge branch 'develop' of github.com:WISDEM/WISDEM into develop cd54b8803 adding missing __init__ 5d930592f Merge pull request #351 from WISDEM/test_pip 4207dd360 updated for new OpenMDAO convention to name unnamed Problems 1f5285bf3 suppressing pip on Windows- cannot figure that one out. Also removing pyside2 from setup.py because it always downloads the pypi one and conflicts with conda 7c4686af7 more pip sophistication for git workflow, remove complexity for user instructions 33d8a7975 test out pip in the CI and more robust conda instructions git-subtree-dir: WISDEM git-subtree-split: f5fbac50f0540b29c589f13834348487a2e7bc4c --- .github/workflows/CI_WISDEM.yml | 20 +++++++++++--- README.md | 16 ++++------- docs/installation.rst | 27 ++++++++----------- environment.yml | 5 ++-- setup.py | 5 ++-- wisdem/postprocessing/__init__.py | 0 .../test_nlopt_driver.py | 9 ++++--- 7 files changed, 43 insertions(+), 39 deletions(-) create mode 100644 wisdem/postprocessing/__init__.py diff --git a/.github/workflows/CI_WISDEM.yml b/.github/workflows/CI_WISDEM.yml index 81db4b25b..30a3ea86b 100644 --- a/.github/workflows/CI_WISDEM.yml +++ b/.github/workflows/CI_WISDEM.yml @@ -32,7 +32,7 @@ jobs: #shell: pwsh # putting in a shell command makes for compile linking problems later # (if you use the shell here, cannot use 'compiler' package) run: | - conda install -y petsc4py mpi4py compilers nlopt + conda install -y petsc4py mpi4py compilers pyoptsparse # Install dependencies of WISDEM specific to windows - name: Add dependencies windows specific @@ -44,12 +44,26 @@ jobs: #- name: Setup tmate session # uses: mxschmitt/action-tmate@v3 - # Install WISDEM - - name: Install WISDEM + # Install WISDEM with setup + - name: Install WISDEM with setup shell: pwsh run: | python setup.py develop + # Install WISDEM with pip + - name: Install WISDEM with pip for Unix + if: false == contains( matrix.os, 'windows') + shell: pwsh + run: | + pip install -vv --no-deps -e . + + # Install WISDEM with pip + #- name: Install WISDEM with pip for Windows + # if: contains( matrix.os, 'windows') + # shell: pwsh + # run: | + # pip install -vv --no-deps --global-option --compiler=unix . + # Run all tests - name: Run tests if: contains( matrix.os, 'ubuntu') diff --git a/README.md b/README.md index 006c7f0c6..6faafda92 100644 --- a/README.md +++ b/README.md @@ -48,25 +48,19 @@ The installation instructions below use the environment name, "wisdem-env," but conda create -y --name wisdem-env python=3.8 conda activate wisdem-env -2. In order to directly use the examples in the repository and peek at the code when necessary, we recommend all users install WISDEM in *developer* mode. This is done by first installing WISDEM as a conda package to easily satisfy all dependencies, but then removing the WISDEM conda package and reinstalling from the Github source code. Note the differences between Windows and Mac/Linux build systems. For Linux, we recommend using the native compilers (for example, gcc and gfortran in the default GNU suite). +2. In order to directly use the examples in the repository and peek at the code when necessary, we recommend all users install WISDEM in *developer / editable* mode using the instructions here. If you really just want to use WISDEM as a library and lean on the documentation, you can always do `conda install wisdem` and be done. Note the differences between Windows and Mac/Linux build systems. For Linux, we recommend using the native compilers (for example, gcc and gfortran in the default GNU suite). - conda install -y wisdem git - conda remove -y --force wisdem - conda install -y compilers # (Mac only) + conda install -y cython git jsonschema make matplotlib nlopt numpy openmdao openpyxl pandas pip pyside2 pytest python-benedict pyyaml ruamel_yaml scipy setuptools simpy sortedcontainers swig + conda install -y pyoptsparse # (Linux only) + conda install -y compilers pyoptsparse # (Mac only) conda install -y m2w64-toolchain libpython # (Windows only) - pip install simpy marmot-agents nlopt + pip install marmot-agents git clone https://github.com/WISDEM/WISDEM.git cd WISDEM git checkout develop # If you want to switch WISDEM branches python setup.py develop -3. OPTIONAL: Install pyOptSparse, a package that provides a handful of additional optimization solvers and has OpenMDAO support: - - git clone https://github.com/evan-gaertner/pyoptsparse.git - pip install -e pyoptsparse - - **NOTE:** To use WISDEM again after installation is complete, you will always need to activate the conda environment first with `conda activate wisdem-env` diff --git a/docs/installation.rst b/docs/installation.rst index 883a78aed..562b56db3 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -13,7 +13,7 @@ Setup and activate the Anaconda environment from a prompt (Anaconda3 Power Shell .. code-block:: bash conda config --add channels conda-forge - conda create -y --name wisdem-env python=3.7 + conda create -y --name wisdem-env python=3.8 conda activate wisdem-env Note that any future occasion on which you wish to use WISDEM, you will only have to start with ``conda activate wisdem-env``. @@ -21,19 +21,24 @@ Note that any future occasion on which you wish to use WISDEM, you will only hav Install WISDEM ^^^^^^^^^^^^^^ -In order to directly use the examples in the repository and peek at the code when necessary, we recommend all users install WISDEM in *developer* mode. This is done by first installing WISDEM as a conda package to easily satisfy all dependencies, but then removing the WISDEM conda package and reinstalling from the Github source code. Note the differences between Windows and Mac build systems. For Linux, we recommend using the native compilers (for example, gcc and gfortran in the default GNU suite). +In order to directly use the examples in the repository and peek at the code when necessary, we recommend all users install WISDEM in *developer* mode. This is done by first installing WISDEM dependencies and then installing WISDEM from the Github source code. Note the differences between Windows and Mac build systems. For Linux, we recommend using the native compilers (for example, gcc and gfortran in the default GNU suite). .. code-block:: bash - conda install -y wisdem git - conda remove --force wisdem - pip install simpy marmot-agents nlopt + conda install -y cython git jsonschema make matplotlib nlopt numpy openmdao openpyxl pandas pip pyside2 pytest python-benedict pyyaml ruamel_yaml scipy setuptools simpy sortedcontainers swig + pip install marmot-agents + +For Linux systems: + +.. code-block:: bash + + conda install pyoptsparse For Mac systems: .. code-block:: bash - conda install compilers + conda install compilers pyoptsparse For Windows systems: @@ -50,16 +55,6 @@ Finally, for all systems: git checkout develop pip install -e . -Install pyOptSparse (`Optional`) -"""""""""""""""""""""""""""""""" - -`pyOptSparse `_ is a package that provides additional optimization solvers with OpenMDAO support: - -.. code-block:: bash - - git clone https://github.com/evan-gaertner/pyoptsparse.git - pip install -e pyoptsparse - Run Unit Tests ^^^^^^^^^^^^^^ diff --git a/environment.yml b/environment.yml index 88e2a8429..f7f0e827e 100644 --- a/environment.yml +++ b/environment.yml @@ -26,14 +26,15 @@ dependencies: - pyyaml - ruamel_yaml - scipy - - setuptools==58.4.0 + - setuptools + - simpy - sortedcontainers - swig - pip: - - simpy - marmot-agents # Needs to be done outside of environment file: # - m2w64-toolchain # [win] # - libpython # [win] # - compilers # [not win] # - petsc4py # [not win] +# - pyoptsparse # [not win] diff --git a/setup.py b/setup.py index 6e56239eb..1459a81ab 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ extra_compile_args=["-O2", "-fPIC", "-std=c11"], ) pyframeExt = Extension( - "wisdem.pyframe3dd._pyframe3dd", + "wisdem.pyframe3dd._pyframe3dd", sources=glob.glob(os.path.join("wisdem", "pyframe3dd", "src", "*.c")), extra_compile_args=["-O2", "-fPIC", "-std=c11"], ) @@ -29,7 +29,7 @@ # Top-level setup setup( name="WISDEM", - version="3.5.0", + version="3.5.1", description="Wind-Plant Integrated System Design & Engineering Model", long_description="""WISDEM is a Python package for conducting multidisciplinary analysis and optimization of wind turbines and plants. It is built on top of NASA's OpenMDAO library.""", @@ -43,7 +43,6 @@ "openmdao>=3.4", "openpyxl", "pandas", - "pyside2", "pytest", "python-benedict", "pyyaml", diff --git a/wisdem/postprocessing/__init__.py b/wisdem/postprocessing/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wisdem/test/test_optimization_drivers/test_nlopt_driver.py b/wisdem/test/test_optimization_drivers/test_nlopt_driver.py index 2cc2b0e99..d182bd812 100644 --- a/wisdem/test/test_optimization_drivers/test_nlopt_driver.py +++ b/wisdem/test/test_optimization_drivers/test_nlopt_driver.py @@ -10,12 +10,11 @@ from openmdao.utils.general_utils import run_driver from openmdao.test_suite.components.sellar import SellarDerivatives, SellarDerivativesGrouped from openmdao.test_suite.groups.sin_fitter import SineFitter +from wisdem.optimization_drivers.nlopt_driver import NLoptDriver from openmdao.test_suite.components.paraboloid import Paraboloid from openmdao.test_suite.components.simple_comps import NonSquareArrayComp from openmdao.test_suite.components.expl_comp_array import TestExplCompArrayDense -from wisdem.optimization_drivers.nlopt_driver import NLoptDriver - try: import nlopt except ImportError: @@ -1001,9 +1000,11 @@ def test_call_final_setup(self): with self.assertRaises(RuntimeError) as cm: totals = prob.check_totals(method="fd", out_stream=False) - expected_msg = "Problem: run_model must be called before total derivatives can be checked." + # expected_msg = "Problem: run_model must be called before total derivatives can be checked." + expected_msg = "run_model must be called before total derivatives can be checked." - self.assertEqual(expected_msg, str(cm.exception)) + # self.assertEqual(expected_msg, str(cm.exception)) + self.assertTrue(str(cm.exception).find(expected_msg) >= 0) def test_LN_COBYLA_linear_constraint(self): # Bug where NLoptDriver tried to compute and cache the constraint derivatives for the