nix-community/pip2nix

setup_requires

Opened this issue · 2 comments

Some packages (notably, mock) try to install things when their setup.py gets run.
Will they even install?
Will pip2nix catch those dependencies?

I'm not sure if this issue is related, but I've got a failure on a package called psycopg2, it needs PostgresSQL :

Collecting psycopg2==2.9.7
  Using cached psycopg2-2.9.7.tar.gz (383 kB)
    ERROR: Command errored out with exit status 1:
     command: /nix/store/h4hixxmfbsccyvwnnlgjc2sfcns0hfms-python3-3.9.0/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/run/user/1000/pip-install-tuspx8iv/psycopg2/setup.py'"'"'; __file__='"'"'/run/user/1000/pip-install-tuspx8iv/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 /run/user/1000/pip-pip-egg-info-uqgnq2ha
         cwd: /run/user/1000/pip-install-tuspx8iv/psycopg2/
    Complete output (23 lines):
    running egg_info
    creating /run/user/1000/pip-pip-egg-info-uqgnq2ha/psycopg2.egg-info
    writing /run/user/1000/pip-pip-egg-info-uqgnq2ha/psycopg2.egg-info/PKG-INFO
    writing dependency_links to /run/user/1000/pip-pip-egg-info-uqgnq2ha/psycopg2.egg-info/dependency_links.txt
    writing top-level names to /run/user/1000/pip-pip-egg-info-uqgnq2ha/psycopg2.egg-info/top_level.txt
    writing manifest file '/run/user/1000/pip-pip-egg-info-uqgnq2ha/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.

So the generation with pip2nix fails, if it's not related to this issue, I might open a new one, but I'm not sure if this can be fixed or not.

@AkechiShiro That’s a ”feature” of this approach: you may need to have suffixient extra build inputs in the shell when running pip2nix to let pop build source packages with extra dependencies.

For example, your error should be solved by running pip2nix in a nix-shell -p postgres shell.