heroku / heroku-django-template

A Django 2.0 base template featuring all recommended best practices for deployment on Heroku and local development.
https://www.heroku.com/python
903 stars 385 forks source link

pipenv errors with the latest psycopg2 #100

Open sushruthajirnis opened 5 years ago

sushruthajirnis commented 5 years ago

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 commented 5 years ago

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

sushruthajirnis commented 5 years ago

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 commented 5 years ago

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

joaquimsage commented 5 years ago

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: 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: 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': ['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 commented 5 years ago

I'm late to the party, but I just saw this catching up on my email. I had an issue at the end of June, and it might be related, or at least provide some helpful clues. Basically, I'm wondering if the issues I had extend to the template and any local Heroku operations? Here is what Heroku Support told me:

Thank you for your interest, and I’m sorry to hear about this pain. We are aware of the issues with Pipenv, however we have been waiting for a more stable release to come out before updating.

Sorry for the trouble as I can check your current build log failed due to Your Pipfile.lock (b6cd14) is out of date. Expected: (9ecf4b). error.

Please be aware however that the recommended way to manage deployments on Heroku is to use the requirements.txt flow, for the best deployment experience.

To migrate to the the recommended deployment flow, simply run pip freeze > requirements.txt from your project's root directory, then from the same location, run echo python-X.X.X > runtime.txt where X.X.X is your version of Python. You can continue to use any local environment manager you prefer.

“None of you has faith until he loves for his brother or his neighbor what he loves for himself.”

On Wed, Aug 7, 2019 at 7:34 AM Joaquim Forcada notifications@github.com wrote:

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

"/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)

"/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': ['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...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/heroku/heroku-django-template/issues/100?email_source=notifications&email_token=ABJYQ6SX2GMGFMMYZBRCMOTQDK6MLA5CNFSM4HEOJ7I2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3YHVRQ#issuecomment-519076550, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJYQ6RCQMELUP6X3TLNGSDQDK6MLANCNFSM4HEOJ7IQ .

laymonage commented 4 years ago

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 commented 4 years ago

Try using:

$sudo apt-get install libpq-dev

That worked for me.