Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python310Packages.insightface: init at 0.7.3 #244655

Merged
merged 3 commits into from Jul 29, 2023

Conversation

oddlama
Copy link
Contributor

@oddlama oddlama commented Jul 21, 2023

Description of changes

Adds https://github.com/deepinsight/insightface, a state-of-the-art 2D and 3D face analysis library.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@oddlama
Copy link
Contributor Author

oddlama commented Jul 27, 2023

Rebased on master, no structural changes.

@mweinelt
Copy link
Member

mweinelt commented Jul 28, 2023

The CLI apparently expects the onnxruntime package. Maybe we can add testers.testVersion to run the CLI as a further test.

$ ./result/bin/insightface-cli
Traceback (most recent call last):
  File "/nix/store/l2j9xhb2zbl21id24xy5kgly0vb7mx74-python3.11-insightface-0.7.3/lib/python3.11/site-packages/insightface/__init__.py", line 8, in <module>
    import onnxruntime
ModuleNotFoundError: No module named 'onnxruntime'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/l2j9xhb2zbl21id24xy5kgly0vb7mx74-python3.11-insightface-0.7.3/bin/.insightface-cli-wrapped", line 6, in <module>
    from insightface.commands.insightface_cli import main
  File "/nix/store/l2j9xhb2zbl21id24xy5kgly0vb7mx74-python3.11-insightface-0.7.3/lib/python3.11/site-packages/insightface/__init__.py", line 10, in <module>
    raise ImportError(
ImportError: Unable to import dependency onnxruntime. 

@oddlama oddlama force-pushed the init-insightface branch 3 times, most recently from 458334a to e9bc6b5 Compare July 28, 2023 19:14
@oddlama
Copy link
Contributor Author

oddlama commented Jul 28, 2023

Added small compatibility fix for mxnet (to support numpy >= 1.24), and addressed review comments.
The mxnet patch is not made against upstream and fetchpatched because the newest upstream version has already evolved to another incompatible version, so that patch wouldn't apply, and mxnet seems to be unmaintained.

The CLI apparently expects the onnxruntime package. Maybe we can add testers.testVersion to run the CLI as a further test.

Good idea. I've now added this test but since there is no "--version" for insightface, I've set version = "help" to verify at least the help output.

@oddlama
Copy link
Contributor Author

oddlama commented Jul 28, 2023

(Fixed accidentally deleted character 😅, package builds and runs now)

@ofborg ofborg bot requested a review from abbradar July 28, 2023 20:10
@mweinelt
Copy link
Member

mxnet fails to build on darwin.

error: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Werror,-Wunknown-warning-option]

Can you try the following? Copied from pkgs/tools/networking/tgt/default.nix.

env.NIX_CFLAGS_COMPILE = toString [
	# Needed with GCC 12
	"-Wno-error=maybe-uninitialized"
];

@mweinelt
Copy link
Member

Well that was dumb. I really need to start reading the actual error message.

The necessary change is

diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix
index 1e7af371c50..d65de87d8eb 100644
--- a/pkgs/applications/science/math/mxnet/default.nix
+++ b/pkgs/applications/science/math/mxnet/default.nix
@@ -56,7 +56,6 @@ stdenv.mkDerivation rec {
 
   env.NIX_CFLAGS_COMPILE = toString [
     # Needed with GCC 12
-    "-Wno-error=maybe-uninitialized"
     "-Wno-error=uninitialized"
   ];

@oddlama
Copy link
Contributor Author

oddlama commented Jul 29, 2023

The necessary change is [...]

Adjusted, I just can't test darwin myself unfortunately :D

@mweinelt
Copy link
Member

mweinelt commented Jul 29, 2023

The change is needed on the native library, not the python library, see the diff. 😆

@oddlama
Copy link
Contributor Author

oddlama commented Jul 29, 2023

Guess I should also start to read comments properly 😅. Added as suggested now.

@mweinelt
Copy link
Member

mweinelt commented Jul 29, 2023

@ofborg build python310Packages.mxnet

@mweinelt
Copy link
Member

Builds for me on both darwin systems.

@mweinelt mweinelt merged commit 86c62f4 into NixOS:master Jul 29, 2023
29 of 33 checks passed
@oddlama oddlama deleted the init-insightface branch July 29, 2023 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants