NREL / ROSCO

A Reference Open Source Controller for Wind Turbines
https://rosco.readthedocs.io/en/latest/
Apache License 2.0
116 stars 93 forks source link

ZeroMQ client not properly installed | Example 17 #313

Closed Ian-Ammerman closed 2 months ago

Ian-Ammerman commented 9 months ago

I have installed ROSCO 2.9 following the full installation instructions (2.1) here: https://rosco.readthedocs.io/en/latest/source/install.html#full-rosco

Within WSL I create the conda environment rosco-env with python 3.10 and activate it. I navigate to ROSCO and pip install -e . which succesfully builds ROSCO. I am then able to run example 01.

I then install OpenFAST via conda install -c conda-forge openfast. Running example 17a or 17b then yields the following error:

ROSCO:PitchControl:PitchSaturation:interp1d:interp1d:interp1d:interp1d:interp1d:VariableSpeedControl:WindSpeedEstimator:AeroDynTorque:interp2d:interp2d:interp1d:UpdateZeroMQ: >> The ZeroMQ client has not been properly installed, please install it to use ZMQ_Mode > 0.

Installing zeroMQ using anaconda (conda install zeromq & conda install pyzmq) has no effect. Is there another install procedure I should follow perhaps?

dzalkind commented 9 months ago

This is where cmake looks for the libzmq library. You can search for it with ldd libzmq I think.

You'll also want to delete the build/ directories in the ROSCO main folder and ROSCO/rosco/controller before re-trying the install with pip install -e .

If all else fails, you can install libzmq with apt-get install libzmq3-dev.

I hope this helps.

Best, Dan

Ian-Ammerman commented 9 months ago

Thanks for the response,

After cloning ROSCO from github there is no build/ directory in either the main ROSCO folder or controller subfolder when I run pip install -e .

Running a search via ldd yields no such file or directory (run 1 level up from ROSCO main folder):

(rosco-env) ian_ammerman@Dell-Laptop:~$ sudo apt-get install libzmq3-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done libzmq3-dev is already the newest version (4.3.4-2). 0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.

After which, I am still unable to locate the library with ldd or run the example:

(rosco-env) ian_ammerman@Dell-Laptop:~$ ldd libzmq ldd: ./libzmq: No such file or directory

Note that the same result is observed with ldd libzmq3 and libzmq3-dev as well in the ldd command.

I notice in the FORTRAN you linked reference to PkgConfig. Earlier I was compiling just the controller following steps in 2.2.3 with CMake (I deleted everything and restarted before steps above). The following error was given when running the cmake .. command

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)

Might this be relevant?

gbarter commented 9 months ago

If you are building within a conda environment, it is best to do: conda install pkg-config.

@dzalkind : If that is the issue. We should probably add pkg-config to the environment file.

Ian-Ammerman commented 9 months ago

@gbarter Thank you for the input - I have had success by running sudo apt-get pkg-config after creating the environment but before running the ROSCO installation. I was then able to compile and run example 17a and 17b.

gbarter commented 9 months ago

Glad to hear it!

fredrikfselheim commented 9 months ago

Hi. I'm experiencing the same issue as Ian did, the zeromq client not being properly installed. However, I'm working with MacOS arm64 architecture and are therefore not able to run the sudo apt-get pkg-config. Also the pip install -e . command does not run successfully on my system (wisdem, meson.build error) and I've only been able to compile the DLL through running python setup.py develop. Would be great to get some input on how to deal with this!

gbarter commented 9 months ago

On a Mac, you would do conda install zeromq pyzmq pkg-config. If you are trying to install system-wide, then you could do brew install pkg-config and brew install zeromq or an equivalent for Macports if that is your custom.

I am also confused by your meson error as ROSCO doesn't use meson. Are you building WISDEM from source too? If you are more interested in ROSCO, please do conda install wisdem. If you are having trouble building WISDEM from source, please see the WISDEM repo.

fredrikfselheim commented 9 months ago

