ReactionMechanismGenerator / RMG-Py

Python version of the amazing Reaction Mechanism Generator (RMG).
http://reactionmechanismgenerator.github.io/RMG-Py/
Other
397 stars 228 forks source link

Trouble loading libtbb.dylib in Julia when installing diffeqpy #2668

Closed rwest closed 5 months ago

rwest commented 5 months ago

Bug Description

Trying to follow parts of https://reactionmechanismgenerator.github.io/RMG-Py/users/rmg/installation/anacondaDeveloper.html# on an intel mac when I reach

python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"

I currently get

python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
[ Info: Julia version info
Julia Version 1.9.2
Commit e4ee485e90 (2023-07-05 09:39 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin13.4.0)
  uname: Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64 i386
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz: 
                 speed         user         nice          sys         idle          irq
       #1-12  2600 MHz    5707478 s          0 s    2209434 s   60857860 s          0 s
  Memory: 32.0 GB (2694.18359375 MB free)
  Uptime: 1.257625e6 sec
  Load Avg:  9.0458984375  7.0146484375  6.6630859375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 1 on 12 virtual cores
Environment:
  JULIA_DEPOT_PATH_BACKUP = 
  JULIA_PROJECT_BACKUP = 
  JULIA_LOAD_PATH_BACKUP = 
  JULIA_DEPOT_PATH = /Users/rwest/miniconda3/envs/rmg_env7/share/julia:
  JULIA_PROJECT = @rmg_env7
  JULIA_LOAD_PATH = @:@rmg_env7:@stdlib
  JULIA_SSL_CA_ROOTS_PATH_BACKUP = 
  JULIA_CONDAPKG_BACKEND_BACKUP = 
  JULIA_CONDAPKG_BACKEND = System
  JULIA_CONDAPKG_EXE_BACKUP = 
  JULIA_CONDAPKG_EXE = /Users/rwest/miniconda3/bin/conda
  TERM = xterm-color
  PATH = /Users/rwest/Code/RMG-Py:/Users/rwest/miniconda3/envs/rmg_env7/bin:/Users/rwest/miniconda3/condabin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/TeX/texbin
  XPC_FLAGS = 0x0
  HOME = /Users/rwest
  PYTHONPATH = /Users/rwest/Code/RMG-Py/:/Users/rwest/Code/RMG-Py/:
  CONDA_JL_HOME_BACKUP = 
  CONDA_JL_HOME = /Users/rwest/miniconda3/envs/rmg_env7
[ Info: Julia executable: /Users/rwest/miniconda3/envs/rmg_env7/bin/julia
[ Info: Trying to import PyCall...
┌ Info: PyCall is already installed and compatible with Python executable.
│ 
│ PyCall:
│     python: /Users/rwest/miniconda3/envs/rmg_env7/bin/python
│     libpython: /Users/rwest/miniconda3/envs/rmg_env7/lib/libpython3.7m.dylib
│ Python:
│     python: /Users/rwest/miniconda3/envs/rmg_env7/bin/python
└     libpython: 
   Resolving package versions...
  No Changes to `~/miniconda3/envs/rmg_env7/share/julia/environments/rmg_env7/Project.toml`
  No Changes to `~/miniconda3/envs/rmg_env7/share/julia/environments/rmg_env7/Manifest.toml`
   Resolving package versions...
  No Changes to `~/miniconda3/envs/rmg_env7/share/julia/environments/rmg_env7/Project.toml`
  No Changes to `~/miniconda3/envs/rmg_env7/share/julia/environments/rmg_env7/Manifest.toml`
   Resolving package versions...
  No Changes to `~/miniconda3/envs/rmg_env7/share/julia/environments/rmg_env7/Project.toml`
  No Changes to `~/miniconda3/envs/rmg_env7/share/julia/environments/rmg_env7/Manifest.toml`
ERROR: LoadError: InitError: could not load library "@rpath/libspqr.2.dylib"
dlopen(@rpath/libspqr.2.dylib, 0x0001): Library not loaded: @rpath/libtbb.dylib
  Referenced from: <D2B2A060-F4A6-34EA-BC95-649F75FE4EA1> /Users/rwest/miniconda3/envs/rmg_env7/lib/libspqr.2.0.9.dylib
  Reason: tried: '/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/julia/libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/julia/../libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/usr/local/lib/libtbb.dylib' (no such file), '/usr/lib/libtbb.dylib' (no such file, not in dyld cache)
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen
    @ ./libdl.jl:116 [inlined]
  [3] dlopen(s::String)
    @ Base.Libc.Libdl ./libdl.jl:116
  [4] __init__()
    @ SuiteSparse_jll ~/miniconda3/envs/rmg_env7/share/julia/stdlib/v1.9/SuiteSparse_jll/src/SuiteSparse_jll.jl:104
  [5] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1115
  [6] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1061
  [7] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1391
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base ./loading.jl:1494
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1783
 [10] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1660
 [11] macro expansion
    @ ./loading.jl:1648 [inlined]
 [12] macro expansion
    @ ./lock.jl:267 [inlined]
 [13] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1611
during initialization of module SuiteSparse_jll
in expression starting at /Users/rwest/miniconda3/envs/rmg_env7/lib/python3.7/site-packages/diffeqpy/install.jl:5
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/rwest/miniconda3/envs/rmg_env7/lib/python3.7/site-packages/diffeqpy/__init__.py", line 11, in install
    subprocess.check_call(['julia', os.path.join(script_dir, 'install.jl')])
  File "/Users/rwest/miniconda3/envs/rmg_env7/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['julia', '/Users/rwest/miniconda3/envs/rmg_env7/lib/python3.7/site-packages/diffeqpy/install.jl']' returned non-zero exit status 1.

Focusing on the Library not loaded: @rpath/libtbb.dylib Referenced from: <D2B2A060-F4A6-34EA-BC95-649F75FE4EA1> /Users/rwest/miniconda3/envs/rmg_env7/lib/libspqr.2.0.9.dylib Reason: tried: '/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/julia/libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/julia/../libtbb.dylib' (no such file), '/Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.dylib' (no such file), '/usr/local/lib/libtbb.dylib' (no such file), '/usr/lib/libtbb.dylib' (no such file, not in dyld cache)

I have tbb instaled via conda and I notice that I have all these dylibs in /Users/rwest/miniconda3/envs/rmg_env7/lib: /Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.12.10.dylib /Users/rwest/miniconda3/envs/rmg_env7/lib/libtbbmalloc.2.dylib /Users/rwest/miniconda3/envs/rmg_env7/lib/libtbb.12.dylib /Users/rwest/miniconda3/envs/rmg_env7/lib/libtbbmalloc_proxy.2.10.dylib /Users/rwest/miniconda3/envs/rmg_env7/lib/libtbbmalloc.2.10.dylib /Users/rwest/miniconda3/envs/rmg_env7/lib/libtbbmalloc_proxy.2.dylib

Installation Information

Describe your installation method and system information.

rwest commented 5 months ago

This was solved by creating a new conda environment from scratch and following the installation instructions from the top. (i.e. replace conda env create -f environment.yml with conda env create -n rmg_env2 -f environment.yml and then use the rmg_env2 environment. I am now up to rmg_env8). I think the problem was from trying to maintain and update an existing environment incrementally.

Just like my first step for debugging anything in a Jupyter notebook is "reset kernel and run from the top", and for debugging anything in RMG-Py it is "make clean; make", now my go-to advice with anything suspicious about conda packages is going to be "make a new environment from scratch".