-
-
Notifications
You must be signed in to change notification settings - Fork 504
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 fails to install on macOS Big Sur 11.0.1 and Python 3.9.0 (with possible workaround) #1200
Comments
Probably the last and greatest Mac OS is not compatible with wheels packages. You should hear from the Python Package Authority, or from Apple. |
Hi, I am using Catalina (10.15.7) and I also had the same issue In our case the issue went away updating the version we were using of psycopg2. We were using python 3.7 with pyscopg2 2.7.5 and everything was working fine. We are now updating python to 3.9 and when trying to install requirements we found that psycopg could not find pg_config. This error also happened if trying to install 2.7.5 with python 3.8. Allowing the version to be ~=2.8.0 fixed it and now it can install properly. This has nothing to do with the original issue raised but I just wanted to leave it here in case it triggers some thought and someone arrives here with the same issue I had before :) |
Hey, I just got the same message today. I'm using fedora 33 and python 3.9 and when I wanted to install psycopg2-binary using Here is the full log:
|
@hsnprsd you are trying to install 2.7.7, which was released way before Python 3.9. We don't have a time machine: MR for time travel features are well received. Binary packages for Python 3.9 for linux and windows are available only from 2.8.6 on. Mac OS has released a new version and as per usual they have broken everything they could. So this ticket is about MacOS, not windows and linux. I'd appreciate if it remained that way. |
@dvarrazzo Sorry, you are right. I wasn't aware I am installing an old version of psycopg. |
I found this problem was resolved by upgrading pip:
Running pip prints warnings to upgrade. |
I am using Mac os big sure and this works for me.
then finally install psycopg2 pip3 install psycopg2 |
Hi @Nkarnaud , I am using Big Sur on Apple silicon. This doesn't work for me. Can you help? :( |
Hi @shreyagupta30, can you share the error you are having? |
Here @Nkarnaud |
check this it may be of help. https://stackoverflow.com/questions/62877588/psycopg2-gives-error-while-installing-in-macos-catalina-10-15-5 |
Adding that I'm having similar issues with the following:
I ran into the same issue with |
Not that I know whether psycopg works on Mac M1 or not. However the words "Make sure to use an up-date-date version of pip" written in the documentation are not there just to waste electrons. With such an old pip version you don't stand a chance. |
Pretty sure 21.0.1 is the latest
|
mmm... you are right, apologies. I thought we were in the 40s by now. Ok, keep on having fun with your macs. |
Actually, figured it out. Haven't worked on a Mac in a while and forgot about the PostgreSQL dependencies that have to be installed before
Follow the |
Is there anything standard in all these paths that mac os have to change every single time? is there a MR someone can propose against the setup.py to make your life easier? |
can confirm @cheslijones's method was successful for me on an M1 Macbook Air.
It seems the confusion is because brew recommends installing to |
|
This one works: |
I recommend you to install postgres first. |
Hi there, I found out a way for installing psycopg2 on a ARM architecture : use a conda virtual environment using miniforge3. This is recommended by apple for installing ML package tensorflow (apparently optimised for the new chip). Here is the miniforge repo for installation : Eventually you can create a yml file to remove some ML package that is shipped along conda. I am not sure this solution is optimal but to me it looks much cleaner that exporting flags in a specific location on the file system. |
I wrote about how to get around this in the I used Python 3.8 from Homebrew and Postgres 11 from Homebrew, but long story short the solution that worked for me looks something like this:
|
Hey 👋 I struggled with installing psycopg2 on the new Apple Mac M1. The solution that finally worked for me for installing not only psycopg2, but also other packages (e.g. pandas and numpy) was using Conda (miniforge3). Created a virtual environment with conda, installed these packages that were having some problems with the M1 (such as psycopg2) with |
Hi, I'm able to install "psycopg2-binary" locally but getting error while installing the same in a virtual environment.
Using M1 with python3.9 |
Any luck with that update? Tried all of the above and not working for me. I have lots of nice new packages though. |
Psycopg 2.9 has been released, which should solve the build problem with Mac OS. The binary packages are not compatible with the Apple M1 in ARM mode, but building should be fixed. See #1286 for M1 support. |
Thanks @dvarrazzo |
You are great bro... was getting frustrated over this. Thanks a lot |
What worked for me on Mac: $ brew install postgresql $ brew link openssl For compilers to find [email protected] you may need to set: For pkg-config to find [email protected] you may need to set: Then I downloaded and installed PG Admin from https://www.pgadmin.org/download/ |
This issue still persists
|
pip install --upgrade wheel |
This solved the issue for me. |
Thanks, it worked for me |
I am using macOS Big Sur 11.5.2 and this worked for me
(which installed
|
@thebogdan out of curiosity:
thank you |
nope. unfortunately not. |
Here's what worked for me:
check
|
This problem may be from not installed postgre (I use postgre from docker), cause install postgre |
A lot of answers, suggest installing Anyway, My solution was to install $ brew install libpq add the libpq binaries path to your $ echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc Restart your Terminal (or reload shell) and install the package $ pip3 install psycopg2-binary --force-reinstall --no-cache-dir |
@DarkSuniuM I haven't try yet but I guess it's safe to uninstall postgresql after psycopg2-binary was successfully installed(?) |
Yes, it is, but if you have multiple projects inside of multiple virtual envs, then you wanna keep it installed for the sake of next projects, Also, as you read in my response, you can replace it with |
The idea to use libqp is a lot better than using postgres, but you will need to install openssl too
and set the path for the same as mentioned in above comments, which in my case had a different path compared to what is mentioned above.
After this I am able to use both |
This comment was marked as off-topic.
This comment was marked as off-topic.
Bumps [psycopg2-binary](https://github.com/psycopg/psycopg2) from 2.9.1 to 2.9.2. <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.2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>Raise <code>ValueError</code> for dates >= Y10k (:ticket:<code>[#1307](https://github.com/psycopg/psycopg2/issues/1307)</code>).</li> <li><code>~psycopg2.errorcodes</code> map and <code>~psycopg2.errors</code> classes updated to PostgreSQL 14.</li> <li>Add preliminary support for Python 3.11 (:tickets:<code>[#1376](psycopg/psycopg2#1376), [#1386](https://github.com/psycopg/psycopg2/issues/1386)</code>).</li> <li>Wheel package compiled against OpenSSL 1.1.1l and PostgreSQL 14.1 (:ticket:<code>[#1388](https://github.com/psycopg/psycopg2/issues/1388)</code>).</li> </ul> <p>What's new in psycopg 2.9.1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <p>Fix regression with named <code>sql.Placeholder</code> (:ticket:<code>[#1291](https://github.com/psycopg/psycopg2/issues/1291)</code>).</p> <h2>What's new in psycopg 2.9</h2> <ul> <li><code>with connection</code> starts a transaction on autocommit transactions too (:ticket:<code>[#941](https://github.com/psycopg/psycopg2/issues/941)</code>).</li> <li>Timezones with fractional minutes are supported on Python 3.7 and following (:ticket:<code>[#1272](https://github.com/psycopg/psycopg2/issues/1272)</code>).</li> <li>Escape table and column names in <code>~cursor.copy_from()</code> and <code>~cursor.copy_to()</code>.</li> <li>Connection exceptions with sqlstate <code>08XXX</code> reclassified as <code>~psycopg2.OperationalError</code> (a subclass of the previously used <code>~psycopg2.DatabaseError</code>) (:ticket:<code>[#1148](https://github.com/psycopg/psycopg2/issues/1148)</code>).</li> <li>Include library dirs required from libpq to work around MacOS build problems (:ticket:<code>[#1200](https://github.com/psycopg/psycopg2/issues/1200)</code>).</li> </ul> <p>Other changes:</p> <ul> <li>Dropped support for Python 2.7, 3.4, 3.5 (:tickets:<code>[#1198](psycopg/psycopg2#1198), [#1000](psycopg/psycopg2#1000), [#1197](https://github.com/psycopg/psycopg2/issues/1197)</code>).</li> <li>Dropped support for mx.DateTime.</li> <li>Use <code>datetime.timezone</code> objects by default in datetime objects instead of <code>~psycopg2.tz.FixedOffsetTimezone</code>.</li> <li>The <code>psycopg2.tz</code> module is deprecated and scheduled to be dropped in the next major release.</li> <li>Provide :pep:<code>599</code> wheels packages (manylinux2014 tag) for i686 and x86_64 platforms.</li> <li>Provide :pep:<code>600</code> wheels packages (manylinux_2_24 tag) for aarch64 and ppc64le platforms.</li> <li>Wheel package compiled against OpenSSL 1.1.1k and PostgreSQL 13.3.</li> <li>Build system for Linux/MacOS binary packages moved to GitHub Actions.</li> </ul> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/psycopg/psycopg2/commits">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.1&new-version=2.9.2)](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 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>
This worked for me |
Environment:
When I attempt to pip-install psycopg2-binary with in a venv, the installer instead tries to compile psycopg2 and fails for me as I don't have PostgreSQL installed:
I can get around this using the
SYSTEM_VERSION_COMPAT=1
env var. That sets the macOS version to 10.16 instead of 11.0:Note, I haven't tested using this psycopg2-binary on Big Sur yet. I'm running into install issues with Pillow that I'm sorting out too. (How I wish I didn't upgrade to Big Sur yet!)
The text was updated successfully, but these errors were encountered: