question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mac OS Sundials bug

See original GitHub issue

Descirbe the bug scikits.odes does not work (“image not found”) when following installation instructions

Explanation As I understand it the problem is that scikits.odes looks for libsundials_sunlinsolklu.3.dylib, but brew install sundials installs a more recent version, which only has

libsundials_sunlinsolklu.dylib
libsundials_sunlinsollapackband.3.5.0.dylib

so libsundials_sunlinsolklu.3.dylib cannot be found.

This is not caught by the Mac OS tests since in CI the Mac OS tests use the script install_KLU_Sundials.py

Furthermore, if installing locally, with tox -e pybamm-requires, the script is used (which installs the correct version of sundials) but only LD_LIBRARY_PATH is updated, and not DYLD_LIBRARY_PATH as should be the case for mac. This means that scikits.odes is still looking in /usr/local/opt/ for sundials, where it finds the incorrect brew installation, instead of in ~/.local/lib

** Solution **

  • Remove the requirement for brew install sundials from docs
  • Use the KLU script to install sundials on mac, and also update DYLD_LIBRARY_PATH

This could also be an opportunity to clean up the install docs, which I still find a little bit confusing

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
tlestangcommented, Jan 4, 2021

Hi @shday and @tinosulzer, I sense there is a bit of confusion here, which I hope I can clear.

Short answer

If you’re on MacOS, you must install the sundials library yourself. There are several ways to do that, but the most straightforward is to use Homebrew, following the instructions available here. I suggest you give it a try and tell us the result.

Longer answer:

Whenever you type pip install pybamm, pip fetches the PyBaMM package from the Python Package Index (PyPI). However, pip does not download all python files one by one, but rather an archive that contains the PyBaMM’s source code, some metadata and compiled modules, like the idaklu module. Indeed, if you look into PyBaMM’s sources, you’ll find that the idaklu module is actually written in C++, and must therefore be compiled before being available for import. As a user, you don’t have to do that yourself though because the module was compiled by us before hand, and the resulting idaklu.cpython-38-darwin.so file is included in the archive pip downloads and installs. However, the idaklu module has a runtime dependency on the sundials library, that must be available (in the form of a shared library) on your system when you import the module. For GNU/Linux systems, the compiled version of sundials is also included in the archive pip downloads, therefore a pip install pybamm is all that is required to get everything running. On Mac however, the compiled sundials is not included in that archive, and therefore users must install sundials themselves. Thanks to Homebrew, that’s just another short command.

Now, you could also choose to clone the PyBaMM repo and install pybamm from that instead of the archive available on PyPI. This would be a good choice if you wanted to e.g. modify/contribute to PyBaMM. In this case however, you don’t benefit from the pre-compiled modules and dependencies, and you’ll have to do it yourself. As you’ve noticed already, the PyBaMM repo contains a python script that automatically downloads, compile and install the sundials library (install_KLU_Sundials.py). The idaklu module is automatically compiled when you invoke pip on the PyBaMM repo. The compilation and installation of PyBaMM from the repo is described here.

I hope that’s helpful - both in practice as well as to help understand the different moving parts. Please let us know if youŕe confused by the installations instructions: we’re about to refine them to hopefully make them clearer, and any feedback is useful.

0reactions
tinosulzercommented, Feb 1, 2021

I’m not sure how to help if you didn’t use a virtual environment. Could you try again using a virtual environment?

Read more comments on GitHub >

github_iconTop Results From Across the Web

#57358 (sundials @3.1.2_1: ERROR: FFLAGS='-pipe -Os' and ...
I have sundials 2.8_1 installed, and I attempted to upgrade to 2.9_0. First it reported this: ---> Configuring sundials Error: mpich-default has a...
Read more >
bug #59985, WARNING: SUNDIALS NVECTOR serial...
Status: Invalid, Assigned to: None ; Originator Name: Open/Closed: *, Closed ; Release: *, dev, Operating System: *, Mac OS.
Read more >
Hash Mismatch on Latest Sundials - Julia Discourse
It's a pretty big issue with MacOS because that means BinaryProvider.jl installations can never smoothly update on MacOS. At least in the ...
Read more >
Download SUNDIALS Software - Computing
Version Date Size SUNDIALS v6.4.0 2022‑10‑21 85.10 MB SUNDIALS v6.3.0 2022‑08‑10 84.50 MB SUNDIALS v6.2.0 2022‑04‑22 78.60 MB
Read more >
Installation — Odes 2.6.4 documentation
A typical install if sundials download package is extracted into directory sundials-5.1.0, with LAPACK included is on a *nix system:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found