udacity / CarND-MPC-Project

CarND Term 2 Model Predictive Control (MPC) Project
MIT License
280 stars 1.2k forks source link

iPopt Homebrew Installation doesn't work #24

Closed SvenKratz closed 6 years ago

SvenKratz commented 6 years ago

When trying to get the ipopt version provided by the repository I get the following error:

 svenkratz$ brew tap udacity/CarND-MPC-Project https://github.com/udacity/CarND-MPC-Project
==> Tapping udacity/carnd-mpc-project
Cloning into '/usr/local/Homebrew/Library/Taps/udacity/homebrew-carnd-mpc-project'...
remote: Counting objects: 1747, done.
remote: Compressing objects: 100% (1397/1397), done.
remote: Total 1747 (delta 294), reused 1738 (delta 294), pack-reused 0
Receiving objects: 100% (1747/1747), 2.46 MiB | 2.17 MiB/s, done.
Resolving deltas: 100% (294/294), done.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/udacity/homebrew-carnd-mpc-project/mumps.rb
Calling 'depends_on :mpi' is disabled!
Use 'depends_on "open-mpi"' instead.
/usr/local/Homebrew/Library/Taps/udacity/homebrew-carnd-mpc-project/mumps.rb:35:in `<class:Mumps>'
Please report this to the udacity/carnd-mpc-project tap!
Or, even better, submit a PR to fix it!
Error: Cannot tap udacity/carnd-mpc-project: invalid syntax in tap!
huynguyen commented 6 years ago

This is super hacky, but I patched the formula so the dependency is installable. See https://github.com/huynguyen/CarND-MPC-Project/blob/0a7d56fcb55261a5a4684b800c8c5206503c3f66/mumps.rb

You can either clone the repo or apply the diff to mumps.rb in you repo. Afterwords instead of tapping just install the deps directly via.

brew install mumps.rb
brew install ipopt.rb --with-openblas
SvenKratz commented 6 years ago

I can confirm that huynguyen's solution works. (Mac OS 10.13.4, Homebrew 1.6.1-git 656d6)

yufeiliubrown commented 6 years ago

I had the exact same error, and after cloning huynguyen's repo and runL

brew install mumps.rb

I got this error:

Error: Calling 'depends_on :mpi' is disabled! Use 'depends_on "open-mpi"' instead. /usr/local/Homebrew/Library/Homebrew/dependency_collector.rb:95:in `parse_spec' Or, even better, submit a PR to fix it!

Any idea why it does not work for me?

huynguyen commented 6 years ago

@yufeiliubrown if you are using my repo and get that error, it is likely you are using the wrong branch. Try:

git checkout huy/workaround-homebrew-mumps-errors

My version explicitly does use open-mpi. https://github.com/huynguyen/CarND-MPC-Project/blob/0a7d56fcb55261a5a4684b800c8c5206503c3f66/mumps.rb#L35

yufeiliubrown commented 6 years ago

@huynguyen Using the new patch, I can install mumps.rb. However, when I try to install ipopt.rb, I got this error:

Error: No available formula with the name "/usr/local/opt/mumps/.brew/mumps.rb"

huynguyen commented 6 years ago

@yufeiliubrown I'm not sure, it sounds like something didn't go right with your mumps install. You should post the full log of the commands you are executing along with the output.

Also: brew info mumps

yufeiliubrown commented 6 years ago

@huynguyen Here is my brew info mumps result:

brewsci/science/mumps: stable 5.1.1 Parallel Sparse Direct Solver http://mumps-solver.org /usr/local/Cellar/mumps/5.1.1_1 (63 files, 15.2MB) * Built from source on 2018-04-21 at 16:33:27 From: https://github.com/brewsci/homebrew-science/blob/master/Formula/mumps.rb ==> Dependencies Required: veclibfort ✔, gcc ✔, scalapack ✔ Recommended: open-mpi ✔ Optional: openblas ✔, parmetis ✔, scotch5 ✘, scotch ✘ ==> Options --with-openblas Build with openblas support --with-parmetis Build with parmetis support --with-scotch Build with scotch support --with-scotch5 Build with scotch5 support --without-open-mpi Build without open-mpi support ==> Caveats MUMPS was built with shared libraries. If required, static libraries are available in /usr/local/opt/mumps/libexec/lib

I also run brew reinstall mumps.rb, and the output is:

==> Reinstalling mumps ==> Downloading http://mumps.enseeiht.fr/MUMPS_5.1.1.tar.gz Already downloaded: /Users/yufeiliu/Library/Caches/Homebrew/mumps-5.1.1.tar.gz ==> make alllib LIBEXT=.dylib AR=gfortran -dynamiclib -Wl,-installname -Wl,/usr/local/Cellar/mu ==> make alllib RANLIB=echo OPTF=-O CDEFS=-DAdd ORDERINGSF=-Dpord CC=clang -fPIC FC=gfortran -f ==> Caveats MUMPS was built with shared libraries. If required, static libraries are available in /usr/local/opt/mumps/libexec/lib You built a sequential MUMPS library. Please add /usr/local/opt/mumps/libexec/include to the include path when building software that depends on MUMPS. ==> Summary 🍺 /usr/local/Cellar/mumps/5.1.1_1: 63 files, 15.2MB, built in 1 minute 47 seconds

FurqanHabibi commented 6 years ago

I applied @huynguyen's patch above to my freshly forked repository. Anyone can use it to install ipopt like so:

brew tap FurqanHabibi/CarND-MPC-Project https://github.com/FurqanHabibi/CarND-MPC-Project
brew install ipopt --with-openblas

All credit goes to @huynguyen for the mumps patch.

yufeiliubrown commented 6 years ago

After fixing brew doctor warnings, I got a new error:

dynamiclib: No such file or directory

For anyone having the same problem, the solution is in

https://github.com/brewsci/homebrew-science/issues/166

yufeiliubrown commented 6 years ago

Basically, there is no need to patch the formula, all it needs is to use dpo/homebrew-openblas tap instead of brewsci/homebrew-science tap.

mvirgo commented 6 years ago

@huynguyen Do you want to make a pull request with your patch on mumps.rb and I will merge it here?

huynguyen commented 6 years ago

@mvirgo yea I can put something together, the only part I'm unsure of is where I manually set the compiler to gfortran.

It seems safe though because even the repo @yufeiliubrown linked does it https://github.com/dpo/homebrew-openblas/blob/d86f1fbc152ccad632ba02be40ab251f8ca1ee31/mumps.rb#L31

sandyleo26 commented 6 years ago

This works for me. https://github.com/udacity/CarND-MPC-Project/issues/34#issuecomment-412305069