Skip to content

Installation issue: py-scipy has a dependency on libgfortran on macOS?  #43905

@pranav-sivaraman

Description

@pranav-sivaraman

Steps to reproduce the issue

Following Environment

spack:
  specs:
  - py-scipy
  view: true
  concretizer:
    unify: true
    os_compatible: {sonoma: [ventura], ventura: [sonoma]}
  mirrors:
    develop-ml-darwin-aarch64-mps: https://binaries.spack.io/develop/ml-darwin-aarch64-mps
  compilers:
  - compiler:
      spec: apple-clang@=15.0.0
      paths:
        cc: /usr/bin/clang
        cxx: /usr/bin/clang++
        f77: null
        fc: null
      flags: {}
      operating_system: sonoma
      target: aarch64
      modules: []
      environment: {}
      extra_rpaths: []

Produces the following spec where all the specs are from the ML buildcache

$ spack spec
Input spec
--------------------------------
 -   py-scipy

Concretized
--------------------------------
[+]  py-scipy@1.13.0%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]      ^openblas@0.3.26%apple-clang@15.0.0~bignuma~consistent_fpcsr+dynamic_dispatch~fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=darwin-ventura-aarch64
[+]          ^gmake@4.4.1%apple-clang@15.0.0~guile build_system=generic arch=darwin-ventura-aarch64
[+]          ^perl@5.38.0%apple-clang@15.0.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=darwin-ventura-aarch64
[+]              ^berkeley-db@18.1.40%apple-clang@15.0.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=darwin-ventura-aarch64
[+]      ^pkgconf@1.9.5%apple-clang@15.0.0 build_system=autotools arch=darwin-ventura-aarch64
[-]          ^gnuconfig@2022-09-17%apple-clang@15.0.0 build_system=generic arch=darwin-ventura-aarch64
[+]      ^py-cython@3.0.8%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]          ^py-setuptools@69.2.0%apple-clang@15.0.0 build_system=generic arch=darwin-ventura-aarch64
[+]      ^py-meson-python@0.15.0%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]          ^meson@1.3.2%apple-clang@15.0.0 build_system=python_pip patches=0f0b1bd arch=darwin-ventura-aarch64
[+]          ^py-pyproject-metadata@0.7.1%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]              ^py-packaging@23.1%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]                  ^py-flit-core@3.9.0%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]      ^py-numpy@1.26.4%apple-clang@15.0.0 build_system=python_pip patches=873745d arch=darwin-ventura-aarch64
[+]      ^py-pip@23.1.2%apple-clang@15.0.0 build_system=generic arch=darwin-ventura-aarch64
[+]      ^py-pybind11@2.12.0%apple-clang@15.0.0~ipo build_system=cmake build_type=Release generator=ninja arch=darwin-ventura-aarch64
[+]          ^cmake@3.27.9%apple-clang@15.0.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=darwin-ventura-aarch64
[+]              ^curl@8.6.0%apple-clang@15.0.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=secure_transport arch=darwin-ventura-aarch64
[+]                  ^nghttp2@1.57.0%apple-clang@15.0.0 build_system=autotools arch=darwin-ventura-aarch64
[+]          ^ninja@1.11.1%apple-clang@15.0.0+re2c build_system=generic arch=darwin-ventura-aarch64
[+]              ^re2c@2.2%apple-clang@15.0.0 build_system=generic arch=darwin-ventura-aarch64
[+]      ^py-pythran@0.15.0%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]          ^llvm-openmp@18.1.0%apple-clang@15.0.0~ipo+multicompat build_system=cmake build_type=Release generator=make arch=darwin-ventura-aarch64
[+]          ^py-beniget@0.4.1%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]          ^py-gast@0.5.4%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]          ^py-ply@3.11%apple-clang@15.0.0 build_system=python_pip arch=darwin-ventura-aarch64
[+]      ^py-wheel@0.41.2%apple-clang@15.0.0 build_system=generic arch=darwin-ventura-aarch64
[+]      ^python@3.11.7%apple-clang@15.0.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=13fa8bf,b0615b2,ebdca64,f2fd060 arch=darwin-ventura-aarch64
[e]          ^apple-libuuid@1353.100.2%apple-clang@15.0.0 build_system=bundle arch=darwin-ventura-aarch64
[+]          ^bzip2@1.0.8%apple-clang@15.0.0~debug~pic+shared build_system=generic arch=darwin-ventura-aarch64
[-]              ^diffutils@3.10%apple-clang@15.0.0 build_system=autotools arch=darwin-ventura-aarch64
[+]          ^expat@2.6.2%apple-clang@15.0.0~libbsd build_system=autotools arch=darwin-ventura-aarch64
[+]          ^gdbm@1.23%apple-clang@15.0.0 build_system=autotools arch=darwin-ventura-aarch64
[+]          ^gettext@0.22.4%apple-clang@15.0.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=darwin-ventura-aarch64
[+]              ^libiconv@1.17%apple-clang@15.0.0 build_system=autotools libs=shared,static arch=darwin-ventura-aarch64
[+]              ^libxml2@2.10.3%apple-clang@15.0.0+pic~python+shared build_system=autotools arch=darwin-ventura-aarch64
[+]              ^tar@1.34%apple-clang@15.0.0 build_system=autotools zip=pigz arch=darwin-ventura-aarch64
[+]                  ^pigz@2.8%apple-clang@15.0.0 build_system=makefile arch=darwin-ventura-aarch64
[+]                  ^zstd@1.5.6%apple-clang@15.0.0+programs build_system=makefile compression=none libs=shared,static arch=darwin-ventura-aarch64
[+]          ^libffi@3.4.6%apple-clang@15.0.0 build_system=autotools arch=darwin-ventura-aarch64
[+]          ^libxcrypt@4.4.35%apple-clang@15.0.0~obsolete_api build_system=autotools patches=4885da3 arch=darwin-ventura-aarch64
[+]          ^ncurses@6.4%apple-clang@15.0.0~symlinks+termlib abi=none build_system=autotools patches=7a351bc arch=darwin-ventura-aarch64
[+]          ^openssl@3.2.1%apple-clang@15.0.0~docs+shared build_system=generic certs=mozilla arch=darwin-ventura-aarch64
[-]              ^ca-certificates-mozilla@2023-05-30%apple-clang@15.0.0 build_system=generic arch=darwin-ventura-aarch64
[+]          ^readline@8.2%apple-clang@15.0.0 build_system=autotools patches=bbf97f1 arch=darwin-ventura-aarch64
[+]          ^sqlite@3.43.2%apple-clang@15.0.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=darwin-ventura-aarch64
[+]          ^xz@5.4.6%apple-clang@15.0.0~pic build_system=autotools libs=shared,static arch=darwin-ventura-aarch64
[+]          ^zlib-ng@2.1.6%apple-clang@15.0.0+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-ventura-aarch64

With the simple python file

from scipy.sparse import issparse

Tagging Maintainers: @adamjstewart @rgommers

Error message

Produces the following error message when running the python file.

Error message
Traceback (most recent call last):
  File "/Users/pranav/Documents/Research/embeddings-playground/scikit.py", line 1, in 
    from scipy.sparse import issparse
  File "/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/python3.11/site-packages/scipy/sparse/__init__.py", line 308, in 
    from . import csgraph
  File "/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/python3.11/site-packages/scipy/sparse/csgraph/__init__.py", line 185, in 
    from ._laplacian import laplacian
  File "/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/python3.11/site-packages/scipy/sparse/csgraph/_laplacian.py", line 7, in 
    from scipy.sparse.linalg import LinearOperator
  File "/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/python3.11/site-packages/scipy/sparse/linalg/__init__.py", line 132, in 
    from ._eigen import *
  File "/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/python3.11/site-packages/scipy/sparse/linalg/_eigen/__init__.py", line 9, in 
    from .arpack import *
  File "/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/python3.11/site-packages/scipy/sparse/linalg/_eigen/arpack/__init__.py", line 20, in 
    from .arpack import *
  File "/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/python3.11/site-packages/scipy/sparse/linalg/_eigen/arpack/arpack.py", line 48, in 
    from . import _arpack
ImportError: dlopen(/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/python3.11/site-packages/scipy/sparse/linalg/_eigen/arpack/_arpack.cpython-311-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/gcc/lib/gcc/current/libgfortran.5.dylib
  Referenced from: <6458719B-5FE1-3B6F-AB87-C774827AB0BD> /Users/pranav/spack/opt/spack/darwin-ventura-aarch64/apple-clang-15.0.0/py-scipy-1.13.0-tidaecalxzhlt23to377oa6ocgk576lb/lib/python3.11/site-packages/scipy/sparse/linalg/_eigen/arpack/_arpack.cpython-311-darwin.so
  Reason: tried: '/opt/homebrew/opt/gcc/lib/gcc/current/libgfortran.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/gcc/lib/gcc/current/libgfortran.5.dylib' (no such file), '/opt/homebrew/opt/gcc/lib/gcc/current/libgfortran.5.dylib' (no such file), '/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib/libgfortran.5.dylib' (no such file), '/Users/pranav/spack/var/spack/environments/repro/.spack-env/view/lib64/libgfortran.5.dylib' (no such file), './libgfortran.5.dylib' (no such file)

I am not sure if there is something lingering from homebrew since I have deleted it. But I would think this error indicates py-scipy has a gfortran dependency?

Information on your system

  • Spack: 0.22.0.dev0 (3c57440)
  • Python: 3.9.6
  • Platform: darwin-sonoma-m1
  • Concretizer: clingo

Additional information

No response

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have run spack maintainers <name-of-the-package> and @mentioned any maintainers
  • I have uploaded the build log and environment files
  • I have searched the issues of this repo and believe this is not a duplicate

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions