You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: installation/README.md
+13-19
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Installation instructions
2
2
3
-
This book uses (mostly) Python 3.7 and numerous libraries that require installation. The first section covers how use Docker to pull an image that contains the necessary software and create a local container that allows you to run the notebooks without much further ado. The second section describes how to install the packages locally using the [Anaconda](https://www.anaconda.com/) distribution. If you are experienced and work a UNIX-based system, you can also create your own virtual environments and install the libraries required for different notebooks as needed. Then, we address how to work with [Jupyter](https://jupyter.org/) notebooks to view and execute the code examples. Finally, we list additional installation instructions for libraries that require non-python dependencies and discuss how to
3
+
This book uses (mostly) Python 3.7 and numerous libraries that require installation. The first section covers how use Docker to pull an image that contains the necessary software and create a local container that allows you to run the notebooks. The second section describes how to install the packages locally using the [Anaconda](https://www.anaconda.com/) distribution. If you are experienced and work a UNIX-based system, you can also create your own virtual environments and install the libraries required for different notebooks as needed.
4
+
5
+
Then, we address how to work with [Jupyter](https://jupyter.org/) notebooks to view and execute the code examples. Finally, we list additional installation instructions for libraries that require non-python dependencies and discuss how to
4
6
5
7
## Run the code using a Docker images
6
8
@@ -10,13 +12,13 @@ This book uses (mostly) Python 3.7 and numerous libraries that require installat
10
12
3.[Register](https://www.quandl.com/sign-up) for a (free) personal Quandl account to obtain an API key that you'll need in the next step.
11
13
3. We'll be using an image based on the Ubuntu 20.04 OS with the Anaconda Python distribution installed. It also contains two conda environments, one to run Zipline and one for everything else. The following command does several things at once:
docker run -it -v $(pwd):/home/packt/ml4t -p 8888:8888 -e QUANDL_API_KEY=<your API key> --name ml4t appliedai/packt:latest bash
14
16
```
15
-
- it pulls the image from the Docker Hub account `appliedai` and the repository `manning` with the tag `starter`
16
-
- creates a local container with the name `liveproject` and runs it in interactive mode,
17
-
- mounts the current directory containing the starter project files as a volume in the directory `/home/manning` inside the container,
17
+
- it pulls the image from the Docker Hub account `appliedai` and the repository `packt` with the tag `latest`
18
+
- creates a local container with the name `ml4t` and runs it in interactive mode,
19
+
- mounts the current directory containing the starter project files as a volume in the directory `/home/packt/ml4t` inside the container,
18
20
- sets the environment variable `QUANDL_API_KEY` with the value of your key (that you need to fill in for `<yourkey>`), and
19
-
- starts a `bash` terminal inside the container, resulting in a new command prompt.
21
+
- starts a `bash` terminal inside the container, resulting in a new command prompt for the user `packt`.
20
22
4. Now you are running a shell inside the container and can access the `conda environments`.
21
23
- Run `conda env list` to see that there are a `base`, `ml4t` (default), and a `ml4t-`zipline` environment.
22
24
- You can switch to another environment using `conda activate <env_name>`.
@@ -30,19 +32,12 @@ This book uses (mostly) Python 3.7 and numerous libraries that require installat
30
32
- You should see numerous messages as Zipline processes around 3,000 stock price series
31
33
5. Now we would like to test Zipline and the [juypter](https://jupyter.org/) setup. You can run notebooks using either the traditional or the more recent Jupyter Lab interface; both are available in all `conda` environments. Moreover, you start jupyter from the `base` environment and switch the environment from the notebook due to the `nb_conda_kernels` package (see [docs](https://github.com/Anaconda-Platform/nb_conda_kernels)). To get started, run one of the following two commands:
- There are also `alias` shortcuts for each so you don't have to type them: `nb` for the `jupyter notebook` version, and `lab` for the `jupyter lab` version.
36
39
- The terminal will display a few messages and at the end indicate what to paste into your browser to access the jupyter server from the current working directory.
37
-
6. To test Zipline, run the ```zipline_test.ipynb``` notebook. It contains the example from the Zipline tutorial referenced in step 5 and should display the backtest results at the end.
38
-
39
-
40
-
# docker run -it -v $(pwd):/home/packt --name ml4t packt bash
6. You can modify any of the environments using the standard conda workflow outlined below; see Docker docs for how to persist containers after making changes.
46
41
47
42
## How to install the required libraries using `conda` environments
48
43
@@ -72,8 +67,7 @@ Here, we will create an environment from a file to ensure you install the versio
0 commit comments