duplicate LD_RPATH for numpy on MacOS 15.4
Checks
-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pixi, using
pixi --version.
Reproducible examples
On MacOS 15.4, with pixi 0.44.0:
pixi exec --spec numpy python -c "import numpy"
Traceback (most recent call last):
...
pixi exec --spec numpy --spec python-gil python -c "import numpy"
Traceback (most recent call last):
...
> pixi init
> pixi add numpy python-gil
> pixi run python -c "import numpy"
Traceback (most recent call last):
File "/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/__init__.py", line 23, in <module>
from . import multiarray
File "/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/multiarray.py", line 10, in <module>
from . import overrides
File "/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/overrides.py", line 7, in <module>
from numpy._core._multiarray_umath import (
add_docstring, _get_implementing_args, _ArrayFunctionDispatcher)
ImportError: dlopen(/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/_multiarray_umath.cpython-313-darwin.so, 0x0002): Library not loaded: @rpath/libgfortran.5.dylib
Referenced from: <CAA510D4-816A-34E5-9021-485EF5D56159> /Users/maurosilber/proj/.pixi/envs/default/lib/libopenblas.0.dylib
Reason: tried: '/Users/maurosilber/proj/.pixi/envs/default/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dyld cache)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/__init__.py", line 114, in <module>
from numpy.__config__ import show_config
File "/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/__config__.py", line 4, in <module>
from numpy._core._multiarray_umath import (
...<3 lines>...
)
File "/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.13 from "/Users/maurosilber/proj/.pixi/envs/default/bin/python"
* The NumPy version is: "2.2.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: dlopen(/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/_multiarray_umath.cpython-313-darwin.so, 0x0002): Library not loaded: @rpath/libgfortran.5.dylib
Referenced from: <CAA510D4-816A-34E5-9021-485EF5D56159> /Users/maurosilber/proj/.pixi/envs/default/lib/libopenblas.0.dylib
Reason: tried: '/Users/maurosilber/proj/.pixi/envs/default/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/maurosilber/proj/.pixi/envs/default/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dyld cache)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
import numpy
File "/Users/maurosilber/proj/.pixi/envs/default/lib/python3.13/site-packages/numpy/__init__.py", line 119, in <module>
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
But it works with micromamba:
micromamba create -p ./env
micromamba install -p ./env numpy python-gil
micromamba run -p ./env python -c "import numpy"
So it might be a pixi issue.
The numpy and python versions are the same. I haven't checked the rest, but here are the pixi.lock and micromamba list outputs:
files.zip Contains:
-
pixi.toml -
pixi.lock -
micromamba.list.txt(the output ofmicromamba list)
Issue description
After upgrading to MacOS 15.4, I cannot import numpy on environments created by pixi.
I've asked about it on Discord and the conda-forge's numpy feedstock:
- https://discord.com/channels/1082332781146800168/1356687879283278021
- https://github.com/conda-forge/numpy-feedstock/issues/353
- https://github.com/conda-forge/numpy-feedstock/issues/347
The summary of what I know so far is:
- it happens after upgrading to MacOS 15.4
- it happens on pixi environments, but not on mamba/micromamba environments
- it does not happen with numpy from PyPI installed with either pixi or uv
Expected behavior
That it allows to import numpy.
Given that a number of users have reported this issue in conda-forge, I suspect that it's not pixi specific.
I will engage on the conda-forge thread to see how we can help!
@wolfv We can reproduce this with pixi and not with micromamba. The difference is the number of LC_RPATH in the relocatected/resigned binary. For pixi, you get three entries, for micromamba only two in the output of otool -l.
The first environment was create with micromamba create -n testenv numpy, the second with pixi.
otool -l /Users/bozhidarvasilev/conda/envs/envs/testenv/lib/libgfortran.5.dylib | grep LC_R
cmd LC_RPATH
cmd LC_RPATH
otool -l /Users/bozhidarvasilev/code/myproject/.pixi/envs/default/lib/libgfortran.5.dylib | grep LC_R
cmd LC_RPATH
cmd LC_RPATH
cmd LC_RPATH
actually it's not a micromamba/pixi issue after some more investigation with @BozhidarVasilevQC
This pixi.toml results in a failure
[workspace]
channels = ["conda-forge"]
name = "error_repr"
platforms = ["osx-arm64"]
[tasks]
[dependencies]
numpy = ">=2.2.4,<3"
libgfortran5 = { version = "==13.2.0", build = "hf226fd6_3" }
This one does not
[workspace]
channels = ["conda-forge"]
name = "fix_repr"
platforms = ["osx-arm64"]
[tasks]
[dependencies]
numpy = ">=2.2.4,<3"
libgfortran5 = { version = "==14.2.0", build = "h6c33f7e_1" }
This
pixi.tomlresults in a failure[workspace] channels = ["conda-forge"] name = "error_repr" platforms = ["osx-arm64"] [tasks] [dependencies] numpy = ">=2.2.4,<3" libgfortran5 = { version = "==13.2.0", build = "hf226fd6_3" }This one does not
[workspace] channels = ["conda-forge"] name = "fix_repr" platforms = ["osx-arm64"] [tasks] [dependencies] numpy = ">=2.2.4,<3" libgfortran5 = { version = "==14.2.0", build = "h6c33f7e_1" }
Waiting for an official and global solution, this fixed my project, thanks a lot!
This
pixi.tomlresults in a failure[workspace] channels = ["conda-forge"] name = "error_repr" platforms = ["osx-arm64"] [tasks] [dependencies] numpy = ">=2.2.4,<3" libgfortran5 = { version = "==13.2.0", build = "hf226fd6_3" }This one does not
[workspace] channels = ["conda-forge"] name = "fix_repr" platforms = ["osx-arm64"] [tasks] [dependencies] numpy = ">=2.2.4,<3" libgfortran5 = { version = "==14.2.0", build = "h6c33f7e_1" }
In my case it worked with libgfortran5 = "==14.2.0"
For anyone that finds this issue, this fixes the issue for me and some of my team mates:
curl -fsSL 'https://gist.githubusercontent.com/basnijholt/811307f125619c53ef876f8ea6ab6685/raw/c678b893c223c3ec3dec3bdb67937c5adc2fab7f/fix.sh' | bash
Just conda/micromamba activate or pixi shell in the problematic environment and run that command!
[!WARNING] Never run commands from the internet without checking out the script!
Inspired by this comment by @cynddl
cross-posted at https://github.com/conda/conda-build/issues/5671, https://github.com/prefix-dev/pixi/issues/3479, https://github.com/conda-forge/numpy-feedstock/issues/347#issuecomment-2779297248
This was fixed in conda-forge. Unfortunately, some people might have to update lockfiles to get the fix in.
I still have the problem that it searchs a lib outside the environment
from numpy._core._multiarray_umath import (
ImportError: dlopen(/Users/Some/MSS/.pixi/envs/dev/lib/python3.11/site-packages/numpy/_core/_multiarray_umath.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libgfortran.5.dylib
Referenced from: <C435405B-BFF1-399F-A1EC-BD43418F546A> /Users/Some/MSS/.pixi/envs/dev/lib/libopenblas.0.dylib
Reason: tried: '/Users/Some/MSS/.pixi/envs/dev/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/Some/MSS/.pixi/envs/dev/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/Some/MSS/.pixi/envs/dev/lib/python3.11/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/Some/MSS/.pixi/envs/dev/lib/python3.11/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/Some/MSS/.pixi/envs/dev/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/Some/MSS/.pixi/envs/dev/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'),
'/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dyld cache)
only 2 times LC_RPATH
otool -l .pixi/envs/dev/lib/libgfortran.5.dylib | grep LC_R
cmd LC_RPATH
cmd LC_RPATH
but the traceback says: duplicate LC_RPATH '@loader_path'
I found that cycling the installation of netCDF4 resolves the issue.
"pixi remove netcdf4" and "pixi add netcdf4"
https://github.com/conda-forge/netcdf4-feedstock/issues/172
I was asking on discord: https://discord.com/channels/1082332781146800168/1154737204040564756/threads/1393948601754976317 and get pointed to this issue
libgfortran5 14.2.0
├── esmf 8.8.1
│ └── nco 5.3.4
│ └── pynco 1.1.2
├── netcdf-fortran 4.6.2
│ └── esmf 8.8.1 (*)
├── libgfortran 5.0.0
│ ├── esmf 8.8.1 (*)
│ ├── netcdf-fortran 4.6.2 (*)
│ ├── scipy 1.15.1
│ │ └── metpy 1.6.3
│ ├── hdf5 1.14.6
│ │ ├── nco 5.3.4 (*)
│ │ ├── esmf 8.8.1 (*)
│ │ ├── libnetcdf 4.9.2
│ │ │ ├── nco 5.3.4 (*)
│ │ │ ├── esmf 8.8.1 (*)
│ │ │ ├── netcdf-fortran 4.6.2 (*)
│ │ │ ├── tempest-remap 2.2.0
│ │ │ │ └── nco 5.3.4 (*)
│ │ │ └── netcdf4 1.7.2
│ │ ├── netcdf-fortran 4.6.2 (*)
│ │ ├── tempest-remap 2.2.0 (*)
│ │ └── netcdf4 1.7.2 (*)
│ └── libopenblas 0.3.28
│ └── libblas 3.9.0
│ ├── gsl 2.7
│ │ └── nco 5.3.4 (*)
│ ├── libcblas 3.9.0
│ │ ├── gsl 2.7 (*)
│ │ ├── numpy 2.2.3
│ │ │ ├── cartopy 0.24.0
│ │ │ │ └── metpy 1.6.3 (*)
│ │ │ ├── jplephem 2.21
│ │ │ │ └── skyfield 1.49
│ │ │ ├── cftime 1.6.4
│ │ │ │ └── netcdf4 1.7.2 (*)
│ │ │ ├── contourpy 1.3.1
│ │ │ │ └── matplotlib-base 3.9.4
│ │ │ │ ├── cartopy 0.24.0 (*)
│ │ │ │ ├── metpy 1.6.3 (*)
│ │ │ │ ├── matplotlib 3.9.4
│ │ │ │ └── basemap 1.4.1
│ │ │ ├── pandas 2.2.3
│ │ │ │ ├── metpy 1.6.3 (*)
│ │ │ │ └── xarray 2025.1.2
│ │ │ │ └── metpy 1.6.3 (*)
│ │ │ ├── scipy 1.15.1 (*)
│ │ │ ├── skyfield 1.49 (*)
│ │ │ ├── metpy 1.6.3 (*)
│ │ │ ├── matplotlib-base 3.9.4 (*)
│ │ │ ├── pynco 1.1.2 (*)
│ │ │ ├── netcdf4 1.7.2 (*)
│ │ │ ├── basemap 1.4.1 (*)
│ │ │ ├── xarray 2025.1.2 (*)
│ │ │ └── shapely 2.0.7
│ │ │ └── cartopy 0.24.0 (*)
│ │ ├── nco 5.3.4 (*)
│ │ └── scipy 1.15.1 (*)
│ ├── numpy 2.2.3 (*)
│ ├── nco 5.3.4 (*)
│ ├── liblapack 3.9.0
│ │ ├── numpy 2.2.3 (*)
│ │ ├── scipy 1.15.1 (*)
│ │ └── tempest-remap 2.2.0 (*)
│ ├── scipy 1.15.1 (*)
│ └── tempest-remap 2.2.0 (*)
├── scipy 1.15.1 (*)
├── hdf5 1.14.6 (*)
└── libopenblas 0.3.28 (*)
scipy currently blocks upgrading to 14.3.0 of libgfortran.