ReadStat.jl icon indicating copy to clipboard operation
ReadStat.jl copied to clipboard

ERROR: UndefVarError: libreadstat not defined on Julia 1.7.2 on Mac M1

Open sjwild opened this issue 2 years ago • 1 comments

Hello. I am trying to use ReadStat.jl (through ReadStatTables.jl) to open a .dta file. Unfortunately, it does not seem to work with Julia 1.7.2 ARM.

using Pkg

Pkg.activate("test")

Pkg.add("HTTP")
Pkg.add("DataFrames")
Pkg.add("ReadStat")
Pkg.add("ReadStatTables")


using HTTP, DataFrames, ReadStatTables

url_texas = "https://raw.github.com/scunning1975/mixtape/master/texas.dta"

download(url_texas, "texas.dta")

# Note, I want to convert some variables to a regular dataframe format later, so done here to make sure it will work
df_texas = DataFrame(readstat("texas.dta"))


I get the following stack trace:

ERROR: UndefVarError: libreadstat not defined
Stacktrace:
 [1] Parser
   @ ~/.julia/packages/ReadStat/S7fSv/src/ReadStat.jl:267 [inlined]
 [2] read_data_file(filename::String, filetype::Val{:dta})
   @ ReadStat ~/.julia/packages/ReadStat/S7fSv/src/ReadStat.jl:259
 [3] readstat(filepath::String; usecols::Nothing, convert_datetime::Bool, apply_value_labels::Bool, missingvalue::Missing)
   @ ReadStatTables ~/.julia/packages/ReadStatTables/zqKXM/src/readstat.jl:116
 [4] readstat(filepath::String)
   @ ReadStatTables ~/.julia/packages/ReadStatTables/zqKXM/src/readstat.jl:113
 [5] top-level scope
   @ REPL[10]:1

Judging from the stack trace, it looks like the issue with ReadStat.jl (I might be misreading this).

I have no issues running the same code on Julia 1.6.5.

sjwild avatar Apr 29 '22 00:04 sjwild

~~Libiconv_jll.jl, a binary dependency of ReadStat_jll.jl, somehow does not have a build for Mac ARM. This is probably the source of the issue. I just opened an issue there (https://github.com/JuliaStrings/StringEncodings.jl/issues/52).~~

Update: A new version of ReadStat_jll is now available and comes with a build for Mac Apple Silicon. The issue should have been resolved.

junyuan-chen avatar Jul 30 '22 01:07 junyuan-chen