I am in the process of switching to NixOS from EndeavourOS.
I’m impressed that I was able to get NixOS running given my GPU setup (Intel Arc A380 with monitors, Nvidia RTX A4500 no monitors).
When attempting to use Tensorflow, I was having errors about missing libs, and wound up having to define LD_LIBRARY_PATH like this:
Hm.
Whether I install as Nix-native packages, or using @SergeK 's shell invocation, I still need to have LD_LIBRARY_PATH defined for it to work.
I didn’t realize that when I tried Serge’s shell yesterday.
Edit: it looks like the shell definition in the wiki still requires setting LD_LIBRARY_PATH to work.
I can create run the shell and check the tensorflow version: python -c "import tensorflow as tf; print(tf.__version__)"
and it reports 2.13.0.
I create a venv and pip install tensorflow-datasets.
When i run the above to check the TF version, I get this error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
So I pip install 'tensorflow[and-cuda]==2.15.1' and when I run the above to check the TF version, I get this error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/john/.venv/lib/python3.11/site-packages/tensorflow/__init__.py", line 45, in <module>
from tensorflow.python import tf2 as _tf2
File "/home/john/.venv/lib/python3.11/site-packages/tensorflow/python/tf2.py", line 21, in <module>
from tensorflow.python.platform import _pywrap_tf2
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
If I set LD_LIBRARY_PATH, the TF version reports as 2.15.1.
I can then run a script I have that trains a model on the MNIST dataset.
If I then unset LD_LIBRARY_PATH, and check the TF version, I receive the error above about libstdc++.so.6 being missing.
Edit: Updated configuration.nix where I commented out some duplicate declarations.
Aj, prebuilt packages from PyPi and the impure “venvs” are a separate issue. PyPi distributes software built for FHS platforms, it does require host configuration (nix-ld, nixglhost, etc in case of NixOS, or “apt-get install”-ing “system dependencies” in mainstream distributions).
The PR you linked got reverted almost immediately, so currently it doesn’t work in almost any nixpkgs version. Although I am hopeful that it’ll get fixed eventually since the main idea of the fix was fine, the problem was mostly in the implementation details.
Thanks for trying to help everyone!
I fixed this by going back to EndeavourOS.
I was spending too much time working on the tools, rather than working on the work.
Thanks again!