Noisemaker: Difference between revisions
imported>Raboof document how to build noisemaker |
imported>Raboof how to use shell.nix instead of venv with a nixpkgs that has a recent tensorflow |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
https://noisemaker.readthedocs.io/en/latest/ | https://noisemaker.readthedocs.io/en/latest/ | ||
Right now nixpkgs contains tensorflow 2.1.0 but has it disabled for python 3.8 (as it's not officially supported upstream either). | |||
== with tensorflow 2.3.0 from a branch == | |||
Using nixpkgs from https://github.com/NixOS/nixpkgs/pull/95824 , you can update setup.py to change '==' versions to '>=' for the dependencies for which NixOS is shipping newer versions, and then use the following shell.nix: | |||
<syntaxHighlight lang=nix> | |||
with import <nixpkgs> {}; | |||
with python3Packages; | |||
buildPythonPackage rec { | |||
name = "noisemaker"; | |||
src = /path/to/py-noisemaker; | |||
propagatedBuildInputs = [ | |||
virtualenv | |||
pillow | |||
tensorflow_2 | |||
click | |||
]; | |||
} | |||
</syntaxHighlight> | |||
== with tensorflow 2.3.0 from pip in a venv == | |||
'python3 -m venv venv' doesn't seem to work with python 3.7, so I'm sticking with 3.8. | |||
noisemaker wants exactly version 6.2.0 of Pillow. The pillow in nixpkgs is a different version, so this will be fetched and built with setup.py. To make sure it can correctly find the C libraries it uses, we use fshUserEnv and add some development headers: | noisemaker wants exactly version 6.2.0 of Pillow. The pillow in nixpkgs is a different version, so this will be fetched and built with setup.py. To make sure it can correctly find the C libraries it uses, we use fshUserEnv and add some development headers: | ||
<syntaxHighlight lang=nix> | |||
{ pkgs ? import <nixpkgs> {} }: | { pkgs ? import <nixpkgs> {} }: | ||
| Line 29: | Line 46: | ||
]; | ]; | ||
}).env | }).env | ||
</syntaxHighlight> | |||
Then create noisemaker in a venv: | Then create noisemaker in a venv: | ||
<syntaxHighlight lang=console> | |||
$ python3 -m venv venv | |||
$ source venv/bin/activate | |||
$ python3 setup.py develop | |||
</syntaxHighlight> | |||
Add a newer tensorflow from pip: | Add a newer tensorflow from pip: | ||
<syntaxHighlight lang=console> | |||
$ pip install tensorflow | |||
</syntaxHighlight> | |||
And run noisemaker: | And run noisemaker: | ||
<syntaxHighlight lang=console> | |||
$ noisemaker | |||
</syntaxHighlight> | |||
(this will generate 'noise.png') | (this will generate 'noise.png') | ||