python setup.py install inside a nix-shell

401 Views Asked by At

I have a shell built with nix-shell foo.nix. I would now like to install a python package with the classic python setup.py install. When I attempt this I get the message [Errno 13] Permission denied: '/nix/store/kp0qz36y3cwbhwb65sw5f2vqbbnhs8dg-python3-3.7.11-env/lib/python3.7/site-packages/test-easy-install-30257.write-test'

I can do this python setup.py install --prefix=$out --root=$out which seems to succeed, however I'm unable to import the package I just installed.

How can I install this package, either by modifying foo.nix or just manually doing something within the nix shell.

On the advice of Charles Duffy I have attempted to do all this in a virtualenv and it behaves in the same way. python setup.py install in the virtualenv gives me [Errno 13] Permission denied: '/nix/store/kp0qz36y3cwbh....

If I install with python setup.py install --prefix=$VIRTUAL_ENV it appears to work but I cannot import the package. Same with the --user option. I guess I could go and just manually edit the python path to force this to work, but that's not ideal.

0

There are 0 best solutions below