Failed to precompile Bonds

谢谢,Xtals包里有这个Crystal函数,但using模块里没使用这个包,我想安装这个包:

(v1.3) pkg> add Xtals
  Updating registry at `C:\Users\zzh666\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
┌ Warning: Some registries failed to update:
│     — C:\Users\zzh666\.julia\registries\General — failed to fetch from repo
└ @ Pkg.Types D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\Pkg\src\Types.jl:1199
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFrames [a93c6f00]:
 DataFrames [a93c6f00] log:
 ├─possible versions are: [0.11.7, 0.12.0, 0.13.0-0.13.1, 0.14.0-0.14.1, 0.15.0-0.15.2, 0.16.0, 0.17.0-0.17.1, 0.18.0-0.18.4, 0.19.0-0.19.4, 0.20.0-0.20.2, 0.21.0-0.21.8, 0.22.0-0.22.7, 1.0.0-1.0.2, 1.1.0-1.1.1, 1.2.0-1.2.2, 1.3.0-1.3.4] or uninstalled
 ├─restricted to versions 0.20.2 by an explicit requirement, leaving only versions 0.20.2
 └─restricted by compatibility requirements with Xtals [ede5f01d] to versions: [0.22.1-0.22.7, 1.0.0-1.0.2, 1.1.0-1.1.1, 1.2.0-1.2.2, 1.3.0-1.3.4] — no versions left
   └─Xtals [ede5f01d] log:
     ├─possible versions are: [0.2.0-0.2.2, 0.3.0-0.3.12, 0.4.0-0.4.4] or uninstalled
     ├─restricted to versions * by an explicit requirement, leaving only versions [0.2.0-0.2.2, 0.3.0-0.3.12, 0.4.0-0.4.4]
     └─restricted by julia compatibility requirements to versions: 0.3.11 or uninstalled, leaving only versions: 0.3.11

安装不了,关键作者原始代码里没用Xtals这个包

这个东西…… Xtals或至少一个dep的compat有问题,不知道注册的时候怎么过的,问题有点严重

(MARK): JuliaHub

谢谢大佬,我就是想把作者给的模型文件:Construct graphs representing the MOF.ipynb。把它能跑通就行,有什么办法吗,感谢大佬!

跑通就行啊…… 可以试试把那个包代码直接下载下来,手动include,不行就把compat改宽松一点手动activate

大佬,可以加一下联系方式吗,我有筹谢!我本身学python的,刚接触julia一星期,您说的那些我听不太懂,谢谢大佬

没空,但是欢迎查阅我做的

第一种就比如说把代码下载到"D:/QWQ",然后include("D:/QWQ/src/Xtals.jl"); using Main.Xtals
第二种就改Project.toml里的[compat],在包管理器模式下调用activate D:/QWQ,然后using Xtals

谢谢你!虽然暂时不知道怎么操作,我会去看你的作品

等等啊,你现在不是在跑这个包吗,就按照上述2种方法挣扎

还有个报错
Failed to precompile Bonds [top-level] to C:\Users\zzh666.julia\compiled\v1.3\Bonds.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1283
[3] _require(::Base.PkgId) at .\loading.jl:1024
[4] require(::Base.PkgId) at .\loading.jl:922
[5] require(::Module, ::Symbol) at .\loading.jl:917
[6] top-level scope at In[9]:15

Bonds是作者写的自定义模块

确定ERROR Message截全了吗?这咋没给原因啊


开头就这两个,后面的因为这两个错误,我看没运行


这是开头

所以这个做了吗,做了请发新的error谢谢

@info "making edge list zero-based indexed for Python"
┌ Info: making edge list zero-based indexed for Python
└ @ Main REPL[114]:1

julia>

julia> keep_xtal = [true for i = 1:length(xtalnames)]
2325-element Vector{Bool}:
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 ⋮
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1
 1

julia>

julia> @showprogress for (i_xtal, xtalname) in enumerate(xtalnames)
julia> @showprogress for (i_xtal, xtalname) in enumerate(xtalnames)
           crystal = Crystal(xtalname * ".cif", include_zero_charges=true;check_overlap=false)
julia> @showprogress for (i_xtal, xtalname) in enumerate(xtalnames)
           crystal = Crystal(xtalname * ".cif", include_zero_charges=true;check_overlap=false)
               @assert ! all(crystal.charges.q .== 0)
julia> @showprogress for (i_xtal, xtalname) in enumerate(xtalnames)
           crystal = Crystal(xtalname * ".cif", include_zero_charges=true;check_overlap=false)
               @assert ! all(crystal.charges.q .== 0)
           try
julia> @showprogress for (i_xtal, xtalname) in enumerate(xtalnames)
           crystal = Crystal(xtalname * ".cif", include_zero_charges=true;check_overlap=false)
               @assert ! all(crystal.charges.q .== 0)
           try
               bonds!(crystal, true)
                   catch e
               if isa(e, PyCall.PyError)
                           remove_bonds!(crystal) # some of the bonds were probz formed
                   println("Voronoi problems with " * crystal.name)
                   infer_bonds!(crystal, true) # infer bonds with old distance-based version
               else
                   error("bond! error for " * crystal.name)
               end
           end
           @assert nv(crystal.bonds) == crystal.atoms.n

           if ! PorousMaterials.bond_sanity_check(crystal)
               keep_xtal[i_xtal] = false
               @warn "throwing out " crystal.name
               continue
                   end

           ###
           #    node features
           #    one-hot encoding. each row is an atom.
           ###
           x_ν = zeros(Int, crystal.atoms.n, length(ATOMS))
           for (i, atom) in enumerate(crystal.atoms.species)
                   x_ν[i, ATOM_TO_INT[atom]] = 1
           end
           @assert sum(x_ν) == crystal.atoms.n
           npzwrite(joinpath("graphs1", xtalname * "_node_features.npy"), x_ν)

           ###
           #    node labels (the charges)
           ###
               y_ν = deepcopy(crystal.charges.q)
           npzwrite(joinpath("graphs1", xtalname * "_node_labels.npy"), y_ν)
           @assert length(y_ν) == size(x_ν)[1]

               ###
           #   edges
           #   (a list and their feature = distance btwn atoms)
           ###
           edge_file = open(joinpath("graphs1", xtalname * ".edge_info"), "w")
           @printf(edge_file, "src,dst,r\n")
           for ed in edges(crystal.bonds)
                   i = src(ed) # source
               j = dst(ed) # destination
               r = distance(crystal.atoms, crystal.box, i, j, true)
               @printf(edge_file, "%d,%d,%f\n", i - 1, j - 1, r)
           end
           close(edge_file)
       end
ERROR: bond! error for SEHSUU_clean.cif
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:33
 [2] macro expansion
   @ .\REPL[116]:12 [inlined]
 [3] top-level scope
   @ C:\Users\zzh666\.julia\packages\ProgressMeter\sN2xr\src\ProgressMeter.jl:938

caused by: UndefVarError: ne not defined
Stacktrace:
 [1] bonds!(crystal::Crystal, apply_pbc::Bool)
   @ Bonds C:\Users\zzh666\Desktop\renwu\renwu13-3\111\mpn_charges-master\build_graphs\Bonds.jl:150
 [2] macro expansion
   @ .\REPL[116]:5 [inlined]
 [3] top-level scope
   @ C:\Users\zzh666\.julia\packages\ProgressMeter\sN2xr\src\ProgressMeter.jl:938

julia>

julia> writedlm(open("list_of_crystals.txt", "w"), xtalnames[keep_xtal])

julia>

那里不能回复了,这是跑得结果

这个 ne 你找到了吗

没找到这个ne,作者似乎也没提供

@info "making edge list zero-based indexed for Python"

keep_xtal = [true for i = 1:length(xtalnames)]

@showprogress for (i_xtal, xtalname) in enumerate(xtalnames)
    crystal = Crystal(xtalname * ".cif", include_zero_charges=true;check_overlap=false)
    @assert ! all(crystal.charges.q .== 0)
    try
        bonds!(crystal, true)
    catch e
        if isa(e, PyCall.PyError)
            remove_bonds!(crystal) # some of the bonds were probz formed
            println("Voronoi problems with " * crystal.name)
            infer_bonds!(crystal, true) # infer bonds with old distance-based version
        else
            print("!!!", crystal.name); throw(e)
        end
    end
    @assert nv(crystal.bonds) == crystal.atoms.n
    
    if ! PorousMaterials.bond_sanity_check(crystal)
        keep_xtal[i_xtal] = false
        @warn "throwing out " crystal.name
        continue
    end
    
    ###
    #    node features
    #    one-hot encoding. each row is an atom.
    ###
    x_ν = zeros(Int, crystal.atoms.n, length(ATOMS))
    for (i, atom) in enumerate(crystal.atoms.species)
        x_ν[i, ATOM_TO_INT[atom]] = 1
    end
    @assert sum(x_ν) == crystal.atoms.n
    npzwrite(joinpath("graphs1", xtalname * "_node_features.npy"), x_ν)

    ###
    #    node labels (the charges)
    ###
    y_ν = deepcopy(crystal.charges.q)
    npzwrite(joinpath("graphs1", xtalname * "_node_labels.npy"), y_ν)
    @assert length(y_ν) == size(x_ν)[1]

    ###
    #   edges
    #   (a list and their feature = distance btwn atoms)
    ###
    edge_file = open(joinpath("graphs1", xtalname * ".edge_info"), "w")
    @printf(edge_file, "src,dst,r\n")
    for ed in edges(crystal.bonds)
        i = src(ed) # source
        j = dst(ed) # destination
        r = distance(crystal.atoms, crystal.box, i, j, true)
        @printf(edge_file, "%d,%d,%f\n", i - 1, j - 1, r)
    end
    close(edge_file)
end

writedlm(open("list_of_crystals.txt", "w"), xtalnames[keep_xtal])
WARNING: both Graphs and LightGraphs export "edges"; uses of it in module Main must be qualified
WARNING: both Graphs and LightGraphs export "nv"; uses of it in module Main must be qualified
WARNING: both Graphs and LightGraphs export "add_edge!"; uses of it in module Bonds must be qualified
WARNING: both Graphs and LightGraphs export "ne"; uses of it in module Bonds must be qualified
WARNING: both Graphs and LightGraphs export "src"; uses of it in module Main must be qualified
WARNING: both Graphs and LightGraphs export "dst"; uses of it in module Main must be qualified
!!!SEHSUU_clean.cifERROR: UndefVarError: ne not defined
Stacktrace:
 [1] macro expansion
   @ .\REPL[97]:12 [inlined]
 [2] top-level scope
   @ C:\Users\zzh666\.julia\packages\ProgressMeter\sN2xr\src\ProgressMeter.jl:938

caused by: UndefVarError: ne not defined
Stacktrace:
 [1] bonds!(crystal::Crystal, apply_pbc::Bool)
   @ Bonds C:\Users\zzh666\Desktop\renwu\renwu13-3\111\mpn_charges-master\build_graphs\Bonds.jl:150
 [2] macro expansion
   @ .\REPL[97]:5 [inlined]
 [3] top-level scope
   @ C:\Users\zzh666\.julia\packages\ProgressMeter\sN2xr\src\ProgressMeter.jl:938

刚跑得,似乎Graphs and LightGraphs有这个包
WARNING: both Graphs and LightGraphs export “ne”; uses of it in module Bonds must be qualified

应该是一样的,就加个Graphs.ne吧


直接一开始报错