Skip to content

Commit

Permalink
Merge pull request #680 from pybamm-team/issue-646-install
Browse files Browse the repository at this point in the history
Issue 646 install
  • Loading branch information
valentinsulzer committed Feb 12, 2020
2 parents bd3b2ef + c477420 commit b3d90d7
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ matrix:
env:
- PYTHON=3.7.4
- PYBAMM_UNIT=true
- PYBAMM_KLU=true
if: type != cron
- python: "3.7"
addons:
Expand Down Expand Up @@ -177,6 +178,8 @@ before_install: |
brew update;
# Per the `pyenv homebrew recommendations <https://github.com/yyuu/pyenv/wiki#suggested-build-environment>`_.
brew install graphviz openssl readline;
# Other brew packages
brew install gcc cmake openblas suitesparse;
# See https://docs.travis-ci.com/user/osx-ci-environment/#A-note-on-upgrading-packages.
brew outdated pyenv || brew upgrade pyenv
# virtualenv doesn't work without pyenv knowledge. venv in Python 3.3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
- Added missing temperature dependence in electrolyte and interface submodels ([#698](https://github.com/pybamm-team/PyBaMM/pull/698))
- Fixed differentiation of functions that have more than one argument ([#687](https://github.com/pybamm-team/PyBaMM/pull/687))
- Added warning if `ProcessedVariable` is called outside its interpolation range ([#681](https://github.com/pybamm-team/PyBaMM/pull/681))
- Updated installation instructions for Mac OS ([#680](https://github.com/pybamm-team/PyBaMM/pull/680))
- Improved the way `ProcessedVariable` objects are created in higher dimensions ([#581](https://github.com/pybamm-team/PyBaMM/pull/581))

## Breaking changes
Expand Down
29 changes: 25 additions & 4 deletions INSTALL-LINUX.md → INSTALL-LINUX-MAC.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Prerequisites

To use and/or contribute to PyBaMM, you must have Python 3.6 or above installed.
To use and/or contribute to PyBaMM, you must have Python 3.6 or 3.7 installed (note that 3.8 is not yet supported).

To install Python 3 on Debian-based distribution (Debian, Ubuntu, Linux mint), open a terminal and run
```bash
sudo apt update
Expand All @@ -10,6 +11,18 @@ On Fedora or CentOS, you can use DNF or Yum. For example
```bash
sudo dnf install python3
```
On Mac OS distributions, you can use `homebrew`.
First [install `brew`](https://docs.python-guide.org/starting/install3/osx/):

```bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

then follow instructions in link on adding brew to path, and run

```bash
brew install python3
```

## Install PyBaMM

Expand Down Expand Up @@ -46,11 +59,19 @@ For an introduction to virtual environments, see (https://realpython.com/python-
### Developer install

If you wish to contribute to PyBaMM, you should get the latest version from the GitHub repository.
To do so, you must have Git installed. For instance run
To do so, you must have Git and graphviz installed. For instance run

```bash
sudo apt install git
sudo apt install git graphviz
```
on Debian-based distributions.

on Debian-based distributions, or

```bash
brew install git graphviz
```

on Mac OS.

To install PyBaMM, the first step is to get the code by cloning this repository

Expand Down
8 changes: 4 additions & 4 deletions INSTALL-WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To download the PyBaMM source code, you first need to install git, which you can
typing

```bash
$ sudo apt install git-core
sudo apt install git-core
```

For easier integration with WSL, we recommend that you install PyBaMM in your *Windows*
Expand All @@ -31,21 +31,21 @@ $ cd /mnt/c/Users/USER_NAME/Documents
where USER_NAME is your username. Exact path to Windows documents may vary. Now use git to clone the PyBaMM repository:

```bash
$ git clone https://github.com/pybamm-team/PyBaMM.git
git clone https://github.com/pybamm-team/PyBaMM.git
```

This will create a new directly called `PyBaMM`, you can move to this directory in bash
using the `cd` command:

```bash
$ cd PyBaMM
cd PyBaMM
```

If you are unfamiliar with the linux command line, you might find it useful to work through this
[tutorial](https://tutorials.ubuntu.com/tutorial/command-line-for-beginners) provided by Ubuntu.

Now head over and follow the installation instructions for PyBaMM for linux
[here](INSTALL-LINUX.md).
[here](INSTALL-LINUX-MAC.md).

## Use Visual Studio Code to run PyBaMM

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ For further examples, see the list of repositories that use PyBaMM [here](https:

### Linux

For instructions on installing PyBaMM on Debian-based distributions, please see [here](INSTALL-LINUX.md)
For instructions on installing PyBaMM on Debian-based distributions, please see [here](INSTALL-LINUX-MAC.md)

### Mac OS

For instructions on installing PyBaMM on Mac OS distributions, please see [here](INSTALL-LINUX-MAC.md)

### Windows

Expand Down
3 changes: 2 additions & 1 deletion scripts/install_scikits_odes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ cmake -DLAPACK_ENABLE=ON -DSUNDIALS_INDEX_TYPE=int32_t -DBUILD_ARKODE:BOOL=OFF -
make install
cd $CURRENT_DIR
rm -rf $TMP_DIR
export LD_LIBRARY_PATH=$INSTALL_DIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$INSTALL_DIR/lib:$LD_LIBRARY_PATH # For Linux
export DYLD_LIBRARY_PATH=$INSTALL_DIR/lib:$DYLD_LIBRARY_PATH # For Mac
export SUNDIALS_INST=$INSTALL_DIR
pip install scikits.odes

12 changes: 9 additions & 3 deletions scripts/install_sundials_4.1.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ cmake -DBLAS_ENABLE=ON\
-DKLU_ENABLE=ON\
../sundials-4.1.0


NUM_OF_CORES=$(cat /proc/cpuinfo | grep processor | wc -l)
if [ "$(uname)" == "Darwin" ]; then
# Mac OS X platform
NUM_OF_CORES=$(sysctl -n hw.cpu)
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
# GNU/Linux platform
NUM_OF_CORES=$(cat /proc/cpuinfo | grep processor | wc -l)
fi
make clean
make -j$NUM_OF_CORES install
cd $CURRENT_DIR
rm -rf build-sundials-4.1.0
rm -rf sundials-4.1.0
export LD_LIBRARY_PATH=$INSTALL_DIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$INSTALL_DIR/lib:$LD_LIBRARY_PATH # For Linux
export DYLD_LIBRARY_PATH=$INSTALL_DIR/lib:$DYLD_LIBRARY_PATH # For Mac
export SUNDIALS_INST=$INSTALL_DIR

# get pybind11
Expand Down

0 comments on commit b3d90d7

Please sign in to comment.