2
votes

I'm trying to download a file from GitHub using Julia in Jupyter Notebook:

isfile("housing.data") ||
  download("https://raw.githubusercontent.com/MikeInnes/notebooks/master/housing.data",
           "housing.data")
rawdata = readdlm("housing.data")'

I have Windows and Julia v1.1.1 version. I get the error message that doesn't say anything to me:

failed process: Process(`'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' -Version 3 -NoProfile -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.Webclient).DownloadFile('https://raw.githubusercontent.com/MikeInnes/notebooks/master/housing.data', 'housing.data')"`, ProcessExited(3221225477)) [3221225477]

Stacktrace:
 [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at .\error.jl:42
 [2] pipeline_error at .\process.jl:785 [inlined]
 [3] download(::String, ::String) at .\download.jl:20
 [4] top-level scope at In[3]:1

I tried googling the message but it's too long to find anything, I didn't find any related topic with problems like this. What might be the reason for this error? Do I need to provide you with some other information?

1
The command itself works correctly on my machine. Can you please check if you do not have some problems on administration level (like: internet access restrictions, directory read/write restrictions etc.). Maybe try running this code on another machine. - Bogumił Kamiński
Reinstalling Julia seemed to solve the problem. - Artur
Which windows version do you use? - Alex338207

1 Answers

2
votes

Base.download relies on availability and configuration of system commands. In particular its documentation reads:

"this function relies on the availability of external tools such as curl, wget or fetch to download the file and is provided for convenience. For production use or situations in which more options are needed, please use a package that provides the desired functionality instead."

Following this advice you should do:

using Pkg
Pkg.add("HTTP")
using HTTP
HTTP.download("https://raw.githubusercontent.com/MikeInnes/notebooks/master/housing.data", "housing.data")

In this way you use pure Julia to download the file rather then various system tools and maintain the homogeneous behavior of your code across platforms.