Quick version::
- pip install -U pip # upgrade pip to at least 20.3
- pip install --pre psycopg[binary,pool] # install binary files
-
-
-Install from source
--------------------
-
-The library is still in a development stage: you can obtain the most
-up-to-date code `from the GitHub project`__::
-
- $ pip install git+https://github.com/psycopg/psycopg.git#subdirectory=psycopg
- $ python3
- >>> import psycopg
-
-.. __: https://github.com/psycopg/psycopg
-
-You are required to have the ``libpq``, the PostgreSQL client library, already
-installed in the system before using ``psycopg``. On Debian system you can
-obtain it by running::
-
- sudo apt install libpq5
-
-Please check your system's documentation for information about installing the
-``libpq`` on your platform.
+ pip install --upgrade pip # upgrade pip to at least 20.3
+ pip install --pre psycopg[binary,pool] # install binary dependencies
For further information about installation please check `the documentation`__.
Hacking
-------
-In order to work on the Psycopg source code you should clone this repository::
+In order to work on the Psycopg source code you need to have the ``libpq``
+PostgreSQL client library installed in the system. For instance, on Debian
+systems, you can obtain it by running::
+
+ sudo apt install libpq5
+
+After which you can clone this repository::
git clone https://github.com/psycopg/psycopg.git
cd psycopg
different requirements:
- The ``psycopg`` directory contains the pure python implementation of
- ``psycopg``. The package has only a runtime dependency on the ``libpq``,
- the PostgreSQL client library, which should have been already installed in
- your system.
+ ``psycopg``. The package has only a runtime dependency on the ``libpq``, the
+ PostgreSQL client library, which should be installed in your system.
- The ``psycopg_c`` directory contains an optimization module written in
C/Cython. In order to build it you will need a few development tools: please
In short::
- pip install -U pip # upgrade pip to at least 20.3
+ pip install --upgrade pip # upgrade pip to at least 20.3
pip install --pre psycopg[binary]
and you should be :ref:`ready to start <module-usage>`.
pip install --pre psycopg[binary]
-This will install a self-contained package with all the libraries needed.
-You will need pip >= 20.3 at least: please run ``pip install -U pip`` to update
-it beforehand.
+This will install a self-contained package with all the libraries needed. You
+will need pip >= 20.3 at least: please run ``pip install --upgrade pip`` to
+update it beforehand.
The above package should work in most situations. It **will not work** in
some cases though:
Local installation
------------------
-A "Local installation" means obtaining a performing and maintainable library.
-The library will include a performing C module and will be bound to the system
+A "Local installation" results in a performing and maintainable library. The
+library will include a the speed-up C module and will be linked to the system
libraries (``libpq``, ``libssl``...) so that system upgrade of libraries will
upgrade the libraries used by Psycopg 3 too. This is the preferred way to
install Psycopg for a production site.
In order to perform a local installation you need some prerequisites:
- a C compiler,
-- Python development headers (e.g. the python3-dev package).
-- PostgreSQL client development headers (e.g. the libpq-dev package).
+- Python development headers (e.g. the ``python3-dev`` package).
+- PostgreSQL client development headers (e.g. the ``libpq-dev`` package).
- The :program:`pg_config` program available in the :envvar:`PATH`.
You **must be able** to troubleshoot an extension build, for instance you must
In short, run the following::
- pip install -U pip # to upgrade pip
+ pip install --upgrade pip # to upgrade pip
pip install psycopg[binary,pool] # to install package and dependencies
If something goes wrong, and for more information about installation, please