I am fairly new to Nix and am trying to use the python package OR-tools. I installed it using this simple nix-shell script taken from the NixOS wiki:
# shell.nix
let
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221.tar.gz") {};
in pkgs.mkShell {
packages = [
(pkgs.python3.withPackages (python-pkgs: with python-pkgs; [
ortools
]))
];
}
Which builds successfully. However, when I try to import the module I want I get the following error:
>>> from ortools.linear_solver import pywraplp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/nix/store/35sv781956xgaijz4xjyyifx8p0sf6ji-python3-3.12.5-env/lib/python3.12/site-packages/ortools/linear_solver/pywraplp.py", line 10, in <module>
from . import _pywraplp
ImportError: dlopen(/nix/store/35sv781956xgaijz4xjyyifx8p0sf6ji-python3-3.12.5-env/lib/python3.12/site-packages/ortools/linear_solver/_pywraplp.so, 0x0002): Library not loaded: /tmp/nix-build-or-tools-9.7.drv-0/source/build/lib/libortools.9.dylib
Referenced from: <3FAA446F-C33C-37EB-B7C7-9F59C374B68B> /nix/store/79j82rlmv1ppqx1hsk3qk3dcrr1wfhm3-or-tools-9.7-python/lib/python3.12/site-packages/ortools/linear_solver/_pywraplp.so
Reason: tried: '/tmp/nix-build-or-tools-9.7.drv-0/source/build/lib/libortools.9.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/tmp/nix-build-or-tools-9.7.drv-0/source/build/lib/libortools.9.dylib' (no such file), '/tmp/nix-build-or-tools-9.7.drv-0/source/build/lib/libortools.9.dylib' (no such file), '/usr/local/lib/libortools.9.dylib' (no such file), '/usr/lib/libortools.9.dylib' (no such file, not in dyld cache)
I am on the M1 MacBook air.
What can I do? And, does this happen to someone else?