Skip to content
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

fix(dev): psycopg2-binary 2.9.1 does not work with Django 2.2 #29012

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Oct 1, 2021

For the incompatibility issue with Django visit this issue,

In this PR, we're going to downgrade to the compatible 2.8.6 version (thus, matching
the Python 3.6 version), removing the need to install postgresql (this means partially
reverting #28607) and instead installing a wheel I built on my machine that I have stored
in GC storage.

I built the wheel like this (see root issue for details):

brew install postgresql
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/python@3.8/lib"
pip install psycopg2-binary==2.8.6

Fixes #28958

@armenzg armenzg added the Component: Developer Environment This covers issues related to setting up a developer's environment label Oct 1, 2021
@armenzg armenzg added this to the Apple M1 Python support milestone Oct 1, 2021
@armenzg armenzg self-assigned this Oct 1, 2021
@armenzg armenzg marked this pull request as ready for review October 1, 2021 13:36
@armenzg armenzg requested review from a team as code owners October 1, 2021 13:36
@armenzg armenzg force-pushed the armenzg/dev/downgrade-psycopg2-binary branch from f609a1e to 6dea7ea Compare October 1, 2021 14:04
@armenzg armenzg mentioned this pull request Oct 1, 2021
12 tasks
@armenzg armenzg marked this pull request as draft October 1, 2021 14:27
@armenzg
Copy link
Member Author

armenzg commented Oct 1, 2021

For some odd reason, the URL sometimes doesn't work and requires authentication. I will wait until I can get IT to make the bucket public.

scripts/lib.sh Outdated
# This installs pyscopg-binary2 since there's no arm64 wheel
# This saves having to install postgresql on the Developer's machine + using flags
# https://github.com/psycopg/psycopg2/issues/1286
pip install "https://storage.googleapis.com/python-arm64-wheels/psycopg2_binary-2.8.6-cp38-cp38-macosx_11_0_arm64.whl"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where/how is this being built and uploaded?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic JK :)

I had commented in the description of the PR:

brew install postgresql
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/python@3.8/lib"
pip install psycopg2-binary==2.8.6

I then grab the wheel from the cache.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More like, how are you uploading this? It's not clear what gcloud command maps to https://storage.googleapis.com/python-arm64-wheels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see.

I use the web UI to upload it to the bucket. I won't be automating since we're not going to upload many packages or often.

For the incompatibility issue with Django visit [this issue][incompatible],

In this PR, we're going to downgrade to the compatible 2.8.6 version (thus, matching
the Python 3.6 version), removing the need to install `postgresql` (this means partially
reverting #28607) and instead installing a wheel I built on my machine that I have stored
in GC storage.

Fixes #28958

[incompatible]: psycopg/psycopg2#1293
@armenzg armenzg force-pushed the armenzg/dev/downgrade-psycopg2-binary branch from d6b4c44 to 37e4c49 Compare October 7, 2021 14:13
@armenzg armenzg changed the base branch from master to armenzg/devenv/fix-pyenv-on-intel October 7, 2021 14:22
@armenzg armenzg requested a review from joshuarli October 7, 2021 14:35
# psycopg2-binary does not have an arm64 wheel, thus, we need to build it locally
# by installing postgresql
# See details: https://github.com/psycopg/psycopg2/issues/1286
brew install postgresql
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to keep the prerequisites target for a little longer but remove installing postgresql

@@ -95,7 +95,7 @@ ${red}${bold}
ERROR: You're running a virtualenv with Python ${python_version}.
On Apple M1 machines, we only support >= 3.8.10 < 3.9.
Either run "rm -rf ${venv_name} && direnv allow" to
OR set SENTRY_PYTHON_VERSION=${python_version} to an `.env` file to bypass this check."
OR set SENTRY_PYTHON_VERSION=${python_version} to an .env file to bypass this check."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My auto-formatting kept trying to fix .env to $(.env). There's no point of keeping the back-ticks since this is not Markdown text.

@joshuarli joshuarli merged commit 3744aac into armenzg/devenv/fix-pyenv-on-intel Oct 7, 2021
@joshuarli joshuarli deleted the armenzg/dev/downgrade-psycopg2-binary branch October 7, 2021 20:44
@joshuarli
Copy link
Member

Oh. @armenzg you had the target branch set to something else. Guess I gotta merge that too then.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: Developer Environment This covers issues related to setting up a developer's environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Downgrade psycopg2-binary on Python 3.8
2 participants