Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

pipenv errors with the latest psycopg2 #100

Open
sushruthajirnis opened this issue Apr 9, 2019 · 7 comments
Open

pipenv errors with the latest psycopg2 #100

sushruthajirnis opened this issue Apr 9, 2019 · 7 comments

Comments

@sushruthajirnis
Copy link

The latest psycopg2 v2.8 is giving me the following error when used as

pipenv install psycopg2

writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'", " Error: b'You need to install postgresql-server-dev-NN for building a server-side extension or libpq-dev for building a client-side application.\n'", ' ', ' ----------------------------------------']
[pipenv.exceptions.InstallError]: ['Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-hgl80c2q/psycopg2/']

I will stick with the 2.7.7 the last stable release that worked for me for now. Wondering if this was just me

@akshaybabloo
Copy link
Contributor

Looks more like a binary file missing problem, maybe also opening a ticket at https://github.com/heroku/heroku-buildpack-python would help.

@sushruthajirnis
Copy link
Author

sushruthajirnis commented Apr 9, 2019

And then I saw this
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
I will make the changes then ?

@sushruthajirnis
Copy link
Author

pipenv install psycopg2-binary didn't solve the issue .. sorry for the back and forth

@joaquimsage
Copy link

Same issue, I could not install this package within the pipenv within a Django project:

nstalling psycopg2… Adding psycopg2 to Pipfile's [packages]… ✔ Installation Succeeded Pipfile.lock (0c6512) out of date, updating to (701bde)… Locking [dev-packages] dependencies… Locking [packages] dependencies… ✔ Success! Updated Pipfile.lock (0c6512)! Installing dependencies from Pipfile.lock (0c6512)… An error occurred while installing psycopg2==2.8.3 --hash=sha256:128d0fa910ada0157bba1cb74a9c5f92bb8a1dca77cf91a31eb274d1f889e001 --hash=sha256:227fd46cf9b7255f07687e5bde454d7d67ae39ca77e170097cdef8ebfc30c323 --hash=sha256:2315e7f104681d498ccf6fd70b0dba5bce65d60ac92171492bfe228e21dcc242 --hash=sha256:4b5417dcd2999db0f5a891d54717cfaee33acc64f4772c4bc574d4ff95ed9d80 --hash=sha256:640113ddc943522aaf71294e3f2d24013b0edd659b7820621492c9ebd3a2fb0b --hash=sha256:897a6e838319b4bf648a574afb6cabcb17d0488f8c7195100d48d872419f4457 --hash=sha256:8dceca81409898c870e011c71179454962dec152a1a6b86a347f4be74b16d864 --hash=sha256:b1b8e41da09a0c3ef0b3d4bb72da0dde2abebe583c1e8462973233fd5ad0235f --hash=sha256:cb407fccc12fc29dc331f2b934913405fa49b9b75af4f3a72d0f50f57ad2ca23 --hash=sha256:d3a27550a8185e53b244ad7e79e307594b92fede8617d80200a8cce1fba2c60f --hash=sha256:f0e6b697a975d9d3ccd04135316c947dd82d841067c7800ccf622a8717e98df1! Will try again. 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 45/45 — 00:00:04 Installing initially failed dependencies… [pipenv.exceptions.InstallError]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1992, in do_install [pipenv.exceptions.InstallError]: skip_lock=skip_lock, [pipenv.exceptions.InstallError]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1253, in do_init [pipenv.exceptions.InstallError]: pypi_mirror=pypi_mirror, [pipenv.exceptions.InstallError]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv/core.py", line 859, in do_install_dependencies [pipenv.exceptions.InstallError]: retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs [pipenv.exceptions.InstallError]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv/core.py", line 763, in batch_install [pipenv.exceptions.InstallError]: _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry) [pipenv.exceptions.InstallError]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv/core.py", line 681, in _cleanup_procs [pipenv.exceptions.InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines) [pipenv.exceptions.InstallError]: ['Collecting psycopg2==2.8.3 (from -r /var/folders/78/52r9h_5d07x2hkgzsbp1b6fw0000gn/T/pipenv-8rnfnlyt-requirements/pipenv-_ii68_lm-requirement.txt (line 1))', ' Using cached https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz'] [pipenv.exceptions.InstallError]: ['ERROR: Command errored out with exit status 1:', ' command: /Users/quino/.local/share/virtualenvs/pegg_qna_daily_report-a4XpLzmr/bin/python3 -c \'import sys, setuptools, tokenize; sys.argv[0] = \'"\'"\'/private/var/folders/78/52r9h_5d07x2hkgzsbp1b6fw0000gn/T/pip-install-toliiptr/psycopg2/setup.py\'"\'"\'; __file__=\'"\'"\'/private/var/folders/78/52r9h_5d07x2hkgzsbp1b6fw0000gn/T/pip-install-toliiptr/psycopg2/setup.py\'"\'"\';f=getattr(tokenize, \'"\'"\'open\'"\'"\', open)(__file__);code=f.read().replace(\'"\'"\'\\r\\n\'"\'"\', \'"\'"\'\\n\'"\'"\');f.close();exec(compile(code, __file__, \'"\'"\'exec\'"\'"\'))\' egg_info --egg-base pip-egg-info', ' cwd: /private/var/folders/78/52r9h_5d07x2hkgzsbp1b6fw0000gn/T/pip-install-toliiptr/psycopg2/', ' Complete output (23 lines):', ' running egg_info', ' creating pip-egg-info/psycopg2.egg-info', ' writing pip-egg-info/psycopg2.egg-info/PKG-INFO', ' writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt', ' writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt', " writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'", ' ', ' Error: pg_config executable not found.', ' ', ' pg_config is required to build psycopg2 from source. Please add the directory', ' containing pg_config to the $PATH or specify the full executable path with the', ' option:', ' ', ' python setup.py build_ext --pg-config /path/to/pg_config build ...', ' ', " or with the pg_config option in 'setup.cfg'.", ' ', ' If you prefer to avoid building psycopg2 from source, please install the PyPI', " 'psycopg2-binary' package instead.", ' ', " For further information please check the 'doc/src/install.rst' file (also at", ' <http://initd.org/psycopg/docs/install.html>).', ' ', ' ----------------------------------------', 'ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.'] ERROR: ERROR: Package installation failed...

@MalikRumi
Copy link

MalikRumi commented Sep 23, 2019 via email

@laymonage
Copy link

I'm pretty sure installing psycopg2-binary should solve the issue. If you've installed psycopg2-binary, you don't need to install psycopg2 anymore, and vice versa. Use psycopg2 if you want to install psycopg2 from source, but you'll need to have the libpq-dev or postgresql-server-dev packages installed on your system, otherwise just stick with psycopg2-binary (which is what this template uses anyway).

@antoni-minkiewicz
Copy link

Try using:

$sudo apt-get install libpq-dev

That worked for me.

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

No branches or pull requests

6 participants