Search code examples
packagejuliafits

Cannot use FITSIO in Julia


I just started using Julia and installed the FITSIO package. When loading it I get the following error

julia> using FITSIO
[ Info: Precompiling FITSIO [525bcba6-941b-5504-bd06-fd0dc1a4d2eb]
ERROR: LoadError: syntax: extra token "ImageHDU" after end of expression
Stacktrace:
 [1] include at .\boot.jl:317 [inlined]
 [2] include_relative(::Module, ::String) at .\loading.jl:1038
 [3] include(::Module, ::String) at .\sysimg.jl:29
 [4] top-level scope at none:2
 [5] eval at .\boot.jl:319 [inlined]
 [6] eval(::Expr) at .\client.jl:389
 [7] top-level scope at .\none:3
in expression starting at C:\Users\romain\.julia\packages\FITSIO\WueGk\src\FITSIO.jl:54
ERROR: Failed to precompile FITSIO [525bcba6-941b-5504-bd06-fd0dc1a4d2eb] to C:\Users\romain\.julia\compiled\v1.0\FITSIO\mbga9.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1184
 [4] macro expansion at .\logging.jl:311 [inlined]
 [5] _require(::Base.PkgId) at .\loading.jl:941
 [6] require(::Base.PkgId) at .\loading.jl:852
 [7] macro expansion at .\logging.jl:311 [inlined]
 [8] require(::Module, ::Symbol) at .\loading.jl:834

I tried to remove and add again the FITSIO package, but I always get the same error. The stacktrace seems to go to line 54 of FITSIO.jl So here is the content of this file from line 46 to 57

import .Libcfitsio: libcfitsio,
                    fits_assert_ok,
                    fits_assert_isascii,
                    TYPE_FROM_BITPIX

# HDU Types
@compat abstract type HDU end

type ImageHDU <: HDU
    fitsfile::FITSFile
    ext::Int
end

Do you know how to make this package work? Thanks :)


Solution

  • Here is the answer from the FITSIO developers:

    The latest stable version of this package isn't compatible with Julia 1.0. This has been already fixed in the development version, but we haven't tagged a new version since then.

    Remove FITSIO.jl with

    pkg> rm FITSIO
    pkg> update
    pkg> add FITSIO
    pkg> dev FITSIO
    

    After the rm, make sure you don't have any FITSIO.jl leftover, then you can reinstall and switch to the development version within the package manager, without installing another package