Tuesday, September 12, 2017

Julia - Language - Handling Package Build Errors

Today while trying to install and Build Rmath package in Julia, I was receiving the following error:

julia> Pkg.build("Rmath")
INFO: Building Rmath
INFO: Attempting to Create directory /home/ubuntu/.julia/v0.6/Rmath/deps/downloads
INFO: Directory /home/ubuntu/.julia/v0.6/Rmath/deps/downloads already created
INFO: Downloading file https://github.com/JuliaLang/Rmath-julia/archive/v0.2.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (77) error setting certificate verify locations:
  CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
============================================================================[ ERROR: Rmath ]============================================================================

LoadError: failed process: Process(`curl -f -o /home/ubuntu/.julia/v0.6/Rmath/deps/downloads/v0.2.0.tar.gz -L https://github.com/JuliaLang/Rmath-julia/archive/v0.2.0.tar.gz`, ProcessExited(77)) [77]
while loading /home/ubuntu/.julia/v0.6/Rmath/deps/build.jl, in expression starting on line 42

========================================================================================================================================================================

============================================================================[ BUILD ERRORS ]============================================================================

WARNING: Rmath had build errors.

 - packages with build errors remain installed in /home/ubuntu/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("Rmath")`
 - build a single package by running its `deps/build.jl` script

========================================================================================================================================================================

julia>

On investigating, I found that the root cause of the error was the line marked in red above. Hence, I searched for the error in google. I found the following stackoverlow answer helpful:

https://stackoverflow.com/questions/3160909/how-do-i-deal-with-certificates-using-curl-while-trying-to-access-an-https-url/31424970#31424970

So, I followed the instructions in it and created the following file with content in my home directory. 

~ $ vi .curlrc
~ $ more .curlrc 
cacert=/etc/ssl/certs/ca-certificates.crt
~ $ 

This was done to inform curl about the location of certificates in Ubuntu 14.04

After this, I ran the build command in Julia again:

julia> Pkg.build("Rmath")
INFO: Building Rmath
INFO: Attempting to Create directory /home/ubuntu/.julia/v0.6/Rmath/deps/downloads
INFO: Directory /home/ubuntu/.julia/v0.6/Rmath/deps/downloads already created
INFO: Downloading file https://github.com/JuliaLang/Rmath-julia/archive/v0.2.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   129    0   129    0     0    118      0 --:--:--  0:00:01 --:--:--   133
100  155k  100  155k    0     0  60274      0  0:00:02  0:00:02 --:--:--  118k
INFO: Done downloading file https://github.com/JuliaLang/Rmath-julia/archive/v0.2.0.tar.gz
INFO: Attempting to Create directory /home/ubuntu/.julia/v0.6/Rmath/deps/src
INFO: Attempting to Create directory /home/ubuntu/.julia/v0.6/Rmath/deps
INFO: Directory /home/ubuntu/.julia/v0.6/Rmath/deps already created
INFO: Attempting to Create directory /home/ubuntu/.julia/v0.6/Rmath/deps/usr/lib
INFO: Changing Directory to /home/ubuntu/.julia/v0.6/Rmath/deps/src/Rmath-julia-0.2.0
INFO: Changing Directory to /home/ubuntu/.julia/v0.6/Rmath/deps/src/Rmath-julia-0.2.0


julia>


This time, it was success without any error message. I have posted this message to inform the technique / thought process I have used to solve this error. 

No comments:

Post a Comment