M1上的Julia:未定义的Libhd5f

发布于 2025-01-25 14:50:38 字数 2645 浏览 2 评论 0原文

我正在朱莉娅v1.7.2中遇到一个错误。

我正在尝试包括使用模块的util.jl文件。

该模块中的所有内容都可以正常工作(我已经放入pluto.jl笔记本上,一切都运行)。

但是,当我尝试以下代码行时,

using Pkg
Pkg.activate(joinpath(@__DIR__, "../../dev/"))
using Module

我会收到此错误

    Activating project at `~/Desktop/dev`
    ERROR: LoadError: UndefVarError: libhdf5 not defined
    Stacktrace:
      [1] top-level scope
         @ ~/.julia/packages/HDF5/pIJra/src/api_types.jl:119
      [2] include(mod::Module, _path::String)
    @ Base ./Base.jl:418
  [3] include(x::String)
    @ HDF5 ~/.julia/packages/HDF5/pIJra/src/HDF5.jl:1
  [4] top-level scope
    @ ~/.julia/packages/HDF5/pIJra/src/HDF5.jl:51
  [5] include
    @ ./Base.jl:418 [inlined]
  [6] 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, UInt64}}, source::String)
    @ Base ./loading.jl:1318
  [7] top-level scope
    @ none:1
  [8] eval
    @ ./boot.jl:373 [inlined]
  [9] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [10] top-level scope
    @ none:1
in expression starting at /Users/me/.julia/packages/HDF5/pIJra/src/api_types.jl:119
in expression starting at /Users/me/.julia/packages/HDF5/pIJra/src/HDF5.jl:1
ERROR: LoadError: Failed to precompile HDF5 [f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f] to /Users/me/.julia/compiled/v1.7/HDF5/jl_m27neP.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include
    @ ./Base.jl:418 [inlined]
  [8] 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, UInt64}}, source::String)
    @ Base ./loading.jl:1318
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:373 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [12] top-level scope
    @ none:1
in expression starting at /Users/me/Desktop/src/Module.jl:1

,但是,如果我尝试的话,

using HDF5

我没有任何问题。

我不明白为什么我可以使用HDF5可以很好地使用;我可以在模块中运行所有内容。但是,当我尝试导入模块时,我会遇到一个错误,说HDF5存在问题。谁能对朱莉娅(Julia)的工作方式提供一些其他见解,这对我来说是有意义的吗?

I am encountering a bug in Julia v1.7.2.

I am trying to include a util.jl file that uses a Module.

Everything in that module works fine (I have put into a Pluto.jl notebook and everything runs).

However, when I try the following lines of code,

using Pkg
Pkg.activate(joinpath(@__DIR__, "../../dev/"))
using Module

I get this error

    Activating project at `~/Desktop/dev`
    ERROR: LoadError: UndefVarError: libhdf5 not defined
    Stacktrace:
      [1] top-level scope
         @ ~/.julia/packages/HDF5/pIJra/src/api_types.jl:119
      [2] include(mod::Module, _path::String)
    @ Base ./Base.jl:418
  [3] include(x::String)
    @ HDF5 ~/.julia/packages/HDF5/pIJra/src/HDF5.jl:1
  [4] top-level scope
    @ ~/.julia/packages/HDF5/pIJra/src/HDF5.jl:51
  [5] include
    @ ./Base.jl:418 [inlined]
  [6] 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, UInt64}}, source::String)
    @ Base ./loading.jl:1318
  [7] top-level scope
    @ none:1
  [8] eval
    @ ./boot.jl:373 [inlined]
  [9] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [10] top-level scope
    @ none:1
in expression starting at /Users/me/.julia/packages/HDF5/pIJra/src/api_types.jl:119
in expression starting at /Users/me/.julia/packages/HDF5/pIJra/src/HDF5.jl:1
ERROR: LoadError: Failed to precompile HDF5 [f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f] to /Users/me/.julia/compiled/v1.7/HDF5/jl_m27neP.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include
    @ ./Base.jl:418 [inlined]
  [8] 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, UInt64}}, source::String)
    @ Base ./loading.jl:1318
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:373 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [12] top-level scope
    @ none:1
in expression starting at /Users/me/Desktop/src/Module.jl:1

However, if I just try

using HDF5

I don't have any problem.

I don't understand why I can use using HDF5 just fine; I can run everything in the module just fine; but when I try to import the module, I get an error saying there is a problem with HDF5. Can anyone provide some additional insight into how Julia works that could make this problem make sense to me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鼻尖触碰 2025-02-01 14:50:38

您是与罗塞塔(Rosetta)或本地构建一起跑步吗?如果本机,则应尝试1.8rc3,因为1.7有很多与M1本机的错误。

Are you running with Rosetta or the native build? If native, you should try 1.8rc3 since 1.7 has a lot of bugs with M1 native.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文