# Error Installing RDatasets

**URL:** https://discourse.julialang.org/t/error-installing-rdatasets/26158
**Category:** New to Julia
**Created:** [July 8, 2019, 9:11pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158 "2019-07-08T21:11:58Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![jerry\_johnson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jerry_johnson/32/9252_2.png) [@jerry\_johnson](https://discourse.julialang.org/u/jerry_johnson)
#### Post date: [July 8, 2019, 9:11pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/1 "2019-07-08T21:11:58Z")

</div>

## Julia Version 1.1.1 (2019-05-16) Ubuntu 18.04 on Linux x86\_64

The RDatasets installer is having trouble writing the deps.jl files for CodecZlib and EzXML packages.

 

(v1.1) pkg\> add RDatasets results in  
…

Building EzXML ────→ `~/.julia/packages/EzXML/r19gO/deps/build.log`  
┌ Error: Error building `EzXML`:  
│ [Info: Downloading [https://github.com/bicycle1885/XML2Builder/releases/download/v1.0.2/XML2Builder.v2.9.9.x86\_64-linux-gnu.tar.gz](https://github.com/bicycle1885/XML2Builder/releases/download/v1.0.2/XML2Builder.v2.9.9.x86_64-linux-gnu.tar.gz) to /home/j/.julia/packages/EzXML/r19gO/deps/usr/downloads/XML2Builder.v2.9.9.x86\_64-linux-gnu.tar.gz…  
│ ERROR: LoadError: LibraryProduct(nothing, [“libxml2”], :libxml2, “Prefix(/home/j/.julia/packages/EzXML/r19gO/deps/usr)”) is not satisfied, cannot generate deps.jl!  
│ Stacktrace:  
│ [1] error(::String) at ./error.jl:33  
│ [2] #write\_deps\_file#165(::Bool, ::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /home/j/.julia/packages/BinaryProvider/A0sDa/src/Products.jl:419  
│ [3] (::getfield(BinaryProvider, Symbol(“#kw##write\_deps\_file”)))(::NamedTuple{(:verbose,),Tuple{Bool}}, ::typeof(write\_deps\_file), ::String, ::Array{LibraryProduct,1}) at ./none:0  
│ [4] top-level scope at none:0  
│ [5] include at ./boot.jl:326 [inlined]  
│ [6] include\_relative(::Module, ::String) at ./loading.jl:1038  
│ [7] include(::Module, ::String) at ./sysimg.jl:29  
│ [8] include(::String) at ./client.jl:403  
│ [9] top-level scope at none:0  
│ in expression starting at /home/j/.julia/packages/EzXML/r19gO/deps/build.jl:48  
[13:37:36] ######################################################################## 100.0%  
└ @ Pkg.Operations /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075  
Building TimeZones → `~/.julia/packages/TimeZones/Z0kpK/deps/build.log`  
Building CodecZlib → `~/.julia/packages/CodecZlib/9jDi1/deps/build.log`  
┌ Error: Error building `CodecZlib`:  
│ [Info: Downloading [https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.4/Zlib.v1.2.11.x86\_64-linux-gnu.tar.gz](https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.4/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz) to /home/j/.julia/packages/CodecZlib/9jDi1/deps/usr/downloads/Zlib.v1.2.11.x86\_64-linux-gnu.tar.gz…  
│ ERROR: LoadError: LibraryProduct(nothing, [“libz”], :libz, “Prefix(/home/j/.julia/packages/CodecZlib/9jDi1/deps/usr)”) is not satisfied, cannot generate deps.jl!  
│ Stacktrace:  
│ [1] error(::String) at ./error.jl:33  
│ [2] #write\_deps\_file#165(::Bool, ::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /home/j/.julia/packages/BinaryProvider/A0sDa/src/Products.jl:419  
│ [3] (::getfield(BinaryProvider, Symbol(“#kw##write\_deps\_file”)))(::NamedTuple{(:verbose,),Tuple{Bool}}, ::typeof(write\_deps\_file), ::String, ::Array{LibraryProduct,1}) at ./none:0  
│ [4] top-level scope at /home/j/.julia/packages/CodecZlib/9jDi1/deps/build.jl:93  
│ [5] include at ./boot.jl:326 [inlined]  
│ [6] include\_relative(::Module, ::String) at ./loading.jl:1038  
│ [7] include(::Module, ::String) at ./sysimg.jl:29  
│ [8] include(::String) at ./client.jl:403  
│ [9] top-level scope at none:0  
│ in expression starting at /home/j/.julia/packages/CodecZlib/9jDi1/deps/build.jl:78  
-----------------------------------------

 

Any suggestions?  
Thanks,  
Jerry

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [July 8, 2019, 9:20pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/2 "2019-07-08T21:20:33Z")

</div>

maybe:  
apt-get install libxml2 libxml2-dev zlib

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [July 8, 2019, 9:22pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/3 "2019-07-08T21:22:52Z")

</div>

and/or  
apt-get install libz-dev  
(don’t have an ubuntu system to check)

---

<div class="post-metadata">

### Author: ![jerry\_johnson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jerry_johnson/32/9252_2.png) [@jerry\_johnson](https://discourse.julialang.org/u/jerry_johnson)
#### Post date: [July 9, 2019, 12:43am UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/4 "2019-07-09T00:43:23Z")

</div>

After I did this:  
sudo apt-get install libxml2 libxml2-dev

– libxml2 libxml2-dev installed without complaint but neither libz nor zlib is there.  
$ sudo apt-get install libz  
…  
E: Unable to locate package libz

sudo apt-get install zlib  
…  
E: Unable to locate package zlib

I tried the RDataset package install and complaints related to libxml went away.

I also tried  
sudo apt-get install libz-dev  
which returned…  
Note, selecting ‘zlib1g-dev’ instead of ‘libz-dev’  
zlib1g-dev is already the newest version (1:1.2.11.dfsg-0ubuntu2).

Could it be that the build for RDataset is hard coded for libz-dev and needs to be changed to zlib1g-dev?

---

<div class="post-metadata">

### Author: ![jerry\_johnson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jerry_johnson/32/9252_2.png) [@jerry\_johnson](https://discourse.julialang.org/u/jerry_johnson)
#### Post date: [July 9, 2019, 12:57am UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/5 "2019-07-09T00:57:16Z")

</div>

julia\> using RDatasets  
[Info: Precompiling RDatasets [ce6b1742-4840-55fa-b093-852dadbb1d8b]  
ERROR: LoadError: CodecZlib.jl is not installed properly, run `Pkg.build("CodecZlib")` and restart Julia.  
ERROR: LoadError: Failed to precompile CodecZlib [944b1d66-785c-5afd-91f1-9de20f533193] to /home/jerry/.julia/compiled/v1.1/CodecZlib/1TI30.ji.  
ERROR: LoadError: Failed to precompile RData [df47a6cb-8c03-5eed-afd8-b6050d6c41da] to /home/jerry/.julia/compiled/v1.1/RData/idMMA.ji.  
ERROR: Failed to precompile RDatasets [ce6b1742-4840-55fa-b093-852dadbb1d8b] to /home/jerry/.julia/compiled/v1.1/RDatasets/JyIbx.ji.

Then, when I Pkg.build(“CodecZlib”)  
julia\> Pkg.build(“CodecZlib”)  
Building CodecZlib → `~/.julia/packages/CodecZlib/9jDi1/deps/build.log`  
┌ Error: Error building `CodecZlib`:  
│ ERROR: LoadError: LibraryProduct(nothing, [“libz”], :libz, “Prefix(/home/jerry/.julia/packages/CodecZlib/9jDi1/deps/usr)”) is not satisfied, cannot generate deps.jl!  
│ Stacktrace:  
│ [1] error(::String) at ./error.jl:33  
│ [2] #write\_deps\_file#165(::Bool, ::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /home/jerry/.julia/packages/BinaryProvider/A0sDa/src/Products.jl:419  
│ [3] (::getfield(BinaryProvider, Symbol(“#kw##write\_deps\_file”)))(::NamedTuple{(:verbose,),Tuple{Bool}}, ::typeof(write\_deps\_file), ::String, ::Array{LibraryProduct,1}) at ./none:0  
│ [4] top-level scope at /home/jerry/.julia/packages/CodecZlib/9jDi1/deps/build.jl:93  
│ [5] include at ./boot.jl:326 [inlined]  
│ [6] include\_relative(::Module, ::String) at ./loading.jl:1038  
│ [7] include(::Module, ::String) at ./sysimg.jl:29  
│ [8] include(::String) at ./client.jl:403  
│ [9] top-level scope at none:0  
│ in expression starting at /home/jerry/.julia/packages/CodecZlib/9jDi1/deps/build.jl:78  
└ @ Pkg.Operations /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [July 9, 2019, 8:58am UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/6 "2019-07-09T08:58:39Z")

</div>

Can you post what is in `~/.julia/packages/CodecZlib/9jDi1/deps/build.log` ?

---

<div class="post-metadata">

### Author: ![jerry\_johnson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jerry_johnson/32/9252_2.png) [@jerry\_johnson](https://discourse.julialang.org/u/jerry_johnson)
#### Post date: [July 9, 2019, 10:39pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/7 "2019-07-09T22:39:04Z")

</div>

## build.log

ERROR: LoadError: LibraryProduct(nothing, [“libz”], :libz, “Prefix(/home/jerry/.julia/packages/CodecZlib/9jDi1/deps/usr)”) is not satisfied, cannot generate deps.jl!  
Stacktrace:  
[1] error(::String) at ./error.jl:33  
[2] #write\_deps\_file#165(::Bool, ::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /home/jerry/.julia/packages/BinaryProvider/A0sDa/src/Products.jl:419  
[3] (::getfield(BinaryProvider, Symbol(“#kw##write\_deps\_file”)))(::NamedTuple{(:verbose,),Tuple{Bool}}, ::typeof(write\_deps\_file), ::String, ::Array{LibraryProduct,1}) at ./none:0  
[4] top-level scope at /home/jerry/.julia/packages/CodecZlib/9jDi1/deps/build.jl:93  
[5] include at ./boot.jl:326 [inlined]  
[6] include\_relative(::Module, ::String) at ./loading.jl:1038  
[7] include(::Module, ::String) at ./sysimg.jl:29  
[8] include(::String) at ./client.jl:403  
[9] top-level scope at none:0  
in expression starting at /home/jerry/.julia/packages/CodecZlib/9jDi1/deps/build.jl:78

---

<div class="post-metadata">

### Author: ![jerry\_johnson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jerry_johnson/32/9252_2.png) [@jerry\_johnson](https://discourse.julialang.org/u/jerry_johnson)
#### Post date: [July 9, 2019, 10:42pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/8 "2019-07-09T22:42:07Z")

</div>

## build.jl

```julia-auto
using BinaryProvider # requires BinaryProvider 0.5.0 or later
using Libdl

# Parse some basic command-line arguments
const verbose = "--verbose" in ARGS
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@ __DIR__ , "usr")))
products = [
    LibraryProduct(prefix, ["libz"], :libz),
]

# Download binaries from hosted location
bin_prefix = "https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.4"

# Listing of files generated by BinaryBuilder:
download_info = Dict(
    Linux(:aarch64, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-gnu.tar.gz", "3431c1a7d937cbad379ae5fe78c11dd0d425a6bce02b12c9d7c89e0a3173af97"),
    Linux(:aarch64, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.aarch64-linux-musl.tar.gz", "7f89328d100f16ab75d37759cdb4df98d8f5b192146eacbe23fa859c6d7bca09"),
    Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-gnueabihf.tar.gz", "04abd9100d2d24a56e50d536679c2df317d6c344b3ae06feb77681533377652f"),
    Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/Zlib.v1.2.11.arm-linux-musleabihf.tar.gz", "fd4fd26462039de7135b5ad09f0c86ec441afd9bb7feb2689f705bc9b087931f"),
    Linux(:i686, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-gnu.tar.gz", "41495344e20619158a05561db8a7ccb9c57192dc5038744419bb9bd58eba7b7a"),
    Linux(:i686, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.i686-linux-musl.tar.gz", "c5d101f21c440156fdc8616bbe9f13f437dfed634cb17dbc65ed83c6b180533c"),
    Windows(:i686) => ("$bin_prefix/Zlib.v1.2.11.i686-w64-mingw32.tar.gz", "84d4d5037459ec706029c78a94c98b07760943662a4adbe21cd3d353ac3a0484"),
    Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.powerpc64le-linux-gnu.tar.gz", "c485627191c75411eaa66088427813a182c7ca0549f0dc21971c9452c45d8167"),
    MacOS(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-apple-darwin14.tar.gz", "a28fb652f94f1b1548197a3b3c9a71ec56fa50bb7d39454c5e12320335d30934"),
    Linux(:x86_64, libc=:glibc) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz", "1c3b1c8520713f98d3f605ee1ca5e2e3656d92ddb6441abeeeff0ae12a11a620"),
    Linux(:x86_64, libc=:musl) => ("$bin_prefix/Zlib.v1.2.11.x86_64-linux-musl.tar.gz", "17da1e44f7a815f5dc6eb66e3c7df8c80846c67d5212148a33fb68ea677e38dc"),
    FreeBSD(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-unknown-freebsd11.1.tar.gz", "87522b29c8dfb7681209fea541dcc09bd5863f55df9cb1de1645ec8484aad7b8"),
    Windows(:x86_64) => ("$bin_prefix/Zlib.v1.2.11.x86_64-w64-mingw32.tar.gz", "13934d974c5b1fd99897897b9af4ef7cce1025a1cdf1a57f14a9dd8e0258508a"),
)

# A simple source build fallback for platforms not supported by BinaryBuilder
# Assumes that tar, GNU make, and a C compiler are available
function sourcebuild()
    @info "Trying to install zlib from the source code."
    srcdir = joinpath(@ __DIR__ , "src")
    libdir = joinpath(@ __DIR__ , "lib")
    z = "zlib-1.2.11"
    for d = [srcdir, libdir]
        isdir(d) && rm(d, force=true, recursive=true)
        mkpath(d)
    end
    download("https://zlib.net/$(z).tar.gz", joinpath(srcdir, "$(z).tar.gz"))
    cd(srcdir) do
        run(`tar xzf $(z).tar.gz`)
    end
    cd(joinpath(srcdir, z)) do
        run(`./configure --prefix=.`)
        make = Sys.isbsd() && !Sys.isapple() ? `gmake` : `make`
        run(`$make -j$(Sys.CPU_THREADS)`)
    end
    libz = nothing
    for f in readdir(joinpath(srcdir, z))
        if f == "libz." * Libdl.dlext
            libz = joinpath(srcdir, z, f)
            break
        end
    end
    libz === nothing && error("zlib was unable to build properly")
    open(joinpath(@ __DIR__ , "deps.jl"), "w") do io
        println(io, """
            function check_deps()
                ptr = Libdl.dlopen_e("$libz")
                loaded = ptr != C_NULL
                Libdl.dlclose(ptr)
                if !loaded
                    error("Unable to load zlib from $libz. Please rerun " *
                          "`Pkg.build(\\"CodecZlib\\")` and restart Julia.")
                end
            end
            const libz = "$libz"
            """)
    end
end

# Install unsatisfied or updated dependencies:
unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
dl_info = choose_download(download_info, platform_key_abi())
if dl_info === nothing && unsatisfied
    # If we don't have a compatible .tar.gz to download, complain.
    # Alternatively, you could attempt to install from a separate provider,
    # build from source or something even more ambitious here.
    @warn "ZlibBuilder provides no prebuilt binary for your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\")."
    sourcebuild()
else
    # If we have a download, and we are unsatisfied (or the version we're
    # trying to install is not itself installed) then load it up!
    if unsatisfied || !isinstalled(dl_info...; prefix=prefix)
        # Download and install binaries
        install(dl_info...; prefix=prefix, force=true, verbose=verbose)
    end

    # Write out a deps.jl file that will contain mappings for our products
    write_deps_file(joinpath(@ __DIR__ , "deps.jl"), products, verbose=verbose)
end

```

---

<div class="post-metadata">

### Author: ![jerry\_johnson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jerry_johnson/32/9252_2.png) [@jerry\_johnson](https://discourse.julialang.org/u/jerry_johnson)
#### Post date: [July 11, 2019, 1:18pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/9 "2019-07-11T13:18:05Z")

</div>

I did the following to resolve:

```julia
bash:
sudo apt-get install libxml2 libxml2-dev

Julia:
(v1.1) pkg> remove BinaryProvider
(v1.1) pkg> remove RDatasets
(v1.1) pkg> add RDatasets
julia> using Pkg
julia> using RDatasets

```

…  
Now julia gives no complaint

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [July 11, 2019, 1:36pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/10 "2019-07-11T13:36:25Z")

</div>

Great, thanks for the update.  
I was still trying to solve the libz problem and I was not able to reproduce it, but this was apparently just a Pkg glitch. Only libxml was missing in your ubuntu system.

---

<div class="post-metadata">

### Author: ![Iaggo\_Capitanio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iaggo_capitanio/32/12272_2.png) [@Iaggo\_Capitanio](https://discourse.julialang.org/u/Iaggo_Capitanio)
#### Post date: [January 12, 2020, 2:25pm UTC](https://discourse.julialang.org/t/error-installing-rdatasets/26158/11 "2020-01-12T14:25:59Z")

</div>

just add the package that you are missing
