-1

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.

Srijan113
  • 89
  • 8

1 Answers1

0

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.

Priyanshu Jain
  • 663
  • 10
  • 18
  • While this might be relevant for system-level Python installs, Conda environment installs will automatically manage such dependencies if one uses `conda install` - it's kind of the point of Conda. Moreover, even were this the solution, this should be a comment as a suggested duplicate, rather than an answer. – merv Oct 14 '20 at 22:14
  • 1
    @merv Sure, Thanks for pointing out. I didn't know if conda works like a PaaS for python applications. But for original setup it require to install dev packages. – Priyanshu Jain Oct 15 '20 at 05:32