My python3 installation cannot import modules despite apparently installing them:
Python 3.10.6 (main, Aug 1 2022, 20:38:21) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
(same as e.g.: pandas).
I followed this wiki and integrated it into my configuration, as follows:
$ nix profile list
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
The last command gives:
$ ls -l $(find "$(dirname $(which python))/.." -name site-packages)
dr-xr-xr-x 2 root root 4096 Jan 1 1970 __pycache__
-r--r--r-- 1 root root 119 Jan 1 1970 README.txt
-r--r--r-- 1 root root 1659 Jan 1 1970 sitecustomize.py
lrwxrwxrwx 1 root root 44 Jan 1 1970 _sysconfigdata__linux_x86_64-linux-gnu.py -> ../_sysconfigdata__linux_x86_64-linux-gnu.py
I don’t know if somehow having set the experimental packages declaratively on configuration.nix instead of through using nix-env may have resulted into two distict versions of pyton? But I do not know how to veryfy that.
If you were using the correct python env, there would be directories for your packages in there.
So you’re definitely not using the python from your config. The question is, what python are you using? At this point I’m not sure how to check that, unfortunately… Maybe check if which python points at a non-system profile?
Using nix-env -q, to check if you installed a second instance of python with nix-env. Your configuration looks correct to me otherwise, but sharing your full config could help spot something unusual.
I used to have vim_configurable for a while before removing it and deciding to configure vim via home-manager. Why has it remained in the system? Would it be useful (provided that it is possible) to purge the store completely and rebuild the configuration without formatting and reinstalling?
I made some test removing and adding packages to my configuration and I noticed that python lmodules do work in my configuration - if python3 is execuded from from the gnome builtin console. They do NOT work if is executed on terminator, which is the console I routinely use.
Has anyone got any idea about why terminator display this behaviour?
This could probably be fixed by changing the packaging. Instead of using the default wrapping, one would create a python3.withPackages and patch the shebang of terminator. That way the program is started with it’s own Python environment, but it won’t leak.