Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R data file with non-standard extension is recognized as generic GZip file. #57

Open
matbesancon opened this issue Apr 1, 2019 · 5 comments
Labels

Comments

@matbesancon
Copy link

MWE:

]add RData

import RData
RData.load("dat.Rda")

Error encountered while loading "path_to_dat.Rda".
Fatal error:
ERROR: ArgumentError: Package Libz not found in current path:
- Run `import Pkg; Pkg.add("Libz")` to install the Libz package.
@alyst
Copy link
Collaborator

alyst commented Apr 2, 2019

I cannot reproduce it. Also, AFAIK Libz is not used, RData uses CodecZlib instread.
If you still have the issue, could you please show the full output of your Julia session?

@matbesancon
Copy link
Author

Sure:

~16:38:35
$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.0 (2019-01-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(v1.1) pkg> add RData
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
  Updating `~/.julia/environments/v1.1/Project.toml`
  [df47a6cb] + RData v0.6.0
  Updating `~/.julia/environments/v1.1/Manifest.toml`
  [8f5d6c58] + EzXML v0.9.1
  [5789e2e9] + FileIO v1.0.6
  [60bf3e95] + GLPK v0.9.1
  [78c3b35d] + Mocking v0.5.7
  [df47a6cb] + RData v0.6.0
  [f269a46b] + TimeZones v0.9.0

julia> import RData

julia> RData.load("numerics/data/data/data_n100_m100_p50_q50_r50_s100_sc1_case53.Rda")
Error encountered while loading "numerics/data/data/data_n100_m100_p50_q50_r50_s100_sc1_case53.Rda".
Fatal error:
ERROR: ArgumentError: Package Libz not found in current path:
- Run `import Pkg; Pkg.add("Libz")` to install the Libz package.

To be complete, the data come from this repo

@alyst
Copy link
Collaborator

alyst commented Apr 2, 2019

Thanks! Now I can reproduce it.
The problem is that .Rda extension (case sensitive) is not registered in FileIO package, so RData.load() (which is just reexported FileIO.load()) tries to detect the file type by looking at its first bytes.
Since GZIP format is checked before RData, FileIO recognizes the file as gzipped and tries to use Libz.
Probably this should be fixed on FileIO side, I'll write the bug report.

Meanwhile you can rename your files into ".rda", ".RData" or ".rdata" as a workaround.

@alyst alyst changed the title RData depends on Libz, but not specified in REQUIRE R data file with non-standard extension is recognized as generic GZip file. Apr 2, 2019
@alyst alyst added the bug label Apr 2, 2019
@matbesancon
Copy link
Author

good catch thanks!

@timholy
Copy link

timholy commented Mar 7, 2021

This should be fixed in FileIO 1.6.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants