I need to access postgresql database but psycopg2 does not install
navilaufm

according to some ask posts, seems if I import psycopg2 it does install but when running simple app with flask it never being install.

Trying also pip install psycopg2 in console with same results.

Thanks,

best regards

`Repl.it: Updating package configuration

--> python3 -m poetry add psycopg2
Using version ^2.8.6 for psycopg2

Updating dependencies
Resolving dependencies...

Package operations: 1 install, 0 updates, 0 removals

  • Installing psycopg2 (2.8.6)

[EnvCommandError]
Command ['/opt/virtualenvs/python3/bin/pip', 'install', '--no-deps', 'psycopg2==2.8.6'] errored with the following return code 1, and output:
Collecting psycopg2==2.8.6
Using cached psycopg2-2.8.6.tar.gz (383 kB)
ERROR: Command errored out with exit status 1:
command: /opt/virtualenvs/python3/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kvz9d1gq/psycopg2/setup.py'"'"'; file='"'"'/tmp/pip-install-kvz9d1gq/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 /tmp/pip-pip-egg-info-licw2_l0
cwd: /tmp/pip-install-kvz9d1gq/psycopg2/
Complete output (23 lines):
running egg_info
creating /tmp/pip-pip-egg-info-licw2_l0/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-licw2_l0/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-licw2_l0/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-licw2_l0/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-licw2_l0/psycopg2.egg-info/SOURCES.txt'

Traceback (most recent call last):
File "main.py", line 1, in <module>
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'`

You are viewing a single comment. View All
navilaufm

@CoolCoderSJ thanks, added from repl package but don't know is the proper way as still have error, check the screen.