Installation

MAC OS

Step 1: Install Anaconda

-Download Anaconda Installer, Anaconda has everything you need for Python programming.

-Follow Anaconda’s instruction: macOS graphical install, to install the newest version of Anaconda.

-Open your terminal and type: ‘which python’, it should show:

/Users/your_user_name/opt/anaconda3/bin/python

It means that your Python interpreter path has been pinned to Anaconda’s python version. If it shows something like this:

/Users/your_user_name/opt/anaconda3/bin/python

It means that you still use the default python path, you either fix it and pin it to the anaconda path (try this blog), or you can use Anaconda Navigator to open a terminal manually.

Step 2: Install Homebrew

-Open a terminal and make sure that you have installed Anaconda.

-Install Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 3: Install OpenAI

Installation of system packages on Mac requires Homebrew. With Homebrew installed, run the following in your terminal:

brew install cmake openmpi

Step 4: Install FinRL

Since we are still actively updating the FinRL repository, please install the unstable development version of FinRL using pip:

pip install git+https://github.com/AI4Finance-Foundation/FinRL.git

Step 5: Install box2d (if using box2d)

Users can try:

brew install swig
pip install box2d-py
pip install box2d
pip install Box2D

If it raises errors “AttributeError: module ‘_Box2D’ has no attribute ‘RAND_LIMIT_swigconstant’ “, users can try:

pip install box2d box2d-kengz

Step 6: Run FinRL

Download the FinRL repository either use terminal:

git clone https://github.com/AI4Finance-Foundation/FinRL.git

or download it manually

../_images/download_FinRL.png

Open Jupyter Notebook through Anaconda Navigator and locate one of the stock trading notebook in FinRL/tutorials you just downloaded. You should be able to run it.

Ubuntu

Step 1: Install Anaconda

Please follow the steps in this blog

Step 2: Install OpenAI

Open an ubuntu terminal and type:

sudo apt-get update && sudo apt-get install cmake libopenmpi-dev python3-dev zlib1g-dev libgl1-mesa-glx swig

Step 3: Install FinRL

Since we are still actively updating the FinRL repository, please install the unstable development version of FinRL using pip:

pip install git+https://github.com/AI4Finance-Foundation/FinRL.git

Step 4: Install box2d (if using box2d)

Step 5: Run FinRL

Download the FinRL repository in terminal:

git clone https://github.com/AI4Finance-Foundation/FinRL.git

Open Jupyter Notebook by typing ‘jupyter notebook’ in your ubuntu terminal.

Locate one of the stock trading notebook in FinRL/tutorials you just downloaded. You should be able to run it.

Windows 10

Prepare for install

  1. VPN is needed if using YahooFinance in china (pyfolio, elegantRL pip dependencies need pull code, YahooFinance has stopped the service in china). Othewise, please ignore it.

  2. python version >=3.7

  3. pip remove zipline, if your system has installed zipline, zipline has conflicts with the FinRL.

Step 1: Clone FinRL

git clone https://github.com/AI4Finance-Foundation/FinRL.git

Step 2: install dependencies

cd FinRL
pip install .

Step 3: Install box2d (if using box2d)

Step 4: test (If using YahooFinance in China, VPN is needed)

python Stock_NeurIPS2018.py

Tips for running error

If the following outputs appear, take it easy, since installation is still successful.

  1. UserWarning: Module “zipline.assets” not found; multipliers will not be applied to position notionals. Module “zipline.assets” not found; multipliers will not be applied’

If following outputs appear, please ensure that VPN helps to access the YahooFinance

  1. Failed download: xxxx: No data found for this date range, the stock may be delisted, or the value is missing.

Windows 10 (wsl install)

Step 1: Install Ubuntu on Windows 10

Please check this video for detailed steps:

Step 2: Install Anaconda

Please follow the steps in this blog

Step 3: Install OpenAI

Open an ubuntu terminal and type:

sudo apt-get update && sudo apt-get install cmake libopenmpi-dev python3-dev zlib1g-dev libgl1-mesa-glx

Step 4: Install FinRL

Since we are still actively updating the FinRL repository, please install the unstable development version of FinRL using pip:

pip install git+https://github.com/AI4Finance-Foundation/FinRL.git

Step 5: Install box2d (if using box2d)

Step 6: Run FinRL

Download the FinRL repository in terminal:

git clone https://github.com/AI4Finance-Foundation/FinRL.git

Open Jupyter Notebook by typing ‘jupyter notebook’ in your ubuntu terminal. Please see jupyter notebook

Locate one of the stock trading notebook in FinRL/tutorials you just downloaded. You should be able to run it.