2017-01-10 00:01:50 +01:00
# Installing LBRY
2015-08-20 17:27:15 +02:00
2018-10-29 22:01:41 +01:00
If only the JSON-RPC API server is needed, the recommended way to install LBRY is to use a pre-built binary. We provide binaries for all major operating systems. See the [README ](README.md ).
2015-08-20 17:27:15 +02:00
2018-10-02 00:44:32 +02:00
These instructions are for installing LBRY from source, which is recommended if you are interested in doing development work or LBRY is not available on your operating system (godspeed, TempleOS users).
2015-08-20 17:27:15 +02:00
2018-10-29 22:01:41 +01:00
Here's a video walkthrough of this setup, which is itself hosted by the LBRY network and provided via [spee.ch ](https://github.com/lbryio/spee.ch ):
2018-10-17 16:57:10 +02:00
[![Setup for development ](https://spee.ch/2018-10-04-17-13-54-017046806.png )](https://spee.ch/967f99344308f1e90f0620d91b6c93e4dfb240e0/lbrynet-dev-setup.mp4)
2017-01-10 00:01:50 +01:00
## Prerequisites
2015-08-20 17:27:15 +02:00
2019-05-22 15:23:31 +02:00
Running `lbrynet` from source requires Python 3.7 or higher. Get the installer for your OS [here ](https://www.python.org/downloads/release/python-370/ )
2018-10-17 16:57:10 +02:00
2018-10-29 22:01:41 +01:00
After installing python 3, you'll need to install some additional libraries depending on your operating system.
2018-10-17 16:57:10 +02:00
2018-10-20 14:26:47 +02:00
### macOS
2016-05-23 21:21:47 +02:00
2018-10-20 14:26:47 +02:00
macOS users will need to install [xcode command line tools ](https://developer.xamarin.com/guides/testcloud/calabash/configuring/osx/install-xcode-command-line-tools/ ) and [homebrew ](http://brew.sh/ ).
2016-05-23 21:21:47 +02:00
2019-05-16 15:44:50 +02:00
These environment variables also need to be set
1. PYTHONUNBUFFERED=1
2. EVENT_NOKQUEUE=1
2017-01-10 00:01:50 +01:00
Remaining dependencies can then be installed by running:
2016-09-22 19:19:28 +02:00
```
2019-03-11 17:57:33 +01:00
brew install python protobuf
2016-09-22 19:19:28 +02:00
```
2019-03-11 17:57:33 +01:00
Assistance installing Python3: https://docs.python-guide.org/starting/install3/osx/
2018-10-17 16:57:10 +02:00
### Linux
2016-09-22 19:19:28 +02:00
2018-10-17 16:57:10 +02:00
On Ubuntu (we recommend 18.04), install the following:
2016-09-22 19:19:28 +02:00
2017-01-10 00:01:50 +01:00
```
2019-02-15 00:33:39 +01:00
sudo apt-get install build-essential python3.7 python3.7-dev git python3-venv libssl-dev python-protobuf
2017-01-10 00:01:50 +01:00
```
2016-01-27 04:52:55 +01:00
2017-06-01 20:23:57 +02:00
On Raspbian, you will also need to install `python-pyparsing` .
2018-10-29 22:01:41 +01:00
If you're running another Linux distro, install the equivalent of the above packages for your system.
2016-09-22 19:19:28 +02:00
2017-01-10 00:01:50 +01:00
## Installation
2017-01-21 17:13:55 +01:00
To install:
2017-01-10 00:01:50 +01:00
```
2017-01-21 17:13:55 +01:00
git clone https://github.com/lbryio/lbry.git
cd lbry
2018-10-29 22:01:41 +01:00
2019-02-15 00:33:39 +01:00
Creating venv:
2019-03-11 17:57:33 +01:00
python -m venv lbry-venv
2019-02-15 00:33:39 +01:00
Activating lbry-venv on Linux/Mac:
2017-01-10 00:01:50 +01:00
source lbry-venv/bin/activate
2019-02-09 19:08:28 +01:00
2019-02-15 00:33:39 +01:00
Activating lbry-venv on Windows:
2019-02-09 19:08:28 +01:00
lbry-venv\Scripts\activate
2018-10-02 00:44:32 +02:00
python --version # Python 2 is not supported. Make sure you're on Python 3.7
2018-12-12 02:19:58 +01:00
pip install -e .
2018-10-02 00:44:32 +02:00
```
2018-11-01 00:35:39 +01:00
To verify your installation, `which lbrynet` should return a path inside of the `lbry-venv` folder created by the `virtualenv` command.
2018-10-17 16:57:10 +02:00
## Run the tests
2018-10-02 00:44:32 +02:00
To run the unit tests from the repo directory:
```
trial --reactor=asyncio tests.unit
2017-01-10 00:01:50 +01:00
```
2016-01-27 04:52:55 +01:00
2018-10-17 16:57:10 +02:00
## Usage
2018-10-02 00:44:32 +02:00
To start the API server:
`lbrynet start`
2017-01-21 17:13:55 +01:00
2018-03-21 13:25:24 +01:00
Happy hacking!