Note: libBGPStream must be installed prior to installing PyBGPStream

Installing from PyPI

The simplest and recommended way to install PyBGPStream is from PyPI using pip:

$ pip install pybgpstream

Thats it!

Installing from source

If you prefer to install PyBGPStream from source, simply run the following commands:

$ mkdir ~/src
$ cd ~/src/
$ curl -O
$ tar zxf pybgpstream-1.1.0.tar.gz
$ cd pybgpstream-1.1.0
$ python build_ext
$ sudo python install

Use python install --user to install the library in your home directory.

Testing the installation

To check if pybgpstream is installed correctly run the tutorial print script:

$ curl | python
valid ris.rrc06 1427846570
    W 25152 W {'prefix': ''}
valid ris.rrc06 1427846573
    A 2001:200:0:fe00::6249:0 25152 A {'next-hop': '2001:200:0:fe00::9c1:0', 'prefix': '2a00:bdc0:e004::/48', 'as-path': '25152 2497 6939 47541 28709'}


The BGPStream C library must be installed prior to installing pybgpstream. If you see an error like the following during installation, then you may not have libBGPStream installed .

In file included from src/_pybgpstream_module.c:27:
    src/_pybgpstream_bgprecord.h:29:10: fatal error: 'bgpstream.h' file not found

If you have installed libBGPStream to a non-standard location (e.g., /path/to/libbgpstream), then you will need to provide more information to pip as follows:

pip install \
    --global-option build_ext \
    --global-option '--include-dir=/path/to/libbgpstream/include' \
    --global-option '--library-dir=/path/to/libbgpstream/lib' \

or, if you are installing from source

In this case you may also have to tell Python where to find libBGPStream at run time like so:

LD_LIBRARY_PATH=/path/to/libbgpstream/lib python