how can we slove this path error of psycopg2 in linux? - python

I am using conda package and while trying to install psycopg2 i got this error.
I want this for postgis and i am running on ubuntu.
ERROR: Command errored out with exit status 1:
command: /home/srijan/anaconda3/envs/django/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s5yimrpg/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-s5yimrpg/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-cop18avg
cwd: /tmp/pip-install-s5yimrpg/psycopg2/
Complete output (14 lines):
running egg_info
creating /tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-cop18avg/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
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'.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Installing python-dev(it might be python3-dev, install according to your current python version) and libpq-dev should solve your problem.
Also Check out this stackoverflow question pg_config executable not found. It talks about the same problem.

Related

Python not recognizing pkg-config has been installed

I am unable to get python to recognize that pkg-config has been installed. The end goal is to be able to download the python-binance-chain library: https://github.com/sammchardy/python-binance-chain but at this moment when I use pip to install the library I receive the following error message:
ERROR: Command errored out with exit status 1:
command: 'c:\users\jpeterson\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\jpeterson\\AppData\\Local\\Temp\\pip-install-0459uu9t\\secp256k1_ba55524266274c10b617991dff5a4d87\\setup.py'"'"'; __file__='"'"'C:\\Users\\jpeterson\\AppData\\Local\\Temp\\pip-install-0459uu9t\\secp256k1_ba55524266274c10b617991dff5a4d87\\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 'C:\Users\jpeterson\AppData\Local\Temp\pip-pip-egg-info-fzc7jgqc'
cwd: C:\Users\jpeterson\AppData\Local\Temp\pip-install-0459uu9t\secp256k1_ba55524266274c10b617991dff5a4d87\
Complete output (1 lines):
'pkg-config' is required to install this package. Please see the README for details.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I have downloaded the following pkg-config files:
pkg-config_0.26-1_win32
glib_2.28.8-1_win32
gettext-runtime_0.18.1.1-2_win32
However but I don't know where they need to be for python to recognize that pkg-config has been installed. I have referred to the following stackoverflow inquiry: How to install pkg config in windows? but would ideally not have to install a number of different tools, especially considering I am not sure if they will enable the end goal of installing the python-binance-chain library.

I am trying to install psycopg2 in windows and getting error

