thenewboston-blockchain / thenewboston-python

Python library for thenewboston digital currency.
https://thenewboston.com
MIT License
104 stars 35 forks source link

Requirements have an unclear dependency on build tools #32

Closed derrick-anderson closed 3 years ago

derrick-anderson commented 3 years ago

Bug Description Project installation dependencies requirements.txt file has listed a dependency on the build library of psycopg2

When installing the project dependencies users are presented with the following error:

Collecting psycopg2==2.8.6
  Using cached psycopg2-2.8.6.tar.gz (383 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/danderson/workspace/thenewboston-python/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-57z5h7ls/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-57z5h7ls/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-install-57z5h7ls/psycopg2/pip-egg-info
         cwd: /tmp/pip-install-57z5h7ls/psycopg2/
    Complete output (23 lines):
    running egg_info
    creating /tmp/pip-install-57z5h7ls/psycopg2/pip-egg-info/psycopg2.egg-info
    writing /tmp/pip-install-57z5h7ls/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-install-57z5h7ls/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing top-level names to /tmp/pip-install-57z5h7ls/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
    writing manifest file '/tmp/pip-install-57z5h7ls/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.

Steps to Reproduce Steps to reproduce the behavior:

  1. Clone Project
  2. Create Venv using python3 -m venv venv
  3. Activate using . venv/bin/activate
  4. pip3 install -e .
  5. Observe Error.

Expected behavior All library dependencies should be expressed in the requirements file.

Actual behavior An undocumented dependency on the python buildtools prevents project setup.

OS and Code tested

Account Number d0026812cc809bc29c85da6646b288350083d47d4b9a6ab37986f50b7e486653

DucPhamTV commented 3 years ago

Have you tried this? sudo apt install libpq-dev It solved the issue for me.

derrick-anderson commented 3 years ago

That will install the build tools necessary yes, however its smaller and less friction to include the binary instead of the source as a dependency.

I did put up a pr for that change.

vosi commented 3 years ago

From

https://pypi.org/project/psycopg2-binary/

The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources.