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

blender: fix enableNumpy option #81313

Merged
merged 1 commit into from Mar 3, 2020
Merged

Conversation

veprbl
Copy link
Member

@veprbl veprbl commented Feb 28, 2020

Motivation for this change

Fixes: #81218

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@jonringer
Copy link
Contributor

not familiar with how blender calls python. But another option would be to use python.withPackages(ps: [ ps.numpy]); as your "python" interpreter. Essentially this will symlinkjoin all the site packages together, so call that "python" would be as if you were calling one with numpy installed

@veprbl veprbl force-pushed the pr/blender_numpy_fix branch 3 times, most recently from a32d5a4 to 9b5672a Compare February 29, 2020 14:37
@veprbl
Copy link
Member Author

veprbl commented Feb 29, 2020

I disregarded python.withPackages because I assumed it is not composable, but, actually, it is. If it's composable then it looks like the better approach to use it, especially given that blender disregards PYTHONPATH by default.

@veprbl veprbl added 9.needs: port to stable A PR needs a backport to the stable release. 2.status: work-in-progress labels Feb 29, 2020
@veprbl
Copy link
Member Author

veprbl commented Feb 29, 2020

Actually, that didn't work. The blender links to the python interpreter directly so our wrappers don't have any effect. I will revert back to wrapping blender itself.

@jonringer
Copy link
Contributor

ah, I didn't realize it was linking against it :(

Workarounds https://developer.blender.org/T74304

Audaspace requires numpy, we already have to provide numpy
unconditionally via PYTHON_NUMPY_PATH.
@veprbl
Copy link
Member Author

veprbl commented Feb 29, 2020

I think, this is ready now

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
launches fine
(not sure how to actually test the numpy use case)

[2 built, 14 copied (153.7 MiB), 47.8 MiB DL]
https://github.com/NixOS/nixpkgs/pull/81313
1 package built:
blender

@jonringer
Copy link
Contributor

@GrahamcOfBorg build blender

@gebner
Copy link
Member

gebner commented Mar 3, 2020

import numpy works for me

@gebner gebner merged commit f29c0e4 into NixOS:master Mar 3, 2020
@veprbl veprbl deleted the pr/blender_numpy_fix branch March 3, 2020 14:18
veprbl added a commit that referenced this pull request Mar 3, 2020
Workarounds https://developer.blender.org/T74304

Audaspace requires numpy, we already have to provide numpy
unconditionally via PYTHON_NUMPY_PATH.

(cherry picked from commit 2757885)

cc #81313
@veprbl veprbl added 8.has: port to stable A PR already has a backport to the stable release. and removed 9.needs: port to stable A PR needs a backport to the stable release. labels Mar 3, 2020
@amurrayc
Copy link
Contributor

This doesn't quite work for me.

It looks like addons are loaded before this command executes. At least this is true for the Archipack Pro addon.

I get:

Archipack PRO 2.2.6 : error while loading preset
No module named 'numpy'

Importing numpy from the blender python console works fine.

If I then go into Preferences and toggle the addon it loads correctly (although settings are lost so it's not a very satisfactory workaround).

This was working before (for < 2.82)

@veprbl
Copy link
Member Author

veprbl commented Mar 11, 2020

@amurrayc I'm not able to reproduce your issue with Archipack (not PRO, I guess?). Could you please open an issue and describe steps to reproduce. Please assume that we have little experience using extensions in Blender (which is true for me, at least).

@veprbl veprbl restored the pr/blender_numpy_fix branch December 1, 2020 16:57
@veprbl veprbl deleted the pr/blender_numpy_fix branch December 1, 2020 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: port to stable A PR already has a backport to the stable release. 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

blender 2.82 with numpy does not find numpy at run-time
4 participants