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

UserWarning: The psycopg2 wheel package will be renamed from release 2.8 #844

Closed
3 tasks done
ncFoCo opened this issue Feb 20, 2018 · 22 comments
Closed
3 tasks done

Comments

@ncFoCo
Copy link

ncFoCo commented Feb 20, 2018

Description

The psycopg2 package display's a user warning when calling pgcli. They have a blog post describing why this warning is displayed: http://initd.org/psycopg/articles/2018/02/08/psycopg-274-released/.

Warning Message

UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.

Your environment

  • pgcli is installed in a virtual environment in my home .local folder.
  • Symlink pgcli in my .local/bin folder to the virtual instance of pgcli.

System Information

  • Please provide your OS and version information.
    Ubuntu 16.04.3 LTS (xenial, x86_64)

  • Please provide your CLI version.
    pgcli Version: 1.8.2

  • What is the output of pip freeze command.

cli-helpers==1.0.1
click==6.7
configobj==5.0.6
humanize==0.5.1
pgcli==1.8.2
pgspecial==1.9.0
prompt-toolkit==1.0.15
psycopg2==2.7.4
Pygments==2.2.0
setproctitle==1.1.10
six==1.11.0
sqlparse==0.2.4
tabulate==0.8.2
terminaltables==3.1.0
wcwidth==0.1.7
@ncFoCo
Copy link
Author

ncFoCo commented Feb 20, 2018

Downgrading to psycopg2 v2.7.3.2 avoids the warning (pip install psycopg2==2.7.3.2). But, it would be preferable to stick with the most recent psycopg2 package.

@pshlykov
Copy link

pshlykov commented Mar 1, 2018

Do you guys know if this warning can be suppressed?

Thanks!

@ncFoCo
Copy link
Author

ncFoCo commented Mar 1, 2018

@pshlykov If you are running pglci from a virtual environment you can install psycopg2 v2.7.3.2 to get around the warning. By default, pgcli will install the latest version of psycopg2.

@amjith
Copy link
Member

amjith commented Mar 2, 2018

I'll change the dependency to psycopg2-binary.

Thanks for reporting.

@pshlykov
Copy link

pshlykov commented Mar 2, 2018

Thanks @ncFoCo @amjith

@j-bennet
Copy link
Contributor

j-bennet commented Mar 4, 2018

Released in 1.9.0.

@j-bennet j-bennet closed this as completed Mar 4, 2018
@mbertheau
Copy link

@amjith Changing the dependency to psycopg2-binary excludes people that have problems with the psycopg2 binary wheel package from using pgcli >= 1.9.0.

Since binary wheels were introduced in psycopg2 just one year ago, I think it's more reasonable to continue to depend on psycopg2, which will be a source-only package starting from 2.8. This will emit a warning until psycopg2 2.8 is released, which is discussed in this ticket and on the psycopg2 homepage linked above.

@GIS90
Copy link

GIS90 commented Mar 29, 2018

pip install psycopg2 (2.7.4)
pip install psycopg2-binary (2.7.4)
I install the 2.7.4 version,but the promble is not solve
pip list:
pbr (4.0.0)
pika (0.11.2)
pip (8.1.1)
psycopg2 (2.7.4)
psycopg2-binary (2.7.4)
pyasn1 (0.4.2)
pyasn1-modules (0.2.1)
python-ldap (3.0.0)
python-mimeparse (1.6.0)

help

@mrsofia
Copy link

mrsofia commented May 25, 2018

@GIS90 Uninstall the old psycopg2 package; your system should switch to using the -binary package automatically.

@mjperpinosa
Copy link

pip install psycopg2-binary

@Navkant007
Copy link

Navkant007 commented Jul 11, 2018

this problem might be coz of you did not migrate your database
-$ ./manage.py migrate (for djnago)

@robvdl
Copy link

robvdl commented Sep 25, 2018

I know that adding to this post probably won't help, but I actually want to stick with psycopg2 (not use the binary) but get rid of that really annoying warning.

I actually ran into an unusual edge-case where the psycopg2-binary wheel didn't work properly for me in one particular project only (got some strange byte alignment error, I guess this is why the wheel version didn't work that well).

Does this really mean I have to put up with the warning until version 2.8 is released.

edit: I was actually forced to install 2.6.2 (the last version before the switch to wheels) in this project because the wheel version had the alignment error come up, so really the 2.8 release is quite important for me and hope it's soon as it fixes this mess.

@j-bennet
Copy link
Contributor

The warning is silenced in pgcli (starting 1.10.0): #894.

@mrsofia
Copy link

mrsofia commented Sep 25, 2018

@GIS90 Uninstall the old psycopg2 package; your system should switch to using the -binary package automatically.

May I ask why this was downvoted? In the interest of education.

@EscapeLife
Copy link

The error message notification starting with version 2.8 of psycopg2 requires the following installation.

pip install psycopg2-binary

If you're using version 2.x being, can ignore this warning tip.

@revmischa
Copy link

How do you silence this warning if you want to use psycopg2 source?

@j-bennet
Copy link
Contributor

j-bennet commented Apr 2, 2019

Not sure. I attempted to silence them before:

warnings.filterwarnings("ignore", category=UserWarning, module='psycopg2')

that trick worked for a little bit and then stopped. You're welcome to try and poke around some more with warnings. If you find the right way to do that, we'll welcome a PR!

@robvdl
Copy link

robvdl commented Apr 2, 2019

It still works @j-bennet it just has to be one of the first things that loads when your app starts up. I had to move some code to ensure the warnings.filterwarning(...) loaded first when starting the app and use this in several applications.

Edit: I don't know why pgcli imports from pgspecial.namedqueries before the filterwarnings statement, this also doesn't really follow python imports grouping convention where only standard lib imports should be first

@ddimmich
Copy link

Would it be possible to allow either to be used? My project depends on the binary version and having to have both installed for pgcli is a bit of a nuisance. Would be appreciated.

@sitthykun
Copy link

Because of I did rebuild from source of psycopg 2.8.3, then my project raised the message too.
I removed pycache, it was fine for me.
rm -rf pycache/

@shristising
Copy link

Because of I did rebuild from source of psycopg 2.8.3, then my project raised the message too.
I removed pycache, it was fine for me.
rm -rf pycache/

This solution worked for me.

@Sushang-Agnihotri
Copy link

uninstall psycopg2 :
pip uninstall psycopg2

install psycopg2-binary:
install pip install psycopg2-binary

system switch using the psycopg2-binary package automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests