I am using nixOS for a little time, but coming from Ubuntu I have a hard time with binary dependencies. My problem is that I want to install psycopg2 in a virtualenv. This package is not a pure-python one and it links to postgres binaries. So when I try to install the package I get:

./psycopg/psycopg.h:31:22: fatal error: libpq-fe.h: No such file or directory

The question is - how to make the binary libs and header files available for local installations like this?


For python development I usually use combination of nix-shell and virtualenv configuration.

% nix-shell -p pythonPackages.virtualenv postgresql
(nix-shell) % virtualenv env
(nix-shell) % ./env/bin/pip install psycopg2

Important part above is you install postgresql alongside virtualenv

Some packages, like Pillow, make too much assumptions where libraries should be and you might need to use it from pythonPackages directly.

You might be also interested into pypi2nix which can convert your requirements.txt file to nix expressions. if you get stuck with it please ping me on irc, I'd love to get it tested.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.