Merge pull request #1967 from freqtrade/modify/setup.sh

Modify handling of pip in setup.sh
This commit is contained in:
Matthias 2019-06-30 19:52:50 +02:00 committed by GitHub
commit cdeb649d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 44 deletions

View File

@ -56,4 +56,4 @@ notifications:
cache: cache:
pip: True pip: True
directories: directories:
- /usr/local/lib - /usr/local/lib/

View File

@ -4,12 +4,22 @@ This page explains how to prepare your environment for running the bot.
## Prerequisite ## Prerequisite
### Requirements
Click each one for install guide:
* [Python >= 3.6.x](http://docs.python-guide.org/en/latest/starting/installation/)
* [pip](https://pip.pypa.io/en/stable/installing/)
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
* [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended)
* [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html) (install instructions below)
### API keys
Before running your bot in production you will need to setup few Before running your bot in production you will need to setup few
external API. In production mode, the bot will require valid Exchange API external API. In production mode, the bot will require valid Exchange API
credentials. We also recommend a [Telegram bot](telegram-usage.md#setup-your-telegram-bot) (optional but recommended). credentials. We also recommend a [Telegram bot](telegram-usage.md#setup-your-telegram-bot) (optional but recommended).
- [Setup your exchange account](#setup-your-exchange-account)
### Setup your exchange account ### Setup your exchange account
You will need to create API Keys (Usually you get `key` and `secret`) from the Exchange website and insert this into the appropriate fields in the configuration or when asked by the installation script. You will need to create API Keys (Usually you get `key` and `secret`) from the Exchange website and insert this into the appropriate fields in the configuration or when asked by the installation script.
@ -18,6 +28,9 @@ You will need to create API Keys (Usually you get `key` and `secret`) from the E
Freqtrade provides a Linux/MacOS script to install all dependencies and help you to configure the bot. Freqtrade provides a Linux/MacOS script to install all dependencies and help you to configure the bot.
!!! Note
Python3.6 or higher and the corresponding pip are assumed to be available. The install-script will warn and stop if that's not the case.
```bash ```bash
git clone git@github.com:freqtrade/freqtrade.git git clone git@github.com:freqtrade/freqtrade.git
cd freqtrade cd freqtrade
@ -30,7 +43,7 @@ git checkout develop
## Easy Installation - Linux Script ## Easy Installation - Linux Script
If you are on Debian, Ubuntu or MacOS a freqtrade provides a script to Install, Update, Configure, and Reset your bot. If you are on Debian, Ubuntu or MacOS freqtrade provides a script to Install, Update, Configure, and Reset your bot.
```bash ```bash
$ ./setup.sh $ ./setup.sh
@ -45,7 +58,7 @@ usage:
This script will install everything you need to run the bot: This script will install everything you need to run the bot:
* Mandatory software as: `Python3`, `ta-lib`, `wget` * Mandatory software as: `ta-lib`
* Setup your virtualenv * Setup your virtualenv
* Configure your `config.json` file * Configure your `config.json` file
@ -70,24 +83,16 @@ Config parameter is a `config.json` configurator. This script will ask you quest
We've included/collected install instructions for Ubuntu 16.04, MacOS, and Windows. These are guidelines and your success may vary with other distros. We've included/collected install instructions for Ubuntu 16.04, MacOS, and Windows. These are guidelines and your success may vary with other distros.
OS Specific steps are listed first, the [Common](#common) section below is necessary for all systems. OS Specific steps are listed first, the [Common](#common) section below is necessary for all systems.
### Requirements !!! Note
Python3.6 or higher and the corresponding pip are assumed to be available.
Click each one for install guide:
* [Python >= 3.6.x](http://docs.python-guide.org/en/latest/starting/installation/)
* [pip](https://pip.pypa.io/en/stable/installing/)
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
* [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended)
* [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html)
### Linux - Ubuntu 16.04 ### Linux - Ubuntu 16.04
#### Install Python 3.6, Git, and wget #### Install necessary dependencies
```bash ```bash
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update sudo apt-get update
sudo apt-get install python3.6 python3.6-venv python3.6-dev build-essential autoconf libtool pkg-config make wget git sudo apt-get install build-essential git
``` ```
#### Raspberry Pi / Raspbian #### Raspberry Pi / Raspbian
@ -111,14 +116,6 @@ python3 -m pip install -r requirements-common.txt
python3 -m pip install -e . python3 -m pip install -e .
``` ```
### MacOS
#### Install Python 3.6, git and wget
```bash
brew install python3 git wget
```
### Common ### Common
#### 1. Install TA-Lib #### 1. Install TA-Lib
@ -159,7 +156,7 @@ git clone https://github.com/freqtrade/freqtrade.git
``` ```
Optionally checkout the stable/master branch: Optionally checkout the master branch to get the latest stable release:
```bash ```bash
git checkout master git checkout master
@ -177,9 +174,9 @@ cp config.json.example config.json
#### 5. Install python dependencies #### 5. Install python dependencies
``` bash ``` bash
pip3 install --upgrade pip python3 -m pip install --upgrade pip
pip3 install -r requirements.txt python3 -m pip install -r requirements.txt
pip3 install -e . python3 -m pip install -e .
``` ```
#### 6. Run the Bot #### 6. Run the Bot
@ -187,7 +184,7 @@ pip3 install -e .
If this is the first time you run the bot, ensure you are running it in Dry-run `"dry_run": true,` otherwise it will start to buy and sell coins. If this is the first time you run the bot, ensure you are running it in Dry-run `"dry_run": true,` otherwise it will start to buy and sell coins.
```bash ```bash
python3.6 freqtrade -c config.json python3 freqtrade -c config.json
``` ```
*Note*: If you run the bot on a server, you should consider using [Docker](docker.md) or a terminal multiplexer like `screen` or [`tmux`](https://en.wikipedia.org/wiki/Tmux) to avoid that the bot is stopped on logout. *Note*: If you run the bot on a server, you should consider using [Docker](docker.md) or a terminal multiplexer like `screen` or [`tmux`](https://en.wikipedia.org/wiki/Tmux) to avoid that the bot is stopped on logout.
@ -217,7 +214,7 @@ when it changes.
The `freqtrade.service.watchdog` file contains an example of the service unit configuration file which uses systemd The `freqtrade.service.watchdog` file contains an example of the service unit configuration file which uses systemd
as the watchdog. as the watchdog.
!!! Note !!! Note
The sd_notify communication between the bot and the systemd service manager will not work if the bot runs in a Docker container. The sd_notify communication between the bot and the systemd service manager will not work if the bot runs in a Docker container.
------ ------
@ -237,8 +234,6 @@ If that is not available on your system, feel free to try the instructions below
git clone https://github.com/freqtrade/freqtrade.git git clone https://github.com/freqtrade/freqtrade.git
``` ```
copy paste `config.json` to ``\path\freqtrade-develop\freqtrade`
#### Install ta-lib #### Install ta-lib
Install ta-lib according to the [ta-lib documentation](https://github.com/mrjbq7/ta-lib#windows). Install ta-lib according to the [ta-lib documentation](https://github.com/mrjbq7/ta-lib#windows).

View File

@ -1,12 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#encoding=utf8 #encoding=utf8
function check_installed_pip() {
${PYTHON} -m pip > /dev/null
if [ $? -ne 0 ]; then
echo "pip not found (called as '${PYTHON} -m pip'). Please make sure that pip is available for ${PYTHON}."
exit 1
fi
}
# Check which python version is installed # Check which python version is installed
function check_installed_python() { function check_installed_python() {
which python3.7 which python3.7
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "using Python 3.7" echo "using Python 3.7"
PYTHON=python3.7 PYTHON=python3.7
check_installed_pip
return return
fi fi
@ -14,6 +23,7 @@ function check_installed_python() {
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "using Python 3.6" echo "using Python 3.6"
PYTHON=python3.6 PYTHON=python3.6
check_installed_pip
return return
fi fi
@ -21,7 +31,6 @@ function check_installed_python() {
echo "No usable python found. Please make sure to have python3.6 or python3.7 installed" echo "No usable python found. Please make sure to have python3.6 or python3.7 installed"
exit 1 exit 1
fi fi
} }
function updateenv() { function updateenv() {
@ -29,21 +38,21 @@ function updateenv() {
echo "Updating your virtual env" echo "Updating your virtual env"
echo "-------------------------" echo "-------------------------"
source .env/bin/activate source .env/bin/activate
echo "pip3 install in-progress. Please wait..." echo "pip install in-progress. Please wait..."
# Install numpy first to have py_find_1st install clean # Install numpy first to have py_find_1st install clean
pip3 install --upgrade pip numpy ${PYTHON} -m pip install --upgrade pip numpy
pip3 install --upgrade -r requirements.txt ${PYTHON} -m pip install --upgrade -r requirements.txt
read -p "Do you want to install dependencies for dev [y/N]? " read -p "Do you want to install dependencies for dev [y/N]? "
if [[ $REPLY =~ ^[Yy]$ ]] if [[ $REPLY =~ ^[Yy]$ ]]
then then
pip3 install --upgrade -r requirements-dev.txt ${PYTHON} -m pip install --upgrade -r requirements-dev.txt
else else
echo "Dev dependencies ignored." echo "Dev dependencies ignored."
fi fi
pip3 install --quiet -e . ${PYTHON} -m pip install -e .
echo "pip3 install completed" echo "pip install completed"
echo echo
} }
@ -74,16 +83,14 @@ function install_macos() {
echo "-------------------------" echo "-------------------------"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi fi
brew install python3 wget
install_talib install_talib
test_and_fix_python_on_mac test_and_fix_python_on_mac
} }
# Install bot Debian_ubuntu # Install bot Debian_ubuntu
function install_debian() { function install_debian() {
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update sudo apt-get update
sudo apt-get install python3.6 python3.6-venv python3.6-dev build-essential autoconf libtool pkg-config make wget git sudo apt-get install build-essential autoconf libtool pkg-config make wget git
install_talib install_talib
} }
@ -244,7 +251,7 @@ echo "
Installing dependencies for Plotting scripts Installing dependencies for Plotting scripts
----------------------------------------- -----------------------------------------
" "
pip install plotly --upgrade ${PYTHON} -m pip install plotly --upgrade
} }
function help() { function help() {