Flake output "ImportError: No module named site" from Python 2

Hello Nix(OS)!

I am running into some problems while trying to extend a nix flake 1 to
build and run GNAT Programming Studio 2. Latest work is in this PR 3.

So far I have been able to compile GPS.

When I try to run ./result/bin/gnatstudio, I get:

ImportError: No module named site

I am running this after I have done either

nix develop .

or

nix build .#gps

Will attach the strace output.

Adding paths to PYTHONPATH blindly:

/nix/store/pwm8fm01qygiwf86dq6ybnnfrpkv9vhh-python2.7-pip-20.1.1/lib/python2.7/site-packages/pip/_vendor/urllib3
/nix/store/pwm8fm01qygiwf86dq6ybnnfrpkv9vhh-python2.7-pip-20.1.1/lib/python2.7/site-packages
/nix/store/5r503z502ign3045p957svdajs574fny-python-2.7.18/lib/python2.7

Gets me futher, although I don’t think this should be the proper fix:

Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named gi
Unexpected fatal error, GPS is in an inconsistent state
raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : python_module.adb:396
[/nix/store/awm4f3lk7sd1ymqh3w2xk5wz1yv178im-gnat-10.2.0/lib/gcc/x86_64-unknown-linux-gnu/10.2.0/adalib/libgnat-10.so]
0x7f67a9167fc2
[./result/bin/gnatstudio]
0x4433724
0x17247b5
0x1716b84
[/nix/store/3hnwfj60lj67izbw3ncwrhiyd6qw6vxq-gtkada/lib/gtkada/gtkada.relocatable/gtkada/libgtkada.so.18.0w]
0x7f67accd3b3f
[/nix/store/20xzw51lk1amp13p7li35a5jdrjj8qp0-glib-2.64.5/lib/libgobject-2.0.so.0]
0x7f67a953aec0
0x7f67a954ddc2
0x7f67a9558b16
0x7f67a955997d
[/nix/store/20xzw51lk1amp13p7li35a5jdrjj8qp0-glib-2.64.5/lib/libgio-2.0.so.0]
0x7f67a965b581
0x7f67a965d9be
[./result/bin/gnatstudio]
0x16ebe85
0x1741309
[/nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libc.so.6]
0x7f67a8d36c7b
[./result/bin/gnatstudio]
0x16e4218
0xfffffffffffffffe

Any help is appreciated. :slight_smile:

EDIT: I can’t find how to attach a file, so here’s the strace:

https://zerobin.net/?219f6468a1d188a9#iKFD5DSULTxKdxniLycvEyM0ZlqCxi/PlWQ1bAmfOtk=