Yes I have done the conda install zeromq pyzmq pkg-config, and also brew install pkg-config and brew install zeromq. I have been struggling a lot with this the past few days and tried many different approaches after googling around. I have build wisdem from source by conda install wisdem, as pip install wisdem gives me same error as in pip install -e .. That is why I went for the python setup.py develop for both wisdem and rosco. Btw I have tried this several times in both conda base and rosco-env with python=3.10, 3.9, 3.11 and 3.12. When running pip install wisdem I get the following error message: (ROSCO_ARMTest2) fredrikfleslandselheim@host-0800-c4910cb0fd22 ROSCO % pip install wisdem
Collecting wisdem Using cached wisdem-3.13.0.tar.gz (5.4 MB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [23 lines of output] ['/private/var/folders/_j/v3f4kf2n3cx74jmz1_c4q0z40000gn/T/pip-build-env-q7er7ju1/overlay/bin/meson', 'setup', 'meson_build', '--wipe', '--prefix=/private/var/folders/_j/v3f4kf2n3cx74jmz1_c4q0z40000gn/T/pip-install-cz6e_emv/wisdem_86ff8389aaed499d9fb1a1be1b3b43f7/meson_build', '-Dpython.purelibdir=.', '-Dpython.platlibdir=.']

  ERROR: Neither source directory 'meson_build' nor build directory None contain a build file meson.build.

  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/private/var/folders/_j/v3f4kf2n3cx74jmz1_c4q0z40000gn/T/pip-build-env-q7er7ju1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/private/var/folders/_j/v3f4kf2n3cx74jmz1_c4q0z40000gn/T/pip-build-env-q7er7ju1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/_j/v3f4kf2n3cx74jmz1_c4q0z40000gn/T/pip-build-env-q7er7ju1/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 102, in <module>
    File "<string>", line 62, in run_meson_build
  OSError: [Errno ['/private/var/folders/_j/v3f4kf2n3cx74jmz1_c4q0z40000gn/T/pip-build-env-q7er7ju1/overlay/bin/meson', 'setup', 'meson_build', '--wipe', '--prefix=/private/var/folders/_j/v3f4kf2n3cx74jmz1_c4q0z40000gn/T/pip-install-cz6e_emv/wisdem_86ff8389aaed499d9fb1a1be1b3b43f7/meson_build', '-Dpython.purelibdir=.', '-Dpython.platlibdir=.']] The meson setup command failed! Check the log at meson_build/setup.log for more information.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

gbarter commented 9 months ago

I think your conda environment is likely confused with having simultaneous pip install and conda install packages. Taking a closer look at the installation instructions, I think this is our fault and not your fault. Here is my recommendation on a fresh start that should give you a ROSCO package that is built from source on Mac ARM:

conda config --add channels conda-forge
conda env create --name rosco-env -f https://raw.githubusercontent.com/NREL/ROSCO/master/environment.yml python=3.11
conda activate rosco-env
conda install -y git compilers
git clone https://github.com/NREL/ROSCO.git
cd ROSCO
pip install -e . -v

@dzalkind - I think the install instructions are a bit stale. Can we add this to our to-do list? Perhaps it would be best to add something to the README too?

fredrikfselheim commented 9 months ago

Yes, thank you! I fresh start would definitely not hurt.

I get this when running your second command: rosco-env -f https://raw.githubusercontent.com/NREL/ROSCO/master/environment.yml python=3.11

SpecNotFound: Invalid name 'python=3.11', try the format: user/package

abhineet-gupta commented 9 months ago

Hi Fredrik, The following commands work on an m1 mac. I installed some common dependencies using conda to avoid any system level conflict. Could you try the following too?

conda create -n RoscoNewInstall python=3.10
conda activate RoscoNewInstall
conda install wisdem pyzmq pkg-config openfast compilers
git clone https://github.com/NREL/ROSCO.git
cd ROSCO/
pip install -e .
cd Examples/
python ./17b_zeromq_multi_openfast.py 
gbarter commented 9 months ago

Yes, thank you! I fresh start would definitely not hurt.

I get this when running your second command: rosco-env -f https://raw.githubusercontent.com/NREL/ROSCO/master/environment.yml python=3.11

SpecNotFound: Invalid name 'python=3.11', try the format: user/package

Sorry about that, just remove the python=3.11 from the command

fredrikfselheim commented 9 months ago

Hi Abhineet Thank you for responding. I'm afraid this gave me the same error as earlier for pip install -e . See TerminalLog.pdf for details.

fredrikfselheim commented 9 months ago

conda config --add channels conda-forge conda env create --name rosco-env -f https://raw.githubusercontent.com/NREL/ROSCO/master/environment.yml python=3.11 conda activate rosco-env conda install -y git compilers git clone https://github.com/NREL/ROSCO.git cd ROSCO pip install -e . -v

Sorry to say that the error with meson setup command and requirements to build wheel fails again. Please check the TerminalLog2.pdf for details if you'd like.

gbarter commented 9 months ago

Can you confirm that you have activated the rosco-env conda environment? It isn't installing WISDEM from conda and trying to do it from pip instead.

fredrikfselheim commented 9 months ago

Yes I have rosco-env activated when running pip install -e . -v

gbarter commented 9 months ago

And what happens when you do conda install wisdem?

dzalkind commented 9 months ago

It looks like the installation process keeps trying to install wisdem from cache via pip

Using cached wisdem-3.13.0.tar.gz (5.4 MB)
Running command pip subprocess to install build dependencies

Maybe try a python -m pip cache purge

Then conda install wisdem

Then reinstall rosco with pip install -e .

fredrikfselheim commented 9 months ago

Hi Dan, thanks for responding! It still gave me the error TerminalLog3.pdf I did python -m pip cache purge conda install wisdem pip install -e . and I tried python -m pip cache purge conda remove wisdem conda install wisdem pip install -e .

gbarter commented 9 months ago

It actually looks like pip isn't seeing any of the conda packages. With wisdem now installed, try python setup.py develop

gbarter commented 9 months ago

Another option would be pip install --no-deps -e . -v

dzalkind commented 9 months ago

@gbarter, why does wisdem need to be here and in the environment yaml?

gbarter commented 9 months ago

@gbarter, why does wisdem need to be here and in the environment yaml?

The idea is to support both a pure-conda workflow and a pure-pip workflow. The conda one is generally more robust and pip is supposed to respect conda packages (which isn't working here). Clearly, the wisdem pypi package for Mac ARM also isn't working. I'm confident that we can figure these problems out and specify a good recipe in the documentation. More items for the to-do list for sure.

Another suggestion is to more prominently encourage simply conda install rosco as the only needed step and then work from there. I think this is deep in the instructions currently.

dzalkind commented 9 months ago

Some notes based on a debugging session with Frederik:

fredrikfselheim commented 9 months ago

Hi guys,

I now finally got it right! Thank you all for helping.

This is the approach that worked for me, if perhaps you’d like to know. First of all deleting the rosco folder and rosco-env to get a fresh start.

conda config --add channels conda-forge conda env create --name rosco-env -f https://raw.githubusercontent.com/NREL/ROSCO/master/environment.yml conda activate rosco-env conda install -y git compilers conda install wisdem zeromq pyzmq pkg-config openfast compilers git clone https://github.com/NREL/ROSCO.git cd ROSCO python import rosco.toolbox

deleting wisdem from dependencies in pyproject.toml pip install -e .

Again, thank you guys! Have a great weekend

Best, Fredrik

Fra: dzalkind @.> Dato: fredag, 16. februar 2024 kl. 14:41 Til: NREL/ROSCO @.> Kopi: fredrikfselheim @.>, Comment @.> Emne: Re: [NREL/ROSCO] ZeroMQ client not properly installed | Example 17 (Issue #313)

Some notes based on a debugging session with Frederik:

conda env create --name rosco-env -f https://raw.githubusercontent.com/NREL/ROSCO/master/environment.yml

conda install wisdem pyzmq pkg-config openfast compilers

Seemed to get us there. We stopped when Frederik had other path issues related to odd file structure. I suggested re-cloning and following the above steps.

— Reply to this email directly, view it on GitHubhttps://github.com/NREL/ROSCO/issues/313#issuecomment-1949215390, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFZGMTXC4HY2JUMBJGQNKVDYT6Y65AVCNFSM6AAAAABDB6DHG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBZGIYTKMZZGA. You are receiving this because you commented.Message ID: @.***>