Skip to content

duplicate LD_RPATH for numpy on MacOS 15.4 #3479

@maurosilber

Description

@maurosilber

Checks

  • I have checked that this issue has not already been reported.

  • 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 of micromamba 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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions