sergio-santos-group / ProtoSyn.jl

A Julia-based framework for molecular modelling
https://sergio-santos-group.github.io/ProtoSyn.jl/stable/
GNU Affero General Public License v3.0
58 stars 7 forks source link

LoadError when loading/using package #40

Closed kool7d closed 2 years ago

kool7d commented 2 years ago

I get this error when I do using ProtoSyn, it appears to be an error with a peptide calculator method:

[ Info: Precompiling ProtoSyn [c9758760-7c0d-11e9-0ffc-fb9355b7d293]
[ Info: Skipping precompilation since __precompile__(false). Importing ProtoSyn [c9758760-7c0d-11e9-0ffc-fb9355b7d293].
[ Info: Loading required packages
[ Info:  | Loading SIMD
[ Info:  | Loading CUDA
[ Info: Setting up variables
[ Info: Current acceleration set to ProtoSyn.Acceleration(ProtoSyn.CUDA_2)
[ Info: Loading Core
[ Info: Loading Calculators
[ Info:  | Loading TorchANI
[ Info:  | Loading Hydrogen Bonds
[ Info:  | Loading SASA
[ Info:  | Loading Restraint Models
[ Info:  | Loading Energy Function
[ Info: Loading Mutators
[ Info: Loading Drivers
[ Info: Loading Peptides
ERROR: LoadError: TypeError: in Type{...} expression, expected UnionAll, got Type{Polynomials.Polynomial{Float64}}
Stacktrace:
  [1] deserialize_datatype(s::Serialization.Serializer{IOStream}, full::Bool)
    @ Serialization C:\Users\kool7\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:1356
  [2] handle_deserialize(s::Serialization.Serializer{IOStream}, b::Int32)
    @ Serialization C:\Users\kool7\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:854
  [3] deserialize(s::Serialization.Serializer{IOStream})
    @ Serialization C:\Users\kool7\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:801
  [4] handle_deserialize(s::Serialization.Serializer{IOStream}, b::Int32)
    @ Serialization C:\Users\kool7\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:861
  [5] deserialize(s::Serialization.Serializer{IOStream})
    @ Serialization C:\Users\kool7\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:801
  [6] handle_deserialize(s::Serialization.Serializer{IOStream}, b::Int32)
    @ Serialization C:\Users\kool7\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:907
  [7] deserialize
    @ C:\Users\kool7\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:801 [inlined]
  [8] deserialize(s::IOStream)
    @ Serialization C:\Users\kool7\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:788
  [9] open(f::typeof(Serialization.deserialize), args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base .\io.jl:330
 [10] open(f::Function, args::String)
    @ Base .\io.jl:328
 [11] top-level scope
    @ C:\Users\kool7\.julia\packages\ProtoSyn\oMTj9\src\Peptides\Calculators\Calculators.jl:9
in expression starting at C:\Users\kool7\.julia\packages\ProtoSyn\oMTj9\src\Peptides\Calculators\Calculators.jl:1
in expression starting at C:\Users\kool7\.julia\packages\ProtoSyn\oMTj9\src\Peptides\Peptides.jl:1
in expression starting at C:\Users\kool7\.julia\packages\ProtoSyn\oMTj9\src\ProtoSyn.jl:2

Here is where the error is pointing:

module Calculators

    using ProtoSyn.Peptides
    using Serialization
    using Polynomials

    phi_file = joinpath(Peptides.resource_dir, "ramachandran/phi-potential.jls")
    psi_file = joinpath(Peptides.resource_dir, "ramachandran/psi-potential.jls")
    phi_potential = open(deserialize, phi_file)  <---------------------------------------------
    psi_potential = open(deserialize, psi_file)

    include("Caterpillar/Caterpillar.jl")
    include("restraints.jl")
    include("hydrogen_bonds.jl")
end
JosePereiraUA commented 2 years ago

I'm not sure why you're having this error. I've re-installed a fresh copy of ProtoSyn (on a Windows machine, using Julia 1.6.1) and didn't find this error. Here are my steps.

On a command line:

$ git clone https://github.com/sergio-santos-group/ProtoSyn.jl.git

$ cd ProtoSyn.jl

$ julia

On the Julia REPL, inside the ProtoSyn.jl/ directory:

(@v1.6) pkg> add .

julia> using ProtoSyn

The add . command installs all necessary dependencies. In specific, check if you have both the Polynomials and Serialization packages installed. After, you can test loading the phi and psi potentials using the snippet bellow. If this works, we'll have to think on another solution to debug this issue.

shell> cd resources\\Peptides\\ramachandran\\
C:\Users\User\Desktop\ProtoSyn.jl\resources\Peptides\ramachandran

julia> using Serialization

julia> using Polynomials

julia> open(deserialize, "phi-potential.jls")
Polynomial(...)
kool7d commented 2 years ago

Looks like it is working now! Thanks.

JosePereiraUA commented 2 years ago

Happy to help, closing this one!