Hi everyone,
I am trying the following configuration:
let
# Unstable packages
unstableTarball = fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz;
# Custom Python package with all the (Python) imports I need
my-python-packages = python-packages: with python-packages; [
...
tensorflow
];
python-with-my-packages = pkgs.python3.withPackages my-python-packages;
in
{
...
environment.systemPackages = with pkgs; [
...
python310Packages.tensorflow
]
}
I tried different combinations - placing tensorflow
within my-python-packages
; placing python310Packages.tensorflow
within environment.systemPackages
; or both. In any case, I got the following behaviour:
~ python3
Python 3.10.8 (main, Oct 11 2022, 11:35:05) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2022-12-31 09:09:08.469691: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
>>> from tensorflow.keras import Sequential
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow.keras'
Thanks
Davide