-
Notifications
You must be signed in to change notification settings - Fork 335
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
Python: manylinux #784
Comments
By the way, we can force linking languages.python.package =
pkgs.python3.override (old: {
self = old.self.overrideAttrs
(self: super: {
env = super.env // {
# Link libstdc++ to python interpreter so that packages in manylinux ABI can find it out-of-the-box without LD_LIBRARY_PATH
# TODO: Add more libraries here when encountering an ImportError
NIX_LDFLAGS = "--no-as-needed -lstdc++ --as-needed ${super.env.NIX_LDFLAGS}";
};
});
}); |
By the way, a Python package requiring
|
We could, however that means anyone using Python would be forced to recompile (or set up our cache). I'd like to avoid that, but so far it doesn't seem to be possible without a lot of pain. |
How about this? languages.python.package =
pkgs.python3.override (old: {
self = callPackage "${nixpkgs}/pkgs/development/interpreters/python/wrapper.nix" {
python = old.self;
makeWrapperArgs = [
"--set"
"LD_LIBRARY_PATH"
"${pkgs.stdenv.cc.cc.lib}/lib"
];
};
}); |
Ideally, we will need a way to set a environment variable to specify the fallback library path instead of |
Thanks for this! I've implemented it on the NixOS/nix#745 branch. I'm still not able to get libstd++ to load, but it's good progress! |
I didn't test |
It works if I just use |
I recently tried using autopatchelf. It is very slow atm, but it does seem to work:
This will patch all
Currently I haven't looked into caching the results, so it will try to patch all binaries in the virtualenv each time I enter the shell. This takes minutes. I think caching would help, but then still each change of the poetry.lock or the That said, this might be a good concession between using EDIT: Also good to mention: during the process of finding out which libraries the packages needed by rerunning autopatchelf and looking at the error it outputs |
@Atry I like the idea of using Unfortunately it doesn't work with
Do you have any suggestions for a workaround? i.e. how to mark the binary in Nix as safe? |
This shipped in https://devenv.sh/blog/2023/03/20/devenv-10-rewrite-in-rust/ |
I'm exploring an idea to provide manylinux packages for Python by default
and allowing to extend that set with any other libraries.
This way we avoid
LD_LIBRARY_PATH
pollution of the developer environment.An example using mkdocs-material:
Refs NixOS/nix#773 NixOS/nix#715 NixOS/nix#555
The text was updated successfully, but these errors were encountered: