mojaie / MolecularGraph.jl

Graph-based molecule modeling toolkit for cheminformatics
MIT License
189 stars 27 forks source link

`UndefVarError: libcoordgen not defined` when drawing a molecule #68

Closed SimonEnsemble closed 1 year ago

SimonEnsemble commented 2 years ago

Mac OS Julia 1.8 dev

        using MolecularGraph

    mol_a = smilestomol("C=O") # formaldehyde
    canvas = SvgCanvas()
    draw2d!(canvas, mol_a)

gives me an error:

ERROR: UndefVarError: libcoordgen not defined
Stacktrace:
  [1] var"##327"(mol::GraphMol{SmilesAtom, SmilesBond})
    @ MolecularGraph ~/.julia/packages/MolecularGraph/A6tnO/src/coordgen.jl:20
  [2] coordgen(graph::GraphMol{SmilesAtom, SmilesBond}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ MolecularGraph ~/.julia/packages/MolecularGraph/A6tnO/src/graph/interface.jl:107
  [3] coordgen
    @ ~/.julia/packages/MolecularGraph/A6tnO/src/graph/interface.jl:100 [inlined]
  [4] var"##331"(mol::GraphMol{SmilesAtom, SmilesBond}; forcecoordgen::Bool, setting::Dict{Symbol, Any}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ MolecularGraph ~/.julia/packages/MolecularGraph/A6tnO/src/draw/draw2d.jl:130
  [5] ##331
    @ ~/.julia/packages/MolecularGraph/A6tnO/src/draw/draw2d.jl:126 [inlined]
  [6] coords2d(graph::GraphMol{SmilesAtom, SmilesBond}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ MolecularGraph ~/.julia/packages/MolecularGraph/A6tnO/src/graph/interface.jl:107
  [7] coords2d
    @ ~/.julia/packages/MolecularGraph/A6tnO/src/graph/interface.jl:100 [inlined]
  [8] draw2d!(canvas::SvgCanvas, mol::GraphMol{SmilesAtom, SmilesBond}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ MolecularGraph ~/.julia/packages/MolecularGraph/A6tnO/src/draw/draw2d.jl:227
  [9] draw2d!(canvas::SvgCanvas, mol::GraphMol{SmilesAtom, SmilesBond})
    @ MolecularGraph ~/.julia/packages/MolecularGraph/A6tnO/src/draw/draw2d.jl:227
 [10] top-level scope
    @ REPL[4]:1
mojaie commented 2 years ago

Thank you for letting me know that. I'm sorry that I haven't used Julia 1.8 dev yet.

Maybe coordgenlibs_jll is not properly installed. Could you uninstall MolecularGraph.jl, reinstall it and check the installed dependencies?

SimonEnsemble commented 2 years ago

after uninstalling and reinstalling, it looks like all is good?

(@v1.8) pkg> add MolecularGraph
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General`
   Resolving package versions...
    Updating `~/.julia/environments/v1.8/Project.toml`
  [6c89ec66] + MolecularGraph v0.11.0
    Updating `~/.julia/environments/v1.8/Manifest.toml`
  [fc18253b] + LazyJSON v0.2.2
  [6c89ec66] + MolecularGraph v0.11.0
  [4d1e1d77] + Nullables v1.0.0
  [f8a19df8] + PropertyDicts v0.1.0
  [69024149] + StringEncodings v0.3.5
  [cbff2730] + Unmarshal v0.4.4
  [ddb6d928] + YAML v0.4.7
  [f6050b86] + coordgenlibs_jll v1.4.0+0
  [172afb32] + libinchi_jll v1.5.0+0

or is there something else I can do to check the dependencies? or do I need to install something else for libcoordgen to work? thanks!

timholy commented 2 years ago

Works for me on

julia> versioninfo()
Julia Version 1.8.0-DEV.1436
Commit d3164ca7f8* (2022-01-29 21:35 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.0 (ORCJIT, skylake)
Environment:
  JULIA_CPU_THREADS = 4

Are you on an M-CPU? If so, consider reading up on (and perhaps adding reports to) https://github.com/JuliaLang/julia/issues?q=is%3Aopen+is%3Aissue+label%3A%22apple+silicon%22+

You might also check a second machine, if possible, to see if it's replicable.

SimonEnsemble commented 2 years ago

you're right---the error does not arise on my Linux machine.

it must be the M1 chip, then?

b.t.w. on my Linux machine, I cannot get the SVG to display in Pluto.jl as mentioned https://github.com/mojaie/MolecularGraph.jl/issues/64.

julia> versioninfo()
Julia Version 1.8.0-DEV.1390
Commit de21be7f7b (2022-01-25 18:18 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.1.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.0 (ORCJIT, cyclone)
luperrin commented 1 year ago

Experiencing the same issue on an M1... @SimonEnsemble did you resolve on yours? Or just ran on linux?

mojaie commented 1 year ago

I'm sorry that coordgenlibs_jll and libinchi_jll are still not built for M1 Mac. Soon I will try to make M1 build of these libraries...

mojaie commented 1 year ago

coordgenlibs_jll and libinchi_jll were rebuilt and would be registered to the repository. MolecularGraph.jl will support Apple silicon in the next release 0.12.0.

https://github.com/JuliaPackaging/Yggdrasil/pull/5658 https://github.com/JuliaPackaging/Yggdrasil/pull/5667