I am firing following command and it's showing the same for psycopg2-binary
(demo) C:\Users\Lenovo\Desktop\Django>pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.8.6.tar.gz (383 kB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\lenovo\desktop\django\demo\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-pq1_j08j\\psycopg2\\setup.py'"'"'; __file__='"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-pq1_j08j\\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 'C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5'
cwd: C:\Users\Lenovo\AppData\Local\Temp\pip-install-pq1_j08j\psycopg2\
Complete output (23 lines):
running egg_info
creating C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\psycopg2.egg-info
writing C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\psycopg2.egg-info\PKG-INFO
writing dependency_links to C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\psycopg2.egg-info\dependency_links.txt
writing top-level names to C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\psycopg2.egg-info\top_level.txt
writing manifest file 'C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\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
<https://www.psycopg.org/docs/install.html>).
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Maybe this will help(pip install psycopg2). As I understand, there is kind of answer (pg_config executable not found).Maybe I'm wrong (99% guarantee, that I'm wrong, just because I'm new one in programming).

Trouble installing django-heroku

I am trying to deploy my django application to heroku.
When I try to pip install django-heroku, it gives me this error:
ERROR: Command errored out with exit status 1:
command: /Users/huntermackenzie/Dev/personal/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/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 /private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/psycopg2/pip-egg-info
cwd: /private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/psycopg2/
Complete output (23 lines):
running egg_info
creating /private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/psycopg2/pip-egg-info/psycopg2.egg-info
writing /private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file '/private/var/folders/15/k9lcjv5129v661mkkrsdt09w0000gn/T/pip-install-v2fvrgwp/psycopg2/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
<https://www.psycopg.org/docs/install.html>).
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Trying to pip install psycopg2 gives me the same error.
Can someone please help me. Thank you.
The error message suggests
pip install psycopg2-binary
have you tried it?

ERROR: Command errored out with exit status 1:

i am installing connector of Psycopg2 but i am unable install, how do i install that successfully?
in using this command line to install:
pip install psycopg2
(test) C:\Users\Shree.Shree-PC\Desktop\projects\purchasepo>pip install psycopg2
Collecting psycopg2
Using cached https://files.pythonhosted.org/packages/84/d7/6a93c99b5ba4d4d22daa3928b983cec66df4536ca50b22ce5dcac65e4e71/psycopg2-2.8.4.tar
.gz
ERROR: Command errored out with exit status 1:
command: 'c:\users\shree.shree-pc\envs\test\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Shr
ee.Shree-PC\\AppData\\Local\\Temp\\pip-install-_bgz1zs9\\psycopg2\\setup.py'"'"'; __file__='"'"'C:\\Users\\Shree.Shree-PC\\AppData\\Local\\T
emp\\pip-install-_bgz1zs9\\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 'C:\Users\Shree.Shree-PC\AppData\Local\Temp\pip-
install-_bgz1zs9\psycopg2\pip-egg-info'
cwd: C:\Users\Shree.Shree-PC\AppData\Local\Temp\pip-install-_bgz1zs9\psycopg2\
Complete output (23 lines):
running egg_info
creating C:\Users\Shree.Shree-PC\AppData\Local\Temp\pip-install-_bgz1zs9\psycopg2\pip-egg-info\psycopg2.egg-info
writing C:\Users\Shree.Shree-PC\AppData\Local\Temp\pip-install-_bgz1zs9\psycopg2\pip-egg-info\psycopg2.egg-info\PKG-INFO
writing dependency_links to C:\Users\Shree.Shree-PC\AppData\Local\Temp\pip-install-_bgz1zs9\psycopg2\pip-egg-info\psycopg2.egg-info\depe
ndency_links.txt
writing top-level names to C:\Users\Shree.Shree-PC\AppData\Local\Temp\pip-install-_bgz1zs9\psycopg2\pip-egg-info\psycopg2.egg-info\top_l
evel.txt
writing manifest file 'C:\Users\Shree.Shree-PC\AppData\Local\Temp\pip-install-_bgz1zs9\psycopg2\pip-egg-info\psycopg2.egg-info\SOURCES.t
xt'
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.
command line is correct
path should be checked and perhaps psycopg2 needs a visual C ++ build tools update from https://visualstudio.microsoft.com/visual-cpp-build-tools/
I had this problem when I installed python 3.10.0
if you are using python 3.10:
currently psycopg doesn't support python 3.10
The current psycopg2 implementation supports:
1.Python versions from 3.6 to 3.9
2.PostgreSQL server versions from 7.4 to 13
3.PostgreSQL client library version from 9.1
source : https://www.psycopg.org/docs/install.html
and if you're using windows with any version of python but 3.10 please try install psycopg2 by running :
pip install psycopg2-binary

Django postgres connector psycopg2

As i run pip install psycopg2 in my django virtualven in windows it start downloading and at the end of downloading this Error comes
|████████████████████████████████| 430kB 61kB/s
ERROR: Command errored out with exit status 1:
command: 'c:\users\tusha\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tusha\\AppData\\Local\\Temp\\pip-install-hoeubopv\\psycopg2\\setup.py'"'"'; __file__='"'"'C:\\Users\\tusha\\AppData\\Local\\Temp\\pip-install-hoeubopv\\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 'C:\Users\tusha\AppData\Local\Temp\pip-install-hoeubopv\psycopg2\pip-egg-info'
cwd: C:\Users\tusha\AppData\Local\Temp\pip-install-hoeubopv\psycopg2\
Complete output (23 lines):
running egg_info
creating C:\Users\tusha\AppData\Local\Temp\pip-install-hoeubopv\psycopg2\pip-egg-info\psycopg2.egg-info
writing C:\Users\tusha\AppData\Local\Temp\pip-install-hoeubopv\psycopg2\pip-egg-info\psycopg2.egg-info\PKG-INFO
writing dependency_links to C:\Users\tusha\AppData\Local\Temp\pip-install-hoeubopv\psycopg2\pip-egg-info\psycopg2.egg-info\dependency_links.txt
writing top-level names to C:\Users\tusha\AppData\Local\Temp\pip-install-hoeubopv\psycopg2\pip-egg-info\psycopg2.egg-info\top_level.txt
writing manifest file 'C:\Users\tusha\AppData\Local\Temp\pip-install-hoeubopv\psycopg2\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 PyPIe install the PyPI
'psycopg2-binary' package instead.
st' file (also at
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
egg_info Check the logs for full command outpu
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py
egg_info Check the logs for full command output.
so how to solve this ERROR
Try this:
pip install psycopg2-binary

Categories

Resources