PyBaMM
PyBaMM copied to clipboard
[Bug]: on installation, "No Module named 'CMakeBuild'"
PyBaMM Version
latest
Python Version
3.8.9
Describe the bug
I am trying to install PyBaMM on Mac OS. Running
-> brew install sundials && pip3 install pybamm
gives the error
"ModuleNotFoundError: No module named 'CMakeBuild'".
This is after succesfful install / update to sundials and during the attempt to install pybamm itself. Any advice or guidance on how to get pybamm installed would be much appreciated.
Steps to Reproduce
In terminal on Mac OSx 12.2 running Python 3.8 issue "brew install sundials && pip3 install pybamm".
Relevant log output
ModuleNotFoundError: No module named 'CMakeBuild'
Hi @khurlbutt, can you please post your full log output?
@martinjrobins it begins below (as a reminder, I issued "brew install sundials && pip3 install pybamm")
###BEGIN OUTPUT### ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae Updated 1 formula.
Warning: sundials 6.2.0 is already installed and up-to-date. To reinstall 6.2.0, run: brew reinstall sundials Defaulting to user installation because normal site-packages is not writeable Collecting pybamm Using cached pybamm-22.4.tar.gz (908 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy>=1.16 in ./Library/Python/3.8/lib/python/site-packages (from pybamm) (1.22.2) Requirement already satisfied: scipy>=1.3 in ./Library/Python/3.8/lib/python/site-packages (from pybamm) (1.8.0) Collecting pandas>=0.24 Using cached pandas-1.4.2-cp38-cp38-macosx_11_0_arm64.whl (9.9 MB) Collecting anytree>=2.4.3 Using cached anytree-2.8.0-py2.py3-none-any.whl (41 kB) Collecting autograd>=1.2 Using cached autograd-1.4-py3-none-any.whl (48 kB) Collecting scikit-fem>=0.2.0 Using cached scikit_fem-6.0.0-py3-none-any.whl (144 kB) Collecting pybamm Using cached pybamm-22.3.tar.gz (907 kB) Preparing metadata (setup.py) ... done Using cached pybamm-22.2.tar.gz (907 kB) Preparing metadata (setup.py) ... done Using cached pybamm-22.1.tar.gz (906 kB) Preparing metadata (setup.py) ... done Using cached pybamm-21.12.tar.gz (907 kB) Preparing metadata (setup.py) ... done Using cached pybamm-21.11.tar.gz (901 kB) Preparing metadata (setup.py) ... done Using cached pybamm-21.10.tar.gz (897 kB) Preparing metadata (setup.py) ... done Using cached pybamm-21.9.tar.gz (894 kB) Preparing metadata (setup.py) ... done Using cached pybamm-21.8.post2.tar.gz (890 kB) Preparing metadata (setup.py) ... done Using cached pybamm-21.8.post1.tar.gz (888 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details. ###END OUTPUT###
It looks like you have one of the newer apple M1 CPUs? If so we don't support these yet via installation from PyPI. I would recommend that you try installing from source, using the instructions here: https://pybamm.readthedocs.io/en/latest/install/install-from-source.html
OK, thanks for that @martinjrobins. Issuing the final command "python3 setup.py install" gives the error below. Note that the other suggested methods of install, tox and pip, also give errors; I can include those as necessary. Thanks for your help.
cmake version 3.22.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
running install
/redacted/Library/Python/3.8/lib/python/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
running build_ext
---------- Running CMake for idaklu solver ----------------------------------------
-- pybind11 v2.10.0 dev1
Traceback (most recent call last):
File "
casadiConfig.cmake
casadi-config.cmake
Add the installation prefix of "casadi" to CMAKE_PREFIX_PATH or set "casadi_DIR" to a directory containing one of the above files. If "casadi" provides a separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred! See also "/redacted/pybamm/PyBaMM/build/temp.macosx-10.14-arm64-3.8/CMakeFiles/CMakeOutput.log". ---------- Building idaklu module ---------------------------------------- make: Makefile: No such file or directory make: *** No rule to make target `Makefile'. Stop. error: can't copy '/redacted/PyBaMM/build/temp.macosx-10.14-arm64-3.8/idaklu.cpython-38-darwin.so': doesn't exist or not a regular file
its not finding casadi in your python environment. Can you try pip install casadi
before you run this command
another option if you don't need the idaklu solver is to delete the pybind11
directory, that way it will skip building the idaklu solver which is where you are getting the error
Has this been solved?
Is this still open?
We'll close it since we haven't heard back in a while