Install IJulia on Julia 1.0.0 - julia

I just installed Julia and would now like to install the IJulia notebook. However, compilation fails:
julia> Pkg.build("IJulia")
Building Conda ──→ `~/.julia/packages/Conda/m7vem/deps/build.log`
Building ZMQ ────→ `~/.julia/packages/ZMQ/yClfT/deps/build.log`
Building MbedTLS → `~/.julia/packages/MbedTLS/Qo8TN/deps/build.log`
Building IJulia ─→ `~/.julia/packages/IJulia/iMVN2/deps/build.log`
┌ Error: Error building `IJulia`:
│ ┌ Warning: Could not execute `jupyter --version`.
│ └ # Main ~/.julia/packages/IJulia/iMVN2/deps/build.jl:38
│ [ Info: Installing Jupyter via the Conda package.
│ [ Info: Downloading miniconda installer ...
│ ERROR: LoadError: IOError: could not spawn `curl -g -L -f -o /home/user001/.julia/packages/Conda/m7vem/deps/usr/installer.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh`: no such file or directory (ENOENT)
│ Stacktrace:
│ [1] _jl_spawn(::String, ::Array{String,1}, ::Cmd, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:367
│ [2] (::getfield(Base, Symbol("##495#496")){Cmd})(::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:509
│ [3] setup_stdio(::getfield(Base, Symbol("##495#496")){Cmd}, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:490
│ [4] #_spawn#494(::Nothing, ::Function, ::Cmd, ::Tuple{RawFD,RawFD,RawFD}) at ./process.jl:508
│ [5] _spawn at ./process.jl:504 [inlined]
│ [6] #run#505(::Bool, ::Function, ::Cmd) at ./process.jl:652
│ [7] run at ./process.jl:651 [inlined]
│ [8] download(::String, ::String) at ./download.jl:48
│ [9] macro expansion at ./logging.jl:311 [inlined]
│ [10] _install_conda(::String, ::Bool) at /home/user001/.julia/packages/Conda/m7vem/src/Conda.jl:146
│ [11] _install_conda(::String) at /home/user001/.julia/packages/Conda/m7vem/src/Conda.jl:145
│ [12] runconda(::Cmd, ::String) at /home/user001/.julia/packages/Conda/m7vem/src/Conda.jl:111
│ [13] add at /home/user001/.julia/packages/Conda/m7vem/src/Conda.jl:174 [inlined] (repeats 2 times)
│ [14] top-level scope at logging.jl:311
│ [15] top-level scope at /home/user001/.julia/packages/IJulia/iMVN2/deps/build.jl:38
│ [16] include at ./boot.jl:317 [inlined]
│ [17] include_relative(::Module, ::String) at ./loading.jl:1038
│ [18] include(::Module, ::String) at ./sysimg.jl:29
│ [19] include(::String) at ./client.jl:388
│ [20] top-level scope at none:0
│ in expression starting at /home/user001/.julia/packages/IJulia/iMVN2/deps/build.jl:9
└ # Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1068
The file pointed out actually exists and I am able to fetch it:
$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
--2018-08-27 16:29:15-- https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving repo.continuum.io (repo.continuum.io)... 104.16.18.10, 104.16.19.10, 2400:cb00:2048:1::6810:130a, ...
Connecting to repo.continuum.io (repo.continuum.io)|104.16.18.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 58468498 (56M) [application/x-sh]
Saving to: ‘Miniconda3-latest-Linux-x86_64.sh’
Miniconda3-latest-Linux-x86_64.sh 100%[======================================================================================================>] 55,76M 102MB/s in 0,5s
2018-08-27 16:29:16 (102 MB/s) - ‘Miniconda3-latest-Linux-x86_64.sh’ saved [58468498/58468498]
What's wrong?
Update: regarding the concernes with the .julia/packages/Conda/m7vem/deps/usr/ folder, all appears correct:
$ ll /home/user001/.julia/packages/Conda/m7vem/deps/usr/
total 8
drwxr-xr-x 2 user001 user001 4096 aug 27 15:56 ./
drwxr-xr-x 3 user001 user001 4096 aug 27 15:56 ../

Related

ERROR: HTTP/1.1 403 Forbidden in Downloads.jl

I'm trying to download a .xlsx file using Julia by Downloads.jl like this, But I get an error:
julia> using Downloads: download
julia> file = download("http://www.tsetmc.com/tsev2/excel/IntraDayPrice.aspx?i=35425587644337450&m=30")
ERROR: HTTP/1.1 403 Forbidden while requesting http://www.tsetmc.com/tsev2/excel/IntraDayPrice.aspx?i=35425587644337450&m=30
Stacktrace:
[1] #3
# C:\Users\Shayan\.julia\juliaup\julia-1.8.0+0.x64\share\julia\stdlib\v1.8\Downloads\src\Downloads.jl:243 [inlined]
[2] arg_write(f::Downloads.var"#3#4"{Nothing, Vector{Pair{String, String}}, Float64, Nothing, Bool, Nothing, Nothing, String}, arg::Nothing)
# ArgTools C:\Users\Shayan\.julia\juliaup\julia-1.8.0+0.x64\share\julia\stdlib\v1.8\ArgTools\src\ArgTools.jl:123
[3] #download#2
# C:\Users\Shayan\.julia\juliaup\julia-1.8.0+0.x64\share\julia\stdlib\v1.8\Downloads\src\Downloads.jl:230 [inlined]
[4] download (repeats 2 times)
# C:\Users\Shayan\.julia\juliaup\julia-1.8.0+0.x64\share\julia\stdlib\v1.8\Downloads\src\Downloads.jl:219 [inlined]
[5] top-level scope
# REPL[8]:1
I don't know where the problem is. Any help would be appreciated.

A specific installing problem about JuMP 0.18.6 in julia 1.4.2

Downloading artifact: CompilerSupportLibraries
curl: (52) Empty reply from server
ERROR: LoadError: Unable to automatically install 'CompilerSupportLibraries' from '/home/zyh/.julia/packages/CompilerSupportLibraries_jll/790hI/Artifacts.toml'
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] ensure_artifact_installed(::String, ::Dict{String,Any}, ::String; platform::Pkg.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool) at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/Artifacts.jl:894
[3] ensure_all_artifacts_installed(::String; platform::Pkg.BinaryPlatforms.Platform, pkg_uuid::Nothing, include_lazy::Bool, verbose::Bool, quiet_download::Bool) at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/Artifacts.jl:958
[4] download_artifacts(::Pkg.Types.Context, ::Array{String,1}; platform::Pkg.BinaryPlatforms.Linux, verbose::Bool) at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:616
[5] download_artifacts(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; platform::Pkg.BinaryPlatforms.Linux, verbose::Bool) at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:595
[6] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux) at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:1091
[7] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:159
[8] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:112
[9] #add#27 at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:109 [inlined]
[10] add at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:109 [inlined]
[11] #add#23 at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:106 [inlined]
[12] add(::Pkg.Types.PackageSpec) at /usr/local/julia/julia-1.4.2/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:106
[13] top-level scope at /home/zyh/DOLPHYN_old/julenv.jl:20
[14] include(::String) at ./client.jl:439
[15] top-level scope at REPL[1]:1
I'm trying to construct a specific environment using JuMP 0.18.6 in Julia 1.4.2. But when downloading JuMP, it seems that this problem got blocking my may. Had anybody ever encountered this before and have a solution?
it's likely due to firewall of some sort, if you're from China, try the mirror source:
https://mirrors.tuna.tsinghua.edu.cn/help/julia/

hcitool does not find ble device but blueman does and so does bettercap and bluetoothctl

I am confused with this issue. I have the following device (it is a Chinese smartwatch) with MAC address show up on blueman and bettercap but not on hcitool.
I use:
sudo hcitool lescan
LE Scan ...
C0:28:8D:D6:66:EA
C0:28:8D:D6:66:EA (unknown)
but the device MAC address of Q1 EB:15:0C:38:C9:B0 does not show up.
I try bettercap:
sudo bettercap
» ble.recon on
» [12:01:38] [ble.device.new] new BLE device Q1 detected as EB:15:0C:38:C9:B0 -77 dBm.
However, I also get:
when I do:
» ble.show
│ -76 dBm │ eb:15:0c:38:c9:b0 │ │ Limited Discoverable, BR/EDR Not Supported │ ✔ │ 12:05:38 │
» ble.enum eb:15:0c:38:c9:b0
[12:07:06] [sys.log] [inf] ble.recon connecting to eb:15:0c:38:c9:b0 ...
»
┌──────────────┬───────────────────────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────────────────────┐
│ Handles │ Service > Characteristics │ Properties │ Data │
├──────────────┼───────────────────────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────────────────────┤
│ 0001 -> 0004 │ Generic Attribute (1801) │ │ │
│ 0003 │ Service Changed (2a05) │ BCAST, READ, WRITE, NOTIFY, INDICATE, SIGN WRITE │ 00000000 │
│ │ │ │ │
│ 0005 -> 000f │ Generic Access (1800) │ │ │
│ 0007 │ Device Name (2a00) │ READ │ Q1 │
│ 0009 │ Appearance (2a01) │ READ │ Unknown │
│ 000b │ Peripheral Privacy Flag (2a02) │ READ │ Privacy Disabled │
│ 000d │ Peripheral Preferred Connection Parameters (2a04) │ READ │ Connection Interval: 224 -> 240 │
│ │ │ │ Slave Latency: 4 │
│ │ │ │ Connection Supervision Timeout Multiplier: 500 │
│ 000f │ 2aa6 │ READ │ 00 │
│ │ │ │ │
│ 0010 -> 0015 │ 6e400001b5a3f393e0a9e50e24dcca9e │ │ │
│ 0012 │ 6e400003b5a3f393e0a9e50e24dcca9e │ NOTIFY │ │
│ 0015 │ 6e400002b5a3f393e0a9e50e24dcca9e │ WRITE │ │
│ │ │ │ │
│ 0016 -> 002d │ Human Interface Device (1812) │ │ │
│ 0018 │ Protocol Mode (2a4e) │ READ, WRITE │ insufficient encryption │
│ 001a │ Report (2a4d) │ READ, WRITE, NOTIFY │ insufficient encryption │
│ 001e │ Report (2a4d) │ READ, WRITE, NOTIFY │ insufficient encryption │
│ 0022 │ Report (2a4d) │ READ, WRITE, NOTIFY │ insufficient encryption │
│ 0026 │ Report Map (2a4b) │ READ │ insufficient encryption │
│ 0028 │ Boot Mouse Input Report (2a33) │ READ, WRITE, NOTIFY │ insufficient encryption │
│ 002b │ HID Information (2a4a) │ READ │ insufficient encryption │
│ 002d │ HID Control Point (2a4c) │ WRITE │ │
│ │ │ │ │
│ 002e -> 0037 │ fee7 │ │ │
│ 0030 │ fec9 │ READ, NOTIFY │ ë150c8É° │
│ 0033 │ fea1 │ READ, INDICATE │ 07a001009e0100a00100 │
│ 0036 │ fea2 │ READ, WRITE, INDICATE │ Ð │
│ │ │ │ │
└──────────────┴───────────────────────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────────────┘
However I am not sure what all this means. I find bettercap very confusing to follow.
» ^D
Are you sure you want to quit this session? y/n y
[12:08:07] [sys.log] [inf] ble.recon stopping scan ...
I also tried gattool:
sudo gatttool -t random -b EB:15:0C:38:C9:B0 -I
[EB:15:0C:38:C9:B0][LE]> sec-level low
[EB:15:0C:38:C9:B0][LE]> connect
Attempting to connect to EB:15:0C:38:C9:B0
Error: connect to EB:15:0C:38:C9:B0: Device or resource busy (16)
[EB:15:0C:38:C9:B0][LE]>
I am sorry but I am not sure what to do. I would like to read and write to this device if that is possible. I am on Fedora 33 Linux.
Thanks in advance for any help!
Thanks for the information with regard to bluetoothctl. So, I try this out and get:
$ sudo bluetoothctl
Agent registered
[Q1]# devices
Device EB:15:0C:38:C9:B0 Q1
Device E0:7B:1F:EB:C1:6C LH719
Device A4:C1:1C:F6:02:92 MS1020
[Q1]# connect EB:15:0C:38:C9:B0
Attempting to connect to EB:15:0C:38:C9:B0
Connection successful
But reading from here: https://budimir.cc/2020/02/27/ble-on-linux-with-bluetoothctl/ it appears that I should get far more information than the above.
However, I added:
[Q1]# menu gatt
Menu gatt:
Available commands:
-------------------
list-attributes [dev/local] List attributes
select-attribute <attribute/UUID> Select attribute
attribute-info [attribute/UUID] Select attribute
read [offset] Read attribute value
write <data=xx xx ...> [offset] [type] Write attribute value
acquire-write Acquire Write file descriptor
release-write Release Write file descriptor
acquire-notify Acquire Notify file descriptor
release-notify Release Notify file descriptor
notify <on/off> Notify attribute value
clone [dev/attribute/UUID] Clone a device or attribute
register-application [UUID ...] Register profile to connect
unregister-application Unregister profile
register-service <UUID> [handle] Register application service.
unregister-service <UUID/object> Unregister application service
register-includes <UUID> [handle] Register as Included service in.
unregister-includes <Service-UUID><Inc-UUID> Unregister Included service.
register-characteristic <UUID> <Flags=read,write,notify...> [handle] Register application characteristic
unregister-characteristic <UUID/object> Unregister application characteristic
register-descriptor <UUID> <Flags=read,write...> [handle] Register application descriptor
unregister-descriptor <UUID/object> Unregister application descriptor
back Return to main menu
version Display version
quit Quit program
exit Quit program
help Display help about this program
export Print environment variables
and do seem to get a list of services (which I will now investigate):
[Q1]# list-attributes
Primary Service (Handle 0x0100)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service002e
0000fee7-0000-1000-8000-00805f9b34fb
Tencent Holdings Limited.
Characteristic (Handle 0x7da4)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service002e/char0035
0000fea2-0000-1000-8000-00805f9b34fb
Intrepid Control Systems, Inc.
Descriptor (Handle 0x0015)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service002e/char0035/desc0037
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Characteristic (Handle 0x9248)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service002e/char0032
0000fea1-0000-1000-8000-00805f9b34fb
Intrepid Control Systems, Inc.
Descriptor (Handle 0x0015)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service002e/char0032/desc0034
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Characteristic (Handle 0xaf18)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service002e/char002f
0000fec9-0000-1000-8000-00805f9b34fb
Apple, Inc.
Descriptor (Handle 0x0015)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service002e/char002f/desc0031
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Primary Service (Handle 0x9d80)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service0010
6e400001-b5a3-f393-e0a9-e50e24dcca9e
Nordic UART Service
Characteristic (Handle 0xd894)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service0010/char0014
6e400002-b5a3-f393-e0a9-e50e24dcca9e
Nordic UART TX
Characteristic (Handle 0xd894)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service0010/char0011
6e400003-b5a3-f393-e0a9-e50e24dcca9e
Nordic UART RX
Descriptor (Handle 0x0015)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service0010/char0011/desc0013
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Primary Service (Handle 0x9d80)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service0001
00001801-0000-1000-8000-00805f9b34fb
Generic Attribute Profile
Characteristic (Handle 0xff84)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service0001/char0002
00002a05-0000-1000-8000-00805f9b34fb
Service Changed
Descriptor (Handle 0x0015)
/org/bluez/hci0/dev_EB_15_0C_38_C9_B0/service0001/char0002/desc0004
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[Q1]#
hcitool and gatttool were some of the tools that were deprecated by the BlueZ project in 2017. If you are following a tutorial that uses them, there is a chance that it might be out of date. The correct tool to be using now is bluetoothctl.
If you are new to Bluetooth then using a generic Bluetooth Low Energy scanning and exploration tool like nRF Connect might be more helpful to understand what is going on. Reading up on how BLE GATT services work will help with the service > Characteristics information.
Once you can read and write with the characteristics, your next challenge will be to work out what the binary data that is being sent/received means as it looks like they are using a lot of custom characteristics.

How to make Julia PkgServer.jl work offline

I work mostly on offline machines and really want to begin to migrate from Python to Julia. Currently the biggest problem I face is how can I setup a package server on my own network that does not have access to the internet. I can copy files to the offline computer/network and want to be able to just cache a good percentage of the Julia Package Ecosystem and copy it to my network, so that I and others can install packages as needed.
I have experimented with PkgSever.jl by using the deployment docker-compose script they have, then just installing a long list of packages so that the PkgServer instance would cache everything. Next took the PkgServer machine offline and attempted to install packages from it. This worked well, however when I restarted the docker container the server was running in, everything fell apart quickly.
It seems that maybe the PkgServer needs to be able to talk to the Storage Server at least once before being able to serve packages. I tried setting:
JULIA_PKG_SERVER_STORAGE_SERVERS from: "https://us-east.storage.juliahub.com,https://kr.storage.juliahub.com" to: "" but that failed miserably.
Can someone please point me in the right direction.
TIA
It looks like the PkgServer is actually trying to contact the Registry before it starts. I don't know enough about the registry stuff enough to know if there is a way to hack this to look locally or just ignore this..
pkgserver_1 | ERROR: LoadError: DNSError: kr.storage.juliahub.com, temporary failure (EAI_AGAIN)
pkgserver_1 | Stacktrace:
pkgserver_1 | [1] getalladdrinfo(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Sockets/src/addrinfo.jl:112
pkgserver_1 | [2] getalladdrinfo at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Sockets/src/addrinfo.jl:121 [inlined]
pkgserver_1 | [3] getconnection(::Type{TCPSocket}, ::SubString{String}, ::String; keepalive::Bool, connect_timeout::Int64, kw::Base.Iterators.Pairs{Symbol,Union{Nothing, Bool},NTuple{4,Symbol},NamedTuple{(:require_ssl_verification, :iofunction, :reached_redirect_limit, :status_exception),Tuple{Bool,Nothing,Bool,Bool}}}) at /depot/packages/HTTP/IAI92/src/ConnectionPool.jl:630
pkgserver_1 | [4] #getconnection#29 at /depot/packages/HTTP/IAI92/src/ConnectionPool.jl:682 [inlined]
pkgserver_1 | [5] newconnection(::HTTP.ConnectionPool.Pod, ::Type{T} where T, ::SubString{String}, ::SubString{String}, ::Int64, ::Bool, ::Int64; kw::Base.Iterators.Pairs{Symbol,Union{Nothing, Bool},Tuple{Symbol,Symbol,Symbol},NamedTuple{(:iofunction, :reached_redirect_limit, :status_exception),Tuple{Nothing,Bool,Bool}}}) at /depot/packages/HTTP/IAI92/src/ConnectionPool.jl:597
pkgserver_1 | [6] getconnection(::Type{HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}}, ::SubString{String}, ::SubString{String}; connection_limit::Int64, pipeline_limit::Int64, idle_timeout::Int64, reuse_limit::Int64, require_ssl_verification::Bool, kw::Base.Iterators.Pairs{Symbol,Union{Nothing, Bool},Tuple{Symbol,Symbol,Symbol},NamedTuple{(:iofunction, :reached_redirect_limit, :status_exception),Tuple{Nothing,Bool,Bool}}}) at /depot/packages/HTTP/IAI92/src/ConnectionPool.jl:541
pkgserver_1 | [7] request(::Type{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Array{UInt8,1}; proxy::Nothing, socket_type::Type{T} where T, reuse_limit::Int64, kw::Base.Iterators.Pairs{Symbol,Union{Nothing, Bool},Tuple{Symbol,Symbol,Symbol},NamedTuple{(:iofunction, :reached_redirect_limit, :status_exception),Tuple{Nothing,Bool,Bool}}}) at /depot/packages/HTTP/IAI92/src/ConnectionRequest.jl:73
pkgserver_1 | [8] (::Base.var"#56#58"{Base.var"#56#57#59"{ExponentialBackOff,HTTP.RetryRequest.var"#2#3"{Bool,HTTP.Messages.Request},typeof(HTTP.request)}})(::Type{T} where T, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Symbol,Union{Nothing, Bool},Tuple{Symbol,Symbol,Symbol},NamedTuple{(:iofunction, :reached_redirect_limit, :status_exception),Tuple{Nothing,Bool,Bool}}}) at ./error.jl:301
pkgserver_1 | [9] #request#1 at /depot/packages/HTTP/IAI92/src/RetryRequest.jl:44 [inlined]
pkgserver_1 | [10] request(::Type{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; http_version::VersionNumber, target::String, parent::Nothing, iofunction::Nothing, kw::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:reached_redirect_limit, :status_exception),Tuple{Bool,Bool}}}) at /depot/packages/HTTP/IAI92/src/MessageRequest.jl:51
pkgserver_1 | [11] request(::Type{HTTP.BasicAuthRequest.BasicAuthLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; kw::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:reached_redirect_limit, :status_exception),Tuple{Bool,Bool}}}) at /depot/packages/HTTP/IAI92/src/BasicAuthRequest.jl:28
pkgserver_1 | [12] request(::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.BasicAuthRequest.BasicAuthLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; redirect_limit::Int64, forwardheaders::Bool, kw::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:status_exception,),Tuple{Bool}}}) at /depot/packages/HTTP/IAI92/src/RedirectRequest.jl:24
pkgserver_1 | [13] request(::String, ::String, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; headers::Array{Pair{SubString{String},SubString{String}},1}, body::Array{UInt8,1}, query::Nothing, kw::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:status_exception,),Tuple{Bool}}}) at /depot/packages/HTTP/IAI92/src/HTTP.jl:314
pkgserver_1 | [14] #get#12 at /depot/packages/HTTP/IAI92/src/HTTP.jl:391 [inlined]
pkgserver_1 | [15] get_registries(::String) at /app/src/resource.jl:21
pkgserver_1 | [16] update_registries() at /app/src/resource.jl:130
pkgserver_1 | [17] start(; kwargs::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:listen_addr, :storage_root, :storage_servers),Tuple{Sockets.InetAddr{IPv4},String,Array{SubString{String},1}}}}) at /app/src/PkgServer.jl:88
pkgserver_1 | [18] top-level scope at /app/bin/run_server.jl:43
pkgserver_1 | [19] include(::Function, ::Module, ::String) at ./Base.jl:380
pkgserver_1 | [20] include(::Module, ::String) at ./Base.jl:368
pkgserver_1 | [21] exec_options(::Base.JLOptions) at ./client.jl:296
pkgserver_1 | [22] _start() at ./client.jl:506
pkgserver_1 | in expression starting at /app/bin/run_server.jl:43
This might be helpful but I'm not sure, yet, how to get it started
LocalRegistry.jl
Here is a solution that seems to work, based on LocalPackageServer.
Preliminary steps
Install all required packages. You can either put them in your default environment (e.g. #v1.5) or in a dedicated project.
LocalRegistry
LocalPackageServer
In order to use LocalPackageServer, we'll need to set up a local registry, even though we won't really use it (but it can still be handy if you also have to serve local packages).
Something like this should create an empty local registry as local-registry.gitt in the current folder:
# Create an empty (bare) git repository to host the registry
run(`git init --bare local-registry.git`)
# Populate the repository with a new, empty local registry
using LocalRegistry
Base.Filesystem.mktempdir() do dir
create_registry(joinpath(dir, "local-registry"),
abspath("local-registry.git"),
description = "(unused) local registry",
push=true)
end
Step 1a - run the local package server (online)
A script like the following should run a local package server listening on http://localhost:8000.
#################
# run_server.jl #
#################
using LocalPackageServer
config = LocalPackageServer.Config(Dict(
# Server parameters
"host" => "127.0.0.1",
"port" => 8000,
"pkg_server" => "https://pkg.julialang.org",
# This is where persistent data will be stored
# (I use the current directory here; adjust to your constraints)
"local_registry" => abspath("local-registry.git"), # In accordance with the preliminary step above
"cache_dir" => abspath("cache"),
"git_clones_dir" => abspath("data"),
))
# The tricky part: arrange for the server to never update its registries
# when it is offline
if get(ENV, "LOCAL_PKG_SERVER_OFFLINE", "0") == "1"
#info "Running offline => no registry updates"
config.min_time_between_registry_updates = typemax(Int)
end
# Start the server
LocalPackageServer.start(config)
Use this script to run the server online first:
shell$ julia --project run_server.jl
Step 1b - cache some packages (online)
Configure a Julia process to use your local server, and install the packages you want to cache:
# Take care to specify the "http://" protocol
# (otherwise https might be used by the client, and the server won't answer)
shell$ JULIA_PKG_SERVER=http://localhost:8000 julia
julia> using Pkg
julia> pkg"add Example"
[...]
At this point, the server should be caching things.
Step 2 - run the package server (offline)
When you're offline, simply restart the server, ensuring it won't try to update the registries:
shell$ LOCAL_PKG_SERVER_OFFLINE=1 julia --project run_server.jl
As before, set JULIA_PKG_SERVER as needed for Julia clients to use the local server; they should now be able to install packages, provided that the project environments resolve to the exact same dependency versions that were cached.
(You might want to resolve and instantiate your project environments online, and then transfer the relevant manifests to offline systems: this might help guarantee the consistency between the package server cache and what clients ask for.)

Julia - Get HTML from url

Is there a way to request an URL and get the response as a string?
I've tried to use both the "Requests" package and "LibCURL" but I cant find a way to do this
Fx. if I use requests the error I receive looks like
get(url)
ERROR: MbedTLS error code -30592: SSL - A fatal alert message was received from our peer
in macro expansion at /home/david/.julia/v0.5/MbedTLS/src/error.jl:4 [inlined]
in handshake(::MbedTLS.SSLContext) at /home/david/.julia/v0.5/MbedTLS/src/ ssl.jl:145
in open_stream(::HttpCommon.Request, ::MbedTLS.SSLConfig, ::Float64, ::Nullable{URIParser.URI}, ::Nullable{URIParser.URI}) at /home/david/.julia/ v0.5/Requests/src/streaming.jl:209
in #do_stream_request#23(::Dict{AbstractString,AbstractString}, ::Void, ::Void, ::Void, ::Array{Requests.FileParam,1}, ::Void, ::Dict{Any,Any}, ::Bool, ::Int64, ::Array{HttpCommon.Response,1}, ::MbedTLS.SSLConfig, ::Bool, ::Bool, ::Bool, ::Nullable{URIParser.URI}, ::Nullable{URIParser.URI}, ::Requests.#do_stream_request, ::URIParser.URI, ::String) at /home/david/.julia /v0.5/Requests/src/Requests.jl:361
in do_stream_request(::URIParser.URI, ::String) at /home/david/.julia/v0.5/ Requests/src/Requests.jl:324
in #do_request#22(::Array{Any,1}, ::Function, ::URIParser.URI, ::String) at / home/david/.julia/v0.5/Requests/src/Requests.jl:291
in #get#29(::Array{Any,1}, ::Function, ::URIParser.URI) at /home/david/.julia/ v0.5/Requests/src/Requests.jl:424
in #get#28(::Array{Any,1}, ::Function, ::String) at /home/david/.julia/v0.5/ Requests/src/Requests.jl:423
in get(::String) at /home/david/.julia/v0.5/Requests/src/Requests.jl:423
You're looking for readall with Requests (but in the future it may be moved to readstring since readall has been deprecated in Base Julia):
julia> using Requests
julia> readall(get("http://example.com"))
"<!doctype html>\n<html>\n<head> …

Resources