Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install FFTW on Apple M2-MAX chip, libmkl_rt_path not defined #274

Open
xiang-yu opened this issue Jul 2, 2023 · 10 comments · May be fixed by #278
Open

Cannot install FFTW on Apple M2-MAX chip, libmkl_rt_path not defined #274

xiang-yu opened this issue Jul 2, 2023 · 10 comments · May be fixed by #278

Comments

@xiang-yu
Copy link

xiang-yu commented Jul 2, 2023

Hi everyone,

I've got the following error when installing the "FFTW" package with Julia version 1.9.1 on M2 Max chip with Ventura 13.4

Any tips on resolving this?

using FFTW
│ Package FFTW not found, but a package named FFTW is available from a registry. 
│ Install package?
│   (@v1.9) pkg> add FFTW 
└ (y/n/o) [y]: y
   Updating registry at `~/.julia/registries/General.toml`
  Resolving package versions...
   Updating `~/.julia/environments/v1.9/Project.toml`
 [7a1cc6ca] + FFTW v1.7.1
   Updating `~/.julia/environments/v1.9/Manifest.toml`
 [621f4979] + AbstractFFTs v1.3.2
 [7a1cc6ca] + FFTW v1.7.1
 [f5851436] + FFTW_jll v3.3.10+0
 [1d5cc7b8] + IntelOpenMP_jll v2023.1.0+0
 [856f044c] + MKL_jll v2023.1.0+0
