2013-08-18 21:49:12 -07:00
.. _install:
Installation
2020-06-08 00:31:33 -07:00
============
2013-08-18 21:49:12 -07:00
Pip
2020-06-08 00:31:33 -07:00
---
The pip installation will using the binary versions of the package (if possible). These contain a bundled version of capnproto (on Linux compiled with `manylinux <https://github.com/pypa/manylinux> `_ ). Starting from v1.0.0b1 binary releases are available for Windows, macOS and Linux from `pypi <https://pypi.org/project/pycapnp/#history> `_ ::
2013-08-18 21:49:12 -07:00
2013-09-01 20:10:57 -07:00
[sudo] pip install pycapnp
2020-06-08 00:31:33 -07:00
To force rebuilding the pip package from source (you'll need requirments.txt or pipenv)::
pip install --no-binary :all: pycapnp
2023-10-03 09:47:45 -07:00
To force bundling libcapnp (or force system libcapnp), just in case pip isn't doing the right thing::
2020-06-08 00:31:33 -07:00
2023-10-03 07:30:51 +02:00
pip install --no-binary :all: -C force-bundled-libcapnp=True
pip install --no-binary :all: -C force-system-libcapnp=True
2013-09-01 20:10:57 -07:00
2020-06-08 00:31:33 -07:00
If you're using an older Linux distro (e.g. CentOS 6) you many need to set `LDFLAGS="-Wl,--no-as-needed -lrt"` ::
2013-08-18 21:49:12 -07:00
2020-06-08 00:31:33 -07:00
LDFLAGS="-Wl,--no-as-needed -lrt" pip install --no-binary :all: pycapnp
It's also possible to specify the libcapnp url when bundling (this may not work, there be dragons)::
2023-10-03 07:30:51 +02:00
pip install --no-binary :all: -C force-bundled-libcapnp=True -C libcapnp-url="https://github.com/capnproto/capnproto/archive/master.tar.gz"
2013-08-21 17:45:13 -07:00
2013-08-18 21:49:12 -07:00
From Source
2020-06-08 00:31:33 -07:00
-----------
Source installation is generally not needed unless you're looking into an issue with capnproto or pycapnp itself.
2013-08-18 21:49:12 -07:00
2020-06-01 16:20:11 -04:00
C++ Cap'n Proto Library
~~~~~~~~~~~~~~~~~~~~~~~
2020-06-08 00:31:33 -07:00
You need to install the C++ Cap'n Proto library first. It requires a C++ compiler with C++14 support, such as GCC 5+ or Clang 5+. Follow installation docs at `https://capnproto.org/install.html <https://capnproto.org/install.html> `_ .
2020-06-01 16:20:11 -04:00
pycapnp from git
~~~~~~~~~~~~~~~~
2020-06-08 00:31:33 -07:00
If you want the latest development version, you can clone the github repo::
git clone https://github.com/capnproto/pycapnp.git
For development packages use one of the following to install the python dependencies::
pipenv install
pip install -r requirements.txt
2013-08-18 21:49:12 -07:00
2020-06-08 00:31:33 -07:00
And install pycapnp with::
cd pycapnp
pip install .
2013-08-18 21:49:12 -07:00
2020-06-08 00:31:33 -07:00
2013-08-28 22:55:10 -07:00
Development
2020-06-08 00:31:33 -07:00
-----------
Clone the repo from https://github.com/capnproto/pycapnp.git::
2013-08-28 22:55:10 -07:00
2020-06-08 00:31:33 -07:00
git clone https://github.com/capnproto/pycapnp.git
2014-12-15 12:24:24 -08:00
2020-06-08 00:31:33 -07:00
For development packages use one of the following to install the python dependencies::
2013-08-28 22:55:10 -07:00
2020-06-08 00:31:33 -07:00
pipenv install
pip install -r requirements.txt
2013-09-01 01:15:31 -07:00
2020-06-08 00:31:33 -07:00
Building::
cd pycapnp
pip install .
Useful targets for setup.py::
python setup.py clean
2023-10-03 09:47:45 -07:00
Useful command-line arguments are available for pip install::
2020-06-08 00:31:33 -07:00
2023-10-03 09:47:45 -07:00
-C force-bundled-libcapnp=True
-C force-system-libcapnp=True
-C libcapnp-url="https://github.com/capnproto/capnproto/archive/master.tar.gz"
2020-06-08 00:31:33 -07:00
Testing is done through pytest::
cd pycapnp
pytest
pytest test/test_rpc_calculator.py
2013-08-28 22:55:10 -07:00
2013-08-18 21:49:12 -07:00
Once you're done installing, take a look at the :ref: `quickstart`