OpenMDAO / build_pyoptsparse

python script to build/install pyoptsparse with IPOPT (and optionally SNOPT)
Apache License 2.0
9 stars 15 forks source link

Fall back to building source if conda install fails #39

Closed tadkollar closed 1 year ago

tadkollar commented 2 years ago

Not all conda packages are available for all platforms. If a conda installation fails, attempt to build the package from source.

One problem is that build_pyoptsparse make have skipped some compiler sanity checks if it was expecting to use conda to install everything. A way to address this is to fall back only if a --allow-build-fallback switch is invoked.

swryan commented 2 years ago

I think a related issue is that the script should probably check that conda-forge is in the available channels... The trace that occurs currently when it is not in channels is not particularly helpful:

FOUND: g++ is /usr/bin/g++
    sys.exit(perform_install())
  File "/usr/share/miniconda/envs/test/lib/python3.10/site-packages/build_pyoptsparse.py", line 1118, in perform_install
    install_with_mumps()
  File "/usr/share/miniconda/envs/test/lib/python3.10/site-packages/build_pyoptsparse.py", line 639, in install_with_mumps
    install_conda_pkg('mumps')
  File "/usr/share/miniconda/envs/test/lib/python3.10/site-packages/build_pyoptsparse.py", line 403, in install_conda_pkg
    run_conda_cmd(cmd_args=install_args)
  File "/usr/share/miniconda/envs/test/lib/python3.10/site-packages/build_pyoptsparse.py", line 372, in run_conda_cmd
    run_cmd(cmd_list)
  File "/usr/share/miniconda/envs/test/lib/python3.10/site-packages/build_pyoptsparse.py", line 335, in run_cmd
    subprocess.run(cmd_list, check=do_check)
  File "/usr/share/miniconda/envs/test/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['conda', 'install', '-y', 'mumps']' returned non-zero exit status 1.
FOUND: gfortran is /usr/bin/gfortran
FOUND: pip is /usr/share/miniconda/envs/test/bin/pip
FOUND: swig is /usr/bin/swig
Changed directory to /tmp/tmpqj9r9y9_
Testing gcc...
Testing g++...
Testing gfortran...
Changed directory back to /home/runner/work/Aviary/Aviary
---------------------------- Beginning installation ---------------------------
Installing METIS with conda...
Installing MUMPS with conda...
Error: Process completed with exit code 1.

see https://github.com/swryan/Aviary/actions/runs/3291794511/jobs/5426389267