-
-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
psycopg2-binary 2.9.2 bundles wrong libpq version on aarch64 #1396
Comments
Yes, the problem is aarch64. We don't build the libpq from scratch on manylinux_2_24, we use the packaged version, and postgres doesn't have a repository where to fetch a more modern libpq version, so you get what debian gives. Did we find in the wrong place? |
Looking at https://packages.debian.org/sid/libpq-dev, it appears as though debian's repos should be able to provide libpq 14.1 |
Have you got any way to install it on your system? If you manage we would be happy to upgrade the packages. |
I can have the docker container manually apt-get update && apt-get install -y libpq-dev, which gives libpq-dev 13.5-0+deb11u1 and libpq5:arm64 13.5-0+dev11u1, but psycopg2 does not use it. |
If you install psycopg2 instead of psycopg2-binary it will use them. |
I assume that's meant to be a temp fix? Just double checking, since we want deployments to be fast, which means we generally try to limit compilation from source as much as possible. It does, however, work. |
If PostgreSQL Debian packagers will package a more modern version we will use it. I don't know their reason behind not having an aarch64 distribution. If you want to save the compilation time, and you said you can install a libpq in other ways, you can make a package to keep on a private pypi instance. |
Gonna try building from source instead to get a newer libpq (see psycopg/psycopg2#1396)
* Remove django-redis * Update to Python 3.10 * Run `pipenv update` * Upgrade images * Uninstall psycopg2-binary Gonna try building from source instead to get a newer libpq (see psycopg/psycopg2#1396) * Rearrange Dockerfile for better caching * Switch to bare psycopg2 * Use Django's new Redis caching
Here's my solution, this may or may not help some of you, @oar-spease especially.
FROM python:3.10-slim as runtime
VOLUME /config
WORKDIR /app
COPY runtime-deps.sh .
RUN bash runtime-deps.sh 1> /dev/null && rm runtime-deps.sh
FROM python:3.10-slim as build
WORKDIR /app
RUN apt-get -qq update && apt-get -qq install curl libpq-dev gcc 1> /dev/null
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr/local python3 -
COPY pyproject.toml .
RUN poetry install -nvvv --no-dev && mv $(poetry env info --path) /app/venv
FROM runtime
COPY --from=build /app/venv /app/venv
COPY fred *.env ./fred/
CMD ./venv/bin/python3 -m fred
#!/bin/bash
# This file is meant to be run in the Dockerfile to get the runtime dependencies
# if you run it outside, good luck
echo "Getting initial setup dependencies..." 1>&2
apt-get update
apt-get install software-properties-common ca-certificates gnupg curl -y
# add repo that adds libpq properly
echo "Adding repository for libpq..." 1>&2
curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main"
apt-get update
# install runtime dependencies
echo "Installing runtime dependencies..." 1>&2
apt-get install -y libpq5 tesseract-ocr
# we don't need this crap anymore
echo "Cleaning up..." 1>&2
apt-get remove -y software-properties-common gnupg curl
apt-get autopurge -y
rm -rf /var/lib/apt/lists/*
echo "All runtime dependencies handled!" |
https://github.com/psycopg/psycopg2/blob/master/scripts/build/build_manylinux_2_24.sh#L31= looks like http://apt.postgresql.org/pub/repos/apt/dists/stretch-pgdg/ has newer version of libpq available, why isn't it being used? |
Right, the error message seems to be:
|
build-manylinux seems to run on ubuntu20.04, i.e. focal. why use stretch packages on arm64 when pgdg doesn't supply arm64 packages for stretch, but does for focal? |
As you can see in my example it also works on debian bullseye |
manylinux_2_24 images are build on Debian 9 (Stretch). pgdg packages for aarch64 are only available from Debian 10 on. Is it possible to install Debian 10 or Ubuntu packages on Debian 9? If so let me know, possibly with a MR. |
@dvarrazzo why are you (or is manylinux) still using Debian stretch? Is there some roadmap to move to supported version of Debian? |
apt.postgresql.org has been supporting arm64 (=aarch64) for some time now, but only for buster and newer. (I forgot why, but there was some reason that made stretch unsuitable for arm64 when I added that architecture.) |
@df7cb do you think it would be possible to backport at least the libpq5/libpq-dev packages to stretch? I am aware that stretch is getting old; however Python binary packages are built "by design" on old-ish architectures in order to give the produced artifacts the maximum ABI compatibility. Even if those packages didn't make it to the public apt.postgresql.org, but there was a way to generate them using our CI, it would be extremely useful. I'm not very experience with .deb packaging but it would be nice to have some help on that front 🙂 |
But the non-arm64 binary packages appear to be fine, at least that is what I've been told, maybe they are built in a totally different way? The problem with being API compatible is that things like SCRAM or |
Stretch is 6 weeks away from the LTS EOL, so I don't think it makes sense to fix that now, only to tear it down again at the end of June. |
There's ELTS: https://wiki.debian.org/LTS/Extended if one really wants to support it. |
I'm facing an issue where when I install psycopg2, then build and run the container with docker run, I notice that libpq_version == 130009 but when I run the same image via docker-compose then access the shell for the container, I notice libpq_version == 90624. How do I fix this? |
Fixed by #1545. To be released in 2.9.6. |
Bumps [psycopg2-binary](https://github.com/psycopg/psycopg2) from 2.9.7 to 2.9.9. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/psycopg/psycopg2/blob/master/NEWS">psycopg2-binary's changelog</a>.</em></p> <blockquote> <h2>Current release</h2> <p>What's new in psycopg 2.9.9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>Add support for Python 3.12.</li> <li>Drop support for Python 3.6.</li> </ul> <p>What's new in psycopg 2.9.8 ^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>Wheel package bundled with PostgreSQL 16 libpq in order to add support for recent features, such as <code>sslcertmode</code>.</li> </ul> <p>What's new in psycopg 2.9.7 ^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>Fix propagation of exceptions raised during module initialization (:ticket:<code>[#1598](https://github.com/psycopg/psycopg2/issues/1598)</code>).</li> <li>Fix building when pg_config returns an empty string (:ticket:<code>[#1599](https://github.com/psycopg/psycopg2/issues/1599)</code>).</li> <li>Wheel package bundled with OpenSSL 1.1.1v.</li> </ul> <p>What's new in psycopg 2.9.6 ^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>Package manylinux 2014 for aarch64 and ppc64le platforms, in order to include libpq 15 in the binary package (:ticket:<code>[#1396](https://github.com/psycopg/psycopg2/issues/1396)</code>).</li> <li>Wheel package bundled with OpenSSL 1.1.1t.</li> </ul> <p>What's new in psycopg 2.9.5 ^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>Add support for Python 3.11.</li> <li>Add support for rowcount in MERGE statements in binary packages (:ticket:<code>[#1497](https://github.com/psycopg/psycopg2/issues/1497)</code>).</li> <li>Wheel package bundled with OpenSSL 1.1.1r and PostgreSQL 15 libpq.</li> </ul> <p>What's new in psycopg 2.9.4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>Fix <code>~psycopg2.extras.register_composite()</code>, <code>~psycopg2.extras.register_range()</code> with customized :sql:<code>search_path</code> (:ticket:<code>[#1487](https://github.com/psycopg/psycopg2/issues/1487)</code>).</li> <li>Handle correctly composite types with names or in schemas requiring escape.</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/psycopg/psycopg2/commit/ad5bee7054519d87f25bc5828c502b2ebe197049"><code>ad5bee7</code></a> chore: bump version number to 2.9.9</li> <li><a href="https://github.com/psycopg/psycopg2/commit/37d1de1c8f446478666258f4370315f554efa16f"><code>37d1de1</code></a> chore: add support for Python 3.12</li> <li><a href="https://github.com/psycopg/psycopg2/commit/abf2723c0a9d89740b433bf49b82ad765e87d5d4"><code>abf2723</code></a> chore: drop support for Python 3.6</li> <li><a href="https://github.com/psycopg/psycopg2/commit/2da65a715c71fa5a242fce016835ba500376bf28"><code>2da65a7</code></a> chore: drop leftover Python 2.7 import aliases from setup.py</li> <li><a href="https://github.com/psycopg/psycopg2/commit/3fa60fd26839a7e8b083ed3eb3dc592a0f2604f6"><code>3fa60fd</code></a> chore: bump doc requirement complained by dependabot</li> <li><a href="https://github.com/psycopg/psycopg2/commit/1c1484e43bdd4927ac5725d4f250b198fbe7600f"><code>1c1484e</code></a> ci: better interaction with scaleway build server</li> <li><a href="https://github.com/psycopg/psycopg2/commit/c81cec604f467dfb4fc87c9cbaaf4b758b4ca740"><code>c81cec6</code></a> chore: bump to next dev release</li> <li><a href="https://github.com/psycopg/psycopg2/commit/7fe8cb77ca68a06c96d4551c6c9f8cab33904d2a"><code>7fe8cb7</code></a> chore: bump docs requirements dependabot complains about</li> <li><a href="https://github.com/psycopg/psycopg2/commit/b39d5d64923a3e321672847bd57c002145f57430"><code>b39d5d6</code></a> chore: bundle libpq 16</li> <li><a href="https://github.com/psycopg/psycopg2/commit/921510d5be7bc2f2dbf7ff3ce613ad0623de79f2"><code>921510d</code></a> docs: replace "compiled against" with "bundled with" in news file</li> <li>Additional commits viewable in <a href="https://github.com/psycopg/psycopg2/compare/2.9.7...2.9.9">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=psycopg2-binary&package-manager=pip&previous-version=2.9.7&new-version=2.9.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
As the title says, psycopg2-binary is including the wrong libpq version. This causes the error "SCRAM authentication requires libpq version 10 or above"
The file appears to be /usr/local/lib/python3.9/site-packages/psycopg2_binary.libs/libpq-4fa63d26.so.5.9
The installation was
pip install psycopg2-binary
on a python:3.9-slim docker container, which to my knowledge is debian based.The text was updated successfully, but these errors were encountered: