I am trying to install django-heroku on my Mac but am getting the below error - psycopg2

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.
I am a beginner so my knowledge is pretty loose on all factors above. A simplified step-by-step explanation would be much appreciated.

You can try pip install psycopg2-binary then install django-heroku again.
The error is just simply saying that your computer can't find psycopg2-binary package

Related

How to fix VercelEerror python setup.py egg_info did not run successfully

I'm trying to deploy a Django web app on Vercel, but the deployment fails with the following message:
Error: enter code hereCommand failed: pip3.9 install --disable-pip-version-check
--target . --upgrade -r /vercel/path0/requirements.txt error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [23 lines of output]
running egg_info
creating /tmp/pip-pip-egg-info-xergdc3a/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-xergdc3a/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-xergdc3a/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-xergdc3a/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-xergdc3a/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>).
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
Can someone help me?

Installing python package from github

How to install this package from git hub, please?
https://github.com/oimodeler/oimodeler/tree/main/docs
I assume that somehow through docs directory.
Edit after advice:
When I ran
bash-5.1$ pwd
.../oimodeler-main
bash-5.1$ ls
docs examples images LICENSE oimodeler README.md setup.py
bash-5.1$ python setup.py install
.../.local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
.../.local/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python3.9'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python3.9/site-packages/
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
The next try:
bash-5.1$ python setup.py install --user,
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --user, not recognized
bash-5.1$ python setup.py install --user
/home/username/.local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/home/username/.local/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
listing git files failed - pretending there aren't any
zip_safe flag not set; analyzing archive contents...
I am using Feroda 34.

python postgresql module install on MAC OS is failing [duplicate]

This question already has answers here:
Can't install psycopg2-binary on macOS Monterey 12.3
(2 answers)
Closed 11 months ago.
i am trying to install psycopg2-binary module on my Mac OS. install is failing with below error message.
Any help to resolve this error?
pip install psycopg2-binary
Defaulting to user installation because normal site-packages is not writeable
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running egg_info
creating /private/var/folders/1s/xllnfc3n1j988pnws9g93tfm77pffn/T/pip-pip-egg-info-7b1acytt/psycopg2_binary.egg-info
writing /private/var/folders/1s/xllnfc3n1j988pnws9g93tfm77pffn/T/pip-pip-egg-info-7b1acytt/psycopg2_binary.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/1s/xllnfc3n1j988pnws9g93tfm77pffn/T/pip-pip-egg-info-7b1acytt/psycopg2_binary.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/1s/xllnfc3n1j988pnws9g93tfm77pffn/T/pip-pip-egg-info-7b1acytt/psycopg2_binary.egg-info/top_level.txt
writing manifest file '/private/var/folders/1s/xllnfc3n1j988pnws9g93tfm77pffn/T/pip-pip-egg-info-7b1acytt/psycopg2_binary.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>).
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
Thanks
SR
I think the issue may be related to your question, and it seems that a is also provided there. https://github.com/psycopg/psycopg2/issues/1286
You may also try to build psycopg2 from source following the instruction. https://www.psycopg.org/docs/install.html#prerequisites

Can not install psycopg2 on Mac 12.3, I keep getting this error

Ive recently bought a MacBook Pro and was setting it up for some python and Django programming but I ended up having problems installing psycopg2, I've tried several things already and none of those worked for me, here left the error,
Collecting psycopg2
Using cached psycopg2-2.9.3.tar.gz (380 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running egg_info
creating /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info
writing /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/dependency_links.txt
writing top-level names to /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/top_level.txt
writing manifest file '/private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/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>).
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
It shows it is not a problem with pip but with setup.py but can not find anything,
any help would be welcomed
Thanks
As Alex mentioned, it is PostGreSQL being not installed on your system that throws up the error
Install PostGreSQL and it will all work fine
Try this
❯ brew install postgresql
# If you open a new terminal tab you will see that pg_config is available
❯ export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
❯ export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib -L${HOME}/.pyenv/versions/3.8.10/lib"
❯ python -V
Python 3.9.13
❯ pip install psycopg2-binary==2.8.6```
Try using the following command:
pip3 install psycopg2-binary
Late, but I just had this problem and nothing I was finding was fixing it. I was trying to install the requirements.txt for an ongoing project on a new Mac. Eventually I remembered it's a postgresql package and I hadn't installed postgresql yet. As soon as I installed postgresql and tried installing psycopg2 again, it worked fine with no errors.

Installing Fiona on python virtualenv using Windows

I created a virtual environment of python on my Windows computer. I successfully downloaded GDAL 2.4.1 and linked it to python, I am trying to install Fiona using
pip install fiona
but I get this:
ERROR: Complete output from command python setup.py egg_info:
ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in
C:\Users\marcb\AppData\Local\Temp\pip-install-dua0wlxg\fiona\
Any thoughts on what to do? I need to use the virtualenv and not conda (I already have it successfully installed on anaconda)

Resources