-
-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
478 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
We recommend the use of Windows Subsystem for Linux (WSL) to install PyBaMM, see the | ||
instructions below to get PyBaMM working using Windows, WSL and VSCode. | ||
|
||
## Install WSL | ||
|
||
Follow the instructions from Microsoft | ||
[here](https://docs.microsoft.com/en-us/windows/wsl/install-win10). When given the | ||
option, choose the Ubuntu 18.04 LTS distribution to install. Don't forget to initialise | ||
the Ubuntu installation using the instructions given | ||
[here](https://docs.microsoft.com/en-us/windows/wsl/initialize-distro). | ||
|
||
## Install PyBaMM | ||
|
||
Open a terminal window in your installed Ubuntu distribution by selecting "Ubuntu" from | ||
the start menu. This should give you a bash prompt in your home directory. | ||
|
||
To download the PyBaMM source code, you first need to install git, which you can do by | ||
typing | ||
|
||
```bash | ||
sudo apt install git-core | ||
``` | ||
|
||
For easier integration with WSL, we recommend that you install PyBaMM in your *Windows* | ||
Documents folder, for example by first navigating to | ||
|
||
```bash | ||
$ 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 | ||
``` | ||
|
||
This will create a new directly called `PyBaMM`, you can move to this directory in bash | ||
using the `cd` command: | ||
|
||
```bash | ||
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-MAC.md). | ||
|
||
## Use Visual Studio Code to run PyBaMM | ||
|
||
You will probably want to use a native Windows IDE such as Visual Studio Code or the | ||
full Microsoft Visual Studio IDE. Both of these packages can connect to WSL so that you | ||
can write python code in a native windows environment, while at the same time using WSL | ||
to run the code using your installed Ubuntu distribution. The following instructions | ||
assume that you are using Visual Studio Code. | ||
|
||
First, setup VSCode to run within the `PyBaMM` directory that you created above, using | ||
the instructions provided [here](https://code.visualstudio.com/docs/remote/wsl). | ||
|
||
Once you have opened the `PyBaMM` folder in vscode, use the `Extensions` panel to | ||
install the `Python` extension from Microsoft. Note that extensions are either installed | ||
on the Windows (Local) or on in WSL (WSL:Ubuntu), so even if you have used VSCode | ||
previously with the Python extension, you probably haven't installed it in WSL. Make | ||
sure to reload after installing the Python extension so that it is available. | ||
|
||
If you have installed PyBaMM into the virtual environment `env` as in the PyBaMM linux | ||
install guide, then VSCode should automatically start using this environment and you | ||
should see something similar to "Python 3.6.8 64-bit ('env': venv)" in the bottom bar. | ||
|
||
To test that vscode can run a PyBaMM script, navigate to the `examples/scripts` folder | ||
and right click on the `create-model.py` script. Select "Run current file in Python | ||
Interactive Window". This should run the script, which sets up and solves a model of SEI | ||
thickness using PyBaMM. You should see a plot of SEI thickness versus time pop up in the | ||
interactive window. | ||
|
||
The Python Interactive Window in VSCode can be used to view plots, but is restricted in | ||
functionality and cannot, for example, launch separate windows to show plot. To setup an | ||
xserver on windows and use this to launch windows for plotting, follow these | ||
instructions: | ||
|
||
1. Install VcXsrv from [here](https://sourceforge.net/projects/vcxsrv/). | ||
1. Set the display port in the WSL command-line: `echo "export DISPLAY=localhost:0.0" >> | ||
~/.bashrc` | ||
1. Install python3-tk in WSL: `sudo apt-get install python3-tk` | ||
1. Set the matplotlib backend to TKAgg in WSL: `echo "backend : TKAgg" >> | ||
~/.config/matplotlib/matplotlibrc` | ||
1. Before running the code, just launch XLaunch (with the default settings) from within | ||
Windows. Then the code works as usual. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,54 @@ | ||
We recommend the use of Windows Subsystem for Linux (WSL) to install PyBaMM, see the | ||
instructions below to get PyBaMM working using Windows, WSL and VSCode. | ||
## Prerequisites | ||
|
||
## Install WSL | ||
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). | ||
|
||
Follow the instructions from Microsoft | ||
[here](https://docs.microsoft.com/en-us/windows/wsl/install-win10). When given the | ||
option, choose the Ubuntu 18.04 LTS distribution to install. Don't forget to initialise | ||
the Ubuntu installation using the instructions given | ||
[here](https://docs.microsoft.com/en-us/windows/wsl/initialize-distro). | ||
To install Python 3 download the installation files from [Python's website](https://www.python.org/downloads/windows/). Make sure | ||
to tick the box on `Add Python 3.X to PATH`. For more detailed instructions please see the | ||
[official Python on Windows guide](https://docs.python.org/3.7/using/windows.html). | ||
|
||
## Install PyBaMM | ||
|
||
Open a terminal window in your installed Ubuntu distribution by selecting "Ubuntu" from | ||
the start menu. This should give you a bash prompt in your home directory. | ||
### User install | ||
Launch the Command Prompt and go to the directory where you want to install PyBaMM. You can find a reminder of how to | ||
navigate the terminal [here](http://www.cs.columbia.edu/~sedwards/classes/2015/1102-fall/Command%20Prompt%20Cheatsheet.pdf). | ||
|
||
To download the PyBaMM source code, you first need to install git, which you can do by | ||
typing | ||
We recommend to install PyBaMM within a virtual environment, in order not | ||
to alter any distribution python files. | ||
|
||
```bash | ||
sudo apt install git-core | ||
``` | ||
|
||
For easier integration with WSL, we recommend that you install PyBaMM in your *Windows* | ||
Documents folder, for example by first navigating to | ||
To create a virtual environment `env` within your current directory type: | ||
|
||
```bash | ||
$ cd /mnt/c/Users/USER_NAME/Documents | ||
python -m venv env | ||
``` | ||
|
||
where USER_NAME is your username. Exact path to Windows documents may vary. Now use git to clone the PyBaMM repository: | ||
You can then "activate" the environment using: | ||
|
||
```bash | ||
git clone https://github.com/pybamm-team/PyBaMM.git | ||
env\Scripts\activate.bat | ||
``` | ||
Now all the calls to pip described below will install PyBaMM and its dependencies into | ||
the environment `env`. When you are ready to exit the environment and go back to your | ||
original system, just type: | ||
|
||
This will create a new directly called `PyBaMM`, you can move to this directory in bash | ||
using the `cd` command: | ||
|
||
```bash | ||
cd PyBaMM | ||
```bash | ||
deactivate | ||
``` | ||
|
||
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-MAC.md). | ||
|
||
## Use Visual Studio Code to run PyBaMM | ||
|
||
You will probably want to use a native Windows IDE such as Visual Studio Code or the | ||
full Microsoft Visual Studio IDE. Both of these packages can connect to WSL so that you | ||
can write python code in a native windows environment, while at the same time using WSL | ||
to run the code using your installed Ubuntu distribution. The following instructions | ||
assume that you are using Visual Studio Code. | ||
|
||
First, setup VSCode to run within the `PyBaMM` directory that you created above, using | ||
the instructions provided [here](https://code.visualstudio.com/docs/remote/wsl). | ||
|
||
Once you have opened the `PyBaMM` folder in vscode, use the `Extensions` panel to | ||
install the `Python` extension from Microsoft. Note that extensions are either installed | ||
on the Windows (Local) or on in WSL (WSL:Ubuntu), so even if you have used VSCode | ||
previously with the Python extension, you probably haven't installed it in WSL. Make | ||
sure to reload after installing the Python extension so that it is available. | ||
PyBaMM can be installed via pip: | ||
```bash | ||
pip install pybamm | ||
``` | ||
|
||
If you have installed PyBaMM into the virtual environment `env` as in the PyBaMM linux | ||
install guide, then VSCode should automatically start using this environment and you | ||
should see something similar to "Python 3.6.8 64-bit ('env': venv)" in the bottom bar. | ||
PyBaMM's dependencies (such as `numpy`, `scipy`, etc) will be installed automatically when you install PyBaMM using `pip`. | ||
|
||
To test that vscode can run a PyBaMM script, navigate to the `examples/scripts` folder | ||
and right click on the `create-model.py` script. Select "Run current file in Python | ||
Interactive Window". This should run the script, which sets up and solves a model of SEI | ||
thickness using PyBaMM. You should see a plot of SEI thickness versus time pop up in the | ||
interactive window. | ||
For an introduction to virtual environments, see (https://realpython.com/python-virtual-environments-a-primer/). | ||
|
||
The Python Interactive Window in VSCode can be used to view plots, but is restricted in | ||
functionality and cannot, for example, launch separate windows to show plot. To setup an | ||
xserver on windows and use this to launch windows for plotting, follow these | ||
instructions: | ||
## Uninstall PyBaMM | ||
PyBaMM can be uninstalled by running | ||
```bash | ||
pip uninstall pybamm | ||
``` | ||
in your virtual environment. | ||
|
||
1. Install VcXsrv from [here](https://sourceforge.net/projects/vcxsrv/). | ||
1. Set the display port in the WSL command-line: `echo "export DISPLAY=localhost:0.0" >> | ||
~/.bashrc` | ||
1. Install python3-tk in WSL: `sudo apt-get install python3-tk` | ||
1. Set the matplotlib backend to TKAgg in WSL: `echo "backend : TKAgg" >> | ||
~/.config/matplotlib/matplotlibrc` | ||
1. Before running the code, just launch XLaunch (with the default settings) from within | ||
Windows. Then the code works as usual. | ||
## Installation using WSL | ||
If you want to install the optional PyBaMM solvers, you have to use the Windows Subsystem for Linux (WSL). You can find | ||
the installation instructions [here](INSTALL-WINDOWS-WSL.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.