【问题标题】:JuliaBox - LoadError: unlink: read-only file system (EROFS) Failed to precompile .julia/lib/v0.4/PyCall.jiJuliaBox - LoadError: unlink: read-only file system (EROFS) Failed to precompile .julia/lib/v0.4/PyCall.ji
【发布时间】:2015-12-30 00:14:40
【问题描述】:

我正在Juliabox (IJulia Notebook) 中使用 PyPlot 运行一个小型 Julia 程序,但它出现错误并显示如下所示的错误消息。我不确定它是否正在尝试使用我机器的磁盘进行写入,但我在那里有有效的 R+W 访问权限。基本上我正在尝试这里提到的示例:https://www.juliabox.org/notebooks/tutorial/Plotting%20in%20Julia.ipynb#

LoadError: unlink: read-only file system (EROFS)

Pkg.add("PyPlot")
using PyPlot

for i = 1.0:300.0
    for j = 1.0+i:250.0, k=1.0:10
        plot(i+j, i*k/j, color="red", linewidth=1.0, linestyle="--")
        i += 0.1
        j += 0.05
        k += 0.01
    end
end

错误日志:

INFO: Nothing to be done
INFO: Precompiling module PyPlot...
INFO: Recompiling stale cache file /opt/julia_packages/.julia/lib/v0.4/Compat.ji for module Compat.
ERROR: LoadError: unlink: read-only file system (EROFS)
 in unlink at fs.jl:102
 in rm at file.jl:59
 in create_expr_cache at loading.jl:330
 in recompile_stale at loading.jl:461
 in _require_from_serialized at loading.jl:83
 in _require_from_serialized at ./loading.jl:109
 in require at ./loading.jl:219
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
 [inlined code] from none:2
 in anonymous at no file:0
 in process_options at ./client.jl:257
 in _start at ./client.jl:378
while loading /home/juser/.julia/v0.4/PyCall/src/PyCall.jl, in expression starting on line 26
ERROR: LoadError: Failed to precompile PyCall to /home/juser/.julia/lib/v0.4/PyCall.ji
 in error at ./error.jl:21
 in compilecache at loading.jl:384
 in require at ./loading.jl:224
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
 [inlined code] from none:2
 in anonymous at no file:0
 in process_options at ./client.jl:257
 in _start at ./client.jl:378
while loading /home/juser/.julia/v0.4/PyPlot/src/PyPlot.jl, in expression starting on line 5

LoadError: Failed to precompile PyPlot to /home/juser/.julia/lib/v0.4/PyPlot.ji
while loading In[10], in expression starting on line 2

 in error at ./error.jl:21
 in compilecache at loading.jl:384
 in require at ./loading.jl:250

如果我使用 0.3.12 版本(IJulia Notebook),那么它会编译并显示INFO: Nothing to be done,但不会显示任何输出(一些图形绘图等)。

【问题讨论】:

标签: julia readonly unlink ijulia-notebook


【解决方案1】:

感谢 ali_m。以下是该帖子内容的主要摘要。

问题似乎是 JuliaBox 在只读目录 /opt/julia_packages/.julia/lib/v0.4 中提供了一些预编译的缓存文件。如果在某个时候它检测到缓存过时并尝试重新编译它,它就会失败。

这需要在 Julia 本身中修复——它不应该在重新编译时尝试从只读目录中删除缓存文件。

问题链接是https://github.com/JuliaLang/julia/issues/14368

要仅在 0.4.2 中解决它,可以使用(这将从 Base.LOAD_CACHE_PATH 数组/set/tuple 中删除第三个索引值)到 JuliaBox 上的 .juliarc 文件,以从搜索路径。或者只是在键入之前手动运行它,使用 Compat 等来重建缓存,而不使用只读搜索路径。

splice!(Base.LOAD_CACHE_PATH, 3)

splice! 函数的一个很好的例子 (PS:Julia 中以 ! 结尾的函数,其名称意味着,该函数不仅会完成其工作,还会更改其参数数据/值)。

# Remove elements from an array by index with splice!
arr = [3,4,5]
splice!(arr,2) # => 4 ; arr is now [3,5]

建议的解决方法适用于 0.4.2(使用 echo 'splice!(Base.LOAD_CACHE_PATH, 3)' > ~/.juliarc.jl 将行插入 juliarc)但显然 LOAD_CACHE_PATH 在启动 Julia 0.3.12 时未定义,因此这将在那里失败。

在同一文件中添加以下行修复此问题(添加条件以在 Julia 中的版本为 0.4 或更高版本时工作)。我在 0.5 开发版本中没有看到这个问题,所以我们很好。

VERSION >= v"0.4" && splice!(Base.LOAD_CACHE_PATH, 3)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 2021-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多