Posts tagged ‘nixos’

TensorFlow on Nixos 4.4.14 with Python 2.7

was discussing this in #nixos yesterday and while the general consensus was it could be done no one knew exactly how so figured it out.

Basically the script from the nix os dev environments for python with virtual env is all you need:

 

with import <nixpkgs> {};
with pkgs.python27Packages;

buildPythonPackage {
name = “impurePythonEnv”;
buildInputs = [
git
swig
libxml2
libxslt
libzip
python27Full
python27Packages.virtualenv
stdenv
zlib ];
LD_LIBRARY_PATH = “${stdenv.cc.cc}/lib”;
src = null;
# When used as `nix-shell –pure`
shellHook = ”
unset http_proxy
export GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt
”;
# used when building environments
extraCmds = ”
unset http_proxy # otherwise downloads will fail (“nodtd.invalid”)
export GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt
”;
}

the only minor additions are swig you also might need to add numpy and pip if you want to. I installed pip from nix-env -i

the only minor modification is this:

LD_LIBRARY_PATH = “${stdenv.cc.cc}/lib”;

it sets the lib path so when tensorflow needs a gcc lib it can get to it.

and that is my default.nix

nix-shell in the dir with that then do a normal virtualenv install of tensorflow for python 2.7 I did it CPU only.

I am working on modifying this script so it can work with tensorflow 3.5 and possibly with open cuda, but I did this to do basic tensorflow examples at a Hack Night so might be working in something else next.

 

 

July 27, 2016 at 12:31 pm Leave a comment


Calendar

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Posts by Month

Posts by Category