Problems with python package

So the following package:

{ lib, buildPythonPackage, fetchPypi, tensorflow }:
buildPythonPackage rec {
  pname = "tfjs-graph-converter";
  version = "1.0.0";
  src = fetchPypi {
    inherit pname version;
    hash = "sha256-2NCRbV36/Hb4epeVBAY/Qj2Ia0RwR1mDonzEGVvtY88=";
  };
  propaprgatedBuildInputs = [ tensorflow ];
  meta = with lib; {
    description = "A tensorflowjs Graph Model Converter";
    homepage = "https://github.com/patlevin/tfjs-to-tf";
    license = licenses.mit;
    mantainers = with mantainers;[ pasqui23 ];
  };
}

fails to build with the error that there is no tensorflow package,even through it is packaged for python nixpkgs/default.nix at 42809feaa9f7474f5566a5c6e8e317e15e39160e · NixOS/nixpkgs · GitHub
Where am I doing wrong?

can you paste the error?

typo. Should be propagatedBuildInputs.

1 Like

Would it be possible to generate a “pedantic” warning for typos like that?

not in its current state. As all attrs also manifest themselves as shell variable within the build. So there’s not a good way to differentiate accident or purposeful spellings.

all attrs also manifest themselves as shell variable within the build

Has anybody talked about changing that to separate the namespaces, e.g. by introducing a shellVars attribute?

It would be a massive breaking change to implement this now.

It could be the next generation build function, with a different name to avoid breaking existing usage.

I think it’s going to be harder than you think, shellHooks and a bunch of other assumptions would also be invalidated.

I think it would be better to have a linter which can do a fuzzy search, and say, "Hey, this is close to this commonly used mkDerivation Attr: Did you mean propagatedBuildInputs instead of propaprgatedBuildInputs

Nixpkgs-hammering includes the basics of such a linter, although it may need some improvements to deal with buildPythonPackage packages.

I think we are actually already moving in this direction – with __structuredAttrs, env variables are specified explicitly, so we could do more rigorous checking on the derivation args.

But it’s true that this is a massively breaking change, so it would have to be introduced in an opt-in fashion.
https://github.com/NixOS/nixpkgs/pull/85042

2 Likes

Even with the correct attribute name, I still have the same build error

nix log /nix/store/axjlays9drvz2fjavxdrwr8lhi2hqhxr-python3.8-tfjs-graph-converter-1.0.0.drv
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing setuptools-check-hook
Using setuptoolsCheckPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/x54clglnk6bhxymrgqri5vr2l6bjnj81-tfjs-graph-converter-1.0.0.tar.gz
source root is tfjs-graph-converter-1.0.0
setting SOURCE_DATE_EPOCH to timestamp 1587954824 of file tfjs-graph-converter-1.0.0/tfjs_graph_converter.egg-info/top_level.txt
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Executing setuptoolsBuildPhase
running bdist_wheel
running build
running build_py
file tfjs_graph_converter.py (for module tfjs_graph_converter) not found
creating build
creating build/lib
creating build/lib/tfjs_graph_converter
copying tfjs_graph_converter/__init__.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/version.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/api.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/common.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/converter.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/util.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/convert_prelu.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/graph_rewrite_util.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/optimization.py -> build/lib/tfjs_graph_converter
copying tfjs_graph_converter/quirks.py -> build/lib/tfjs_graph_converter
file tfjs_graph_converter.py (for module tfjs_graph_converter) not found
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/__init__.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/version.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/api.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/common.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/converter.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/util.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/convert_prelu.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/graph_rewrite_util.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/optimization.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
copying build/lib/tfjs_graph_converter/quirks.py -> build/bdist.linux-x86_64/wheel/tfjs_graph_converter
running install_egg_info
running egg_info
writing tfjs_graph_converter.egg-info/PKG-INFO
writing dependency_links to tfjs_graph_converter.egg-info/dependency_links.txt
writing entry points to tfjs_graph_converter.egg-info/entry_points.txt
writing requirements to tfjs_graph_converter.egg-info/requires.txt
writing top-level names to tfjs_graph_converter.egg-info/top_level.txt
file tfjs_graph_converter.py (for module tfjs_graph_converter) not found
reading manifest file 'tfjs_graph_converter.egg-info/SOURCES.txt'
writing manifest file 'tfjs_graph_converter.egg-info/SOURCES.txt'
Copying tfjs_graph_converter.egg-info to build/bdist.linux-x86_64/wheel/tfjs_graph_converter-1.0.0-py3.8.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/tfjs_graph_converter-1.0.0.dist-info/WHEEL
creating 'dist/tfjs_graph_converter-1.0.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'tfjs_graph_converter/__init__.py'
adding 'tfjs_graph_converter/api.py'
adding 'tfjs_graph_converter/common.py'
adding 'tfjs_graph_converter/convert_prelu.py'
adding 'tfjs_graph_converter/converter.py'
adding 'tfjs_graph_converter/graph_rewrite_util.py'
adding 'tfjs_graph_converter/optimization.py'
adding 'tfjs_graph_converter/quirks.py'
adding 'tfjs_graph_converter/util.py'
adding 'tfjs_graph_converter/version.py'
adding 'tfjs_graph_converter-1.0.0.dist-info/METADATA'
adding 'tfjs_graph_converter-1.0.0.dist-info/WHEEL'
adding 'tfjs_graph_converter-1.0.0.dist-info/entry_points.txt'
adding 'tfjs_graph_converter-1.0.0.dist-info/top_level.txt'
adding 'tfjs_graph_converter-1.0.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Finished executing setuptoolsBuildPhase
@nix { "action": "setPhase", "phase": "installPhase" }
installing
Executing pipInstallPhase
/build/tfjs-graph-converter-1.0.0/dist /build/tfjs-graph-converter-1.0.0
Processing ./tfjs_graph_converter-1.0.0-py3-none-any.whl
ERROR: Could not find a version that satisfies the requirement tensorflowjs>=1.5.2 (from tfjs-graph-converter)
ERROR: No matching distribution found for tensorflowjs>=1.5.2

This complains about a missing tensorflowjs package, not tensorflow package. I don’t think we have packaged tensorflowjs.