I am attempting to install psycopg2 for use within a project. I am also using asdf in order to manage my python versions. I have tried doing this inside of a venv but I get the same error so to keep things simple let's just say I want to install it outside of a venv.
❯ cat .tool-versions
nodejs 15.9.0
python 3.10.8
postgres 11.8
❯ which pip
~/.asdf/shims/pip
❯ which pg_config
~/.asdf/shims/pg_config
❯ pg_config --version
PostgreSQL 11.8
❯ pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.9.5.tar.gz (384 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
~/.asdf/installs/python/3.10.8/lib/python3.10/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
running egg_info
creating <redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info
writing <redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info/PKG-INFO
writing dependency_links to <redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info/dependency_links.txt
writing top-level names to <redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info/top_level.txt
writing manifest file '<redacted_temp_folder>/T/pip-pip-egg-info-3tgyoyym/psycopg2.egg-info/SOURCES.txt'
Error: b'No version is set for command pg_config\n'
[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.
Everything I can find seems to revolve around installing pg_config or postgresql or some other dependency but no one else seems to have encountered this exact error. The best I can figure is that somehow the process python setup.py egg_info
is not using the same $PATH
as the root command, maybe because it's working directory is outside of the scope of my .tool-versions? Any help is appreciated.