[ Info: Precompiling FFTW [7a1cc6ca-52ef-59f5-83cd-3a7055c09341]
ERROR: LoadError: UndefVarError: `libmkl_rt_path` not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
  @ Base ./Base.jl:31
[2] top-level scope
  @ ~/.julia/packages/FFTW/HfEjB/src/providers.jl:86
[3] include(mod::Module, _path::String)
  @ Base ./Base.jl:457
[4] include(x::String)
  @ FFTW ~/.julia/packages/FFTW/HfEjB/src/FFTW.jl:1
[5] top-level scope
  @ ~/.julia/packages/FFTW/HfEjB/src/FFTW.jl:17
[6] include
  @ ./Base.jl:457 [inlined]
[7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
  @ Base ./loading.jl:2045
[8] top-level scope
  @ stdin:3
in expression starting at /Users/.julia/packages/FFTW/HfEjB/src/providers.jl:84
in expression starting at /Users/.julia/packages/FFTW/HfEjB/src/FFTW.jl:1
in expression starting at stdin:3
ERROR: Failed to precompile FFTW [7a1cc6ca-52ef-59f5-83cd-3a7055c09341] to "/Users/.julia/compiled/v1.9/FFTW/jl_HmZkkA".
Stacktrace:
[1] error(s::String)
  @ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
  @ Base ./loading.jl:2296
[3] compilecache
  @ ./loading.jl:2163 [inlined]
[4] _require(pkg::Base.PkgId, env::String)
  @ Base ./loading.jl:1805
[5] _require_prelocked(uuidkey::Base.PkgId, env::String)
  @ Base ./loading.jl:1660
[6] macro expansion
  @ ./loading.jl:1648 [inlined]
[7] macro expansion
  @ ./lock.jl:267 [inlined]
[8] require(into::Module, mod::Symbol)
  @ Base ./loading.jl:1611
@giordano
Copy link
Member

giordano commented Jul 2, 2023

The offending line is

libfftw3[] = MKL_jll.libmkl_rt_path
but that's inside the block guarded by
@static if fftw_provider == "mkl"
so it appears you are explicitly requesting MKL, which isn't available on ARM CPUs. You should just not do that. See https://juliamath.github.io/FFTW.jl/stable/#Installation

@xiang-yu
Copy link
Author

xiang-yu commented Jul 2, 2023

Thanks a lot for your prompt, @giordano!
I don't even get a chance to not request for the MKL.
Here are my command for installing FFTW. As you see the error occurs before I can execute
using FFTW. Any tips on overcoming this? I am totally happy with just using the default version without MKL.

Pkg.add("FFTW")
julia> using FFTW
[ Info: Precompiling FFTW [7a1cc6ca-52ef-59f5-83cd-3a7055c09341]
ERROR: LoadError: UndefVarError: `libmkl_rt_path` not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base ./Base.jl:31
 [2] top-level scope
   @ ~/.julia/packages/FFTW/HfEjB/src/providers.jl:86
 [3] include(mod::Module, _path::String)
   @ Base ./Base.jl:457
 [4] include(x::String)
   @ FFTW ~/.julia/packages/FFTW/HfEjB/src/FFTW.jl:1
 [5] top-level scope
   @ ~/.julia/packages/FFTW/HfEjB/src/FFTW.jl:17
 [6] include
   @ ./Base.jl:457 [inlined]
 [7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
   @ Base ./loading.jl:2045
 [8] top-level scope
   @ stdin:3
in expression starting at /Users/.julia/packages/FFTW/HfEjB/src/providers.jl:84
in expression starting at /Users/.julia/packages/FFTW/HfEjB/src/FFTW.jl:1
in expression starting at stdin:3
ERROR: Failed to precompile FFTW [7a1cc6ca-52ef-59f5-83cd-3a7055c09341] to "/Users/.julia/compiled/v1.9/FFTW/jl_8W5MoO".
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:2296
 [3] compilecache
   @ ./loading.jl:2163 [inlined]
 [4] _require(pkg::Base.PkgId, env::String)
   @ Base ./loading.jl:1805
 [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
   @ Base ./loading.jl:1660
 [6] macro expansion
   @ ./loading.jl:1648 [inlined]
 [7] macro expansion
   @ ./lock.jl:267 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1611
julia> FFTW.set_provider!("fftw")
ERROR: UndefVarError: `FFTW` not defined
Stacktrace:
 [1] top-level scope
   @ REPL[6]:1

@giordano
Copy link
Member

giordano commented Jul 2, 2023

Please use triple backticks to quote your code blocks on github, to make the code you post more readable: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

@xiang-yu
Copy link
Author

xiang-yu commented Jul 2, 2023

I've now updated my code. How about now? @giordano

@giordano
Copy link
Member

giordano commented Jul 3, 2023

Not really, but I fixed that for you again.

Anyway, you're saying that you're trying to install FFTW in a fresh environment without any LocalPreferences.toml file?

@xiang-yu
Copy link
Author

xiang-yu commented Jul 3, 2023

Thanks @giordano . Yes, I think so. I used the "Finder" function on Mac and couldn't find it. How to find the LocalPreferences.toml file of the FFTW package?

cd ~/.julia/packages/
rm -rf MKL_jll
rm -rf IntelOpenMP_jll
rm -rf FFTW
rm -rf FFTW_jll
rm -rf AbstractFFTs
julia> Pkg.rm("FFTW")
    Updating `~/.julia/environments/v1.9/Project.toml`
  [7a1cc6ca] - FFTW v1.7.1
    Updating `~/.julia/environments/v1.9/Manifest.toml`
  [621f4979] - AbstractFFTs v1.3.2
  [7a1cc6ca] - FFTW v1.7.1
  [f5851436] - FFTW_jll v3.3.10+0
  [1d5cc7b8] - IntelOpenMP_jll v2023.1.0+0
  [856f044c] - MKL_jll v2023.1.0+0
julia> using FFTW
 │ Package FFTW not found, but a package named FFTW is available from a registry. 
 │ Install package?
 │   (@v1.9) pkg> add FFTW 
 └ (y/n/o) [y]: y
   Resolving package versions...
   Installed MKL_jll ───────── v2023.1.0+0
   Installed IntelOpenMP_jll ─ v2023.1.0+0
   Installed FFTW_jll ──────── v3.3.10+0
   Installed FFTW ──────────── v1.7.1
   Installed AbstractFFTs ──── v1.3.2
    Updating `~/.julia/environments/v1.9/Project.toml`
  [7a1cc6ca] + FFTW v1.7.1
    Updating `~/.julia/environments/v1.9/Manifest.toml`
  [621f4979] + AbstractFFTs v1.3.2
  [7a1cc6ca] + FFTW v1.7.1
  [f5851436] + FFTW_jll v3.3.10+0
  [1d5cc7b8] + IntelOpenMP_jll v2023.1.0+0
  [856f044c] + MKL_jll v2023.1.0+0
Precompiling project...
  ✗ FFTW
  4 dependencies successfully precompiled in 3 seconds. 34 already precompiled.
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package
[ Info: Precompiling FFTW [7a1cc6ca-52ef-59f5-83cd-3a7055c09341]
ERROR: LoadError: UndefVarError: `libmkl_rt_path` not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base ./Base.jl:31
 [2] top-level scope
   @ ~/.julia/packages/FFTW/HfEjB/src/providers.jl:86
 [3] include(mod::Module, _path::String)
   @ Base ./Base.jl:457
 [4] include(x::String)
   @ FFTW ~/.julia/packages/FFTW/HfEjB/src/FFTW.jl:1
 [5] top-level scope
   @ ~/.julia/packages/FFTW/HfEjB/src/FFTW.jl:17
 [6] include
   @ ./Base.jl:457 [inlined]
 [7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
   @ Base ./loading.jl:2045
 [8] top-level scope
   @ stdin:3
in expression starting at /Users/.julia/packages/FFTW/HfEjB/src/providers.jl:84
in expression starting at /Users/.julia/packages/FFTW/HfEjB/src/FFTW.jl:1
in expression starting at stdin:3
ERROR: Failed to precompile FFTW [7a1cc6ca-52ef-59f5-83cd-3a7055c09341] to "/Users/.julia/compiled/v1.9/FFTW/jl_n1k2mJ".
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:2296
 [3] compilecache
   @ ./loading.jl:2163 [inlined]
 [4] _require(pkg::Base.PkgId, env::String)
   @ Base ./loading.jl:1805
 [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
   @ Base ./loading.jl:1660
 [6] macro expansion
   @ ./loading.jl:1648 [inlined]
 [7] macro expansion
   @ ./lock.jl:267 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1611

@stevengj
Copy link
Member

stevengj commented Jul 3, 2023

Is this a completely fresh install of Julia or did you migrate over from an older Mac where you copied your old .julia folder and perhaps inadvertently copied over a package preference for MKL?

Short of deleting ~/.julia and re-installing everything, I think you can set the FFTW preference to be non-MKL without installing FFTW first by something like:

using Preferences, UUIDs
fftw = UUID("7a1cc6ca-52ef-59f5-83cd-3a7055c09341")
set_preferences!(fftw, "provider" => "fftw")

@stevengj
Copy link
Member

stevengj commented Jul 3, 2023

That being said, maybe we should look at Sys.ARCH before attempting to use MKL.

@giordano
Copy link
Member

giordano commented Jul 3, 2023

Or more generally MKL_jll.is_available(), which would would tell whether MKL is available for the current platform or not.

@xiang-yu
Copy link
Author

xiang-yu commented Jul 4, 2023

Thank you, @giordano @stevengj , both. I completely uninstalled Julia and reinstalled it ago. The default FFTW works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants