Skip to content

Breakage of numpy if lapack is also installed #354

@matthewfeickert

Description

@matthewfeickert

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

I'm not sure if this is a numpy or lapack problem, but as the feedstocks share some maintainers I thought I would open it up here as I'm seeing the issue with NumPy.

Currently, if the lapack metapackage and numpy are installed in the same environment, NumPy is broken

# uname -m -s
Linux x86_64
# pixi init example && cd example
# pixi add lapack numpy
Added lapack >=3.6.1,<4
Added numpy >=2.2.4,<3
# pixi run python -c 'import numpy; print(numpy)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/example/.pixi/envs/default/lib/python3.12/site-packages/numpy/__init__.py", line 181, in <module>
    from . import lib
  File "/example/.pixi/envs/default/lib/python3.12/site-packages/numpy/lib/__init__.py", line 23, in <module>
    from . import _index_tricks_impl
  File "/example/.pixi/envs/default/lib/python3.12/site-packages/numpy/lib/_index_tricks_impl.py", line 12, in <module>
    import numpy.matrixlib as matrixlib
  File "/example/.pixi/envs/default/lib/python3.12/site-packages/numpy/matrixlib/__init__.py", line 4, in <module>
    from . import defmatrix
  File "/example/.pixi/envs/default/lib/python3.12/site-packages/numpy/matrixlib/defmatrix.py", line 12, in <module>
    from numpy.linalg import matrix_power
  File "/example/.pixi/envs/default/lib/python3.12/site-packages/numpy/linalg/__init__.py", line 88, in <module>
    from . import _linalg
  File "/example/.pixi/envs/default/lib/python3.12/site-packages/numpy/linalg/_linalg.py", line 39, in <module>
    from numpy.linalg import _umath_linalg
ImportError: libgfortran.so.3: cannot open shared object file: No such file or directory

However, if just liblapack and numpy are installed then things are fine

# pixi init example && cd example
# pixi add liblapack numpy
Added liblapack >=3.9.0,<4
Added numpy >=2.2.4,<3
# pixi run python -c 'import numpy; print(numpy)'
<module 'numpy' from '/example/.pixi/envs/default/lib/python3.12/site-packages/numpy/__init__.py'>

which makes sense as liblapack is a requirement of numpy

- liblapack

and so is installed anyway through numpy.

Installed packages

Package           Version    Build                 Size       Kind   Source
_libgcc_mutex     0.1        conda_forge           2.5 KiB    conda  https://conda.anaconda.org/conda-forge/
_openmp_mutex     4.5        2_gnu                 23.1 KiB   conda  https://conda.anaconda.org/conda-forge/
bzip2             1.0.8      h4bc722e_7            246.9 KiB  conda  https://conda.anaconda.org/conda-forge/
ca-certificates   2025.1.31  hbcca054_0            154.4 KiB  conda  https://conda.anaconda.org/conda-forge/
lapack            3.6.1      ha44fe06_2            2.3 MiB    conda  https://conda.anaconda.org/conda-forge/
ld_impl_linux-64  2.43       h712a8e2_4            655.5 KiB  conda  https://conda.anaconda.org/conda-forge/
libblas           3.9.0      31_h59b9bed_openblas  16.5 KiB   conda  https://conda.anaconda.org/conda-forge/
libcblas          3.9.0      31_he106b2a_openblas  16.4 KiB   conda  https://conda.anaconda.org/conda-forge/
libexpat          2.7.0      h5888daf_0            72.7 KiB   conda  https://conda.anaconda.org/conda-forge/
libffi            3.4.6      h2dba641_1            56.1 KiB   conda  https://conda.anaconda.org/conda-forge/
libgcc            14.2.0     h767d61c_2            828 KiB    conda  https://conda.anaconda.org/conda-forge/
libgcc-ng         14.2.0     h69a702a_2            52.5 KiB   conda  https://conda.anaconda.org/conda-forge/
libgfortran       14.2.0     h69a702a_2            52.5 KiB   conda  https://conda.anaconda.org/conda-forge/
libgfortran5      14.2.0     hf1ad2bd_2            1.4 MiB    conda  https://conda.anaconda.org/conda-forge/
libgomp           14.2.0     h767d61c_2            449.1 KiB  conda  https://conda.anaconda.org/conda-forge/
liblapack         3.9.0      31_h7ac8fdf_openblas  16.4 KiB   conda  https://conda.anaconda.org/conda-forge/
liblzma           5.6.4      hb9d3cd8_0            108.7 KiB  conda  https://conda.anaconda.org/conda-forge/
libnsl            2.0.1      hd590300_0            32.6 KiB   conda  https://conda.anaconda.org/conda-forge/
libopenblas       0.3.29     pthreads_h94d23a6_0   5.6 MiB    conda  https://conda.anaconda.org/conda-forge/
libsqlite         3.49.1     hee588c1_2            897.1 KiB  conda  https://conda.anaconda.org/conda-forge/
libstdcxx         14.2.0     h8f9b012_2            3.7 MiB    conda  https://conda.anaconda.org/conda-forge/
libuuid           2.38.1     h0b41bf4_0            32.8 KiB   conda  https://conda.anaconda.org/conda-forge/
libxcrypt         4.4.36     hd590300_1            98 KiB     conda  https://conda.anaconda.org/conda-forge/
libzlib           1.3.1      hb9d3cd8_2            59.5 KiB   conda  https://conda.anaconda.org/conda-forge/
ncurses           6.5        h2d0b736_3            870.7 KiB  conda  https://conda.anaconda.org/conda-forge/
numpy             2.2.4      py312h72c5963_0       8 MiB      conda  https://conda.anaconda.org/conda-forge/
openssl           3.4.1      h7b32b05_0            2.8 MiB    conda  https://conda.anaconda.org/conda-forge/
python            3.12.9     h9e4cc4f_1_cpython    30.2 MiB   conda  https://conda.anaconda.org/conda-forge/
python_abi        3.12       6_cp312               6.7 KiB    conda  https://conda.anaconda.org/conda-forge/
readline          8.2        h8c095d6_2            275.9 KiB  conda  https://conda.anaconda.org/conda-forge/
tk                8.6.13     noxft_h4845f30_101    3.2 MiB    conda  https://conda.anaconda.org/conda-forge/
tzdata            2025b      h78e105d_0            120.1 KiB  conda  https://conda.anaconda.org/conda-forge/

Environment info

System
------------
       Pixi version: 0.44.0
           Platform: linux-64
   Virtual packages: __unix=0=0
                   : __linux=6.8.0=0
                   : __glibc=2.39=0
                   : __archspec=1=skylake
          Cache dir: /root/.cache/rattler/cache
       Auth storage: /root/.rattler/credentials.json
   Config locations: No config files found

Global
------------
            Bin dir: /root/.pixi/bin
    Environment dir: /root/.pixi/envs
       Manifest dir: /root/.pixi/manifests/pixi-global.toml

Workspace
------------
               Name: example
            Version: 0.1.0
      Manifest file: /example/pixi.toml
       Last updated: 03-04-2025 18:01:32

Environments
------------
        Environment: default
           Features: default
           Channels: conda-forge
   Dependency count: 2
       Dependencies: lapack, numpy
   Target platforms: linux-64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions