I can't get the package system to work in Julia Studio. For example if I want to plot a simple graph I've tried double clicking the Winston package which seems to install from the Git repo, then:
using Winston
plot([1 2 3],[3 2 6])
But I get the error:
could not open file /Applications/JuliaStudio.app/Contents/Resources/juliaengine/Winston.jl
Which looks like Julia is looking in the wrong directory.
How should I set up Julia Studio to correctly work with the packages?
Response to Adam: thanks, unfortunately there seem to be a few issues. When I try to remove/add the Winston package I get a message like:
julia> Pkg.rm("Winston")
ERROR: Unknown dependency for ODBC: julia
in dependencies at pkg/metadata.jl:156
in ReqsStruct at pkg/resolve.jl:65
in resolve at pkg/resolve.jl:1162
in _resolve at pkg.jl:230
in anonymous at no file:163
in cd at file.jl:26
in cd_pkgdir at pkg.jl:34
in rm at pkg.jl:141
in rm at pkg.jl:165
I'll spend some more time on this and try and work out what's going on. I'll post an update for completeness if I get anywhere.
UPDATE
I'm now up to Julia Studio version 0.4.4 and after updating the packages the original example works. Unfortunately I can't determine the original problem but it looks like a complex dependency or version issue.
I think it's related to this issue:
https://github.com/forio/julia-studio/issues/83
The Winston installation requires external dependencies and prompts you for your input on how you want to install them. Julia Studio doesn't allow you to respond to this input.
Here's the workaround:
In your console, enter:
/Applications/JuliaStudio.app/julia/bin/julia-release-readline
Then
Pkg.rm("Winston")
Pkg.add("Winston")
Follow the prompts and when it's done close the process and return to Julia Studio.
Winston should now be working.
This is what I did:
Remove the $HOME/.julia folder (this will also erase all previously installed packages)
Run from a terminal/console
Last login: Sat Jul 27 02:58:06 on ttys001
~ ᐅ /Applications/JuliaStudio.app/julia/bin/julia-release-readline
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" to list help topics
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.1.2+111981303.ra703.dirty
_/ |\__'_|_|_|\__'_| | Commit a703335d02 (2013-03-10 22:34:09)*
|__/ |
julia>
Install the package
julia> Pkg.add("Winston")
MESSAGE: Auto-initializing default package repository /Users/elyase/.julia.
...
It works!
Related
Context
I am executing the following command: SHOW VARIABLES LIKE "%version%";
and getting the following output:
| version | 10.10.2-MariaDB |
| version_comment | MariaDB Server |
What I've tried so far:
I was trying to google on [mariadb version_comment] and this (official MariaDB) is not helping...
Question
How can I determine if this installation is the free or the commercial version?
Julia is not in my wheelhouse yet, but I have been handed a Julia project to run the code within.
This consists of a directory containing a main.jl, a Project.toml and a Manifest.toml.
I've read up a little on what the TOML files are for; to summarise my current understanding, they form a project or environment (not sure which, or what the real difference is).
I have installed Julia v1.3.1 at the command line by downloading the tar, decompressing and placing in my path. Typing julia at the command line opens the Julia CLI REPL as expected.
I have tried to run the code by using julia main.jl, this results in complaints about the required packages not being present, e.g.:
julia main.jl
ERROR: LoadError: ArgumentError: Package JSON not found in current path:
- Run `import Pkg; Pkg.add("JSON")` to install the JSON package.
Stacktrace:
[1] require(::Module, ::Symbol) at ./loading.jl:887
[2] include at ./boot.jl:328 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1105
[4] include(::Module, ::String) at ./Base.jl:31
[5] exec_options(::Base.JLOptions) at ./client.jl:287
[6] _start() at ./client.jl:460
in expression starting at /home/<user>/myproject/main.jl:3
I can follow the instructions here and load the required packages, but surely I shouldn't do this manually for every package?
As every package required is listed in the Project.toml I guess there should be some way to tell Julia to make sure the packages in the project are made available (I'm thinking something along the lines of Python's requirements file).
I have tried julia --project=main.jl, but this just results in the REPL loading again with nothing happening (not sure if any project or environment is loaded or not).
How can I tell Julia to run the script in this project while taking note of the requirements and other information in the TOML files?
Update:
Have figured out to enter ] at the REPL to enter the pkg package manager. Then I can:
(v1.3) pkg> activate .
Activating environment at `~/myproject/Project.toml`
(myproject) pkg> instantiate
(myproject) pkg>
Then leave the manager by pressing backspace.
Still not sure how to "run" everything though.
You’re very close to the solution! If the files are all in a directory dir then the command would be
julia --project=dir main.jl
You could also start an interactive session in that environment and then run the code in the file via
julia --project=dir
julia> include(“main.jl”)
Edit: If the directory is the current working directory, then you can just use --project=.
The error message Package JSON not found in current path imply that you don't have JSON installed.
You can check this by starting Julia and type using JSON
To install JSON all you have to do is writing import Pkg; Pkg.add("JSON")
See this output for example:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.5.2 (2020-09-23)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using JSON
ERROR: ArgumentError: Package JSON not found in current path:
- Run `import Pkg; Pkg.add("JSON")` to install the JSON package.
Stacktrace:
[1] require(::Module, ::Symbol) at ./loading.jl:893
julia> import Pkg; Pkg.add("JSON")
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/.julia/environments/v1.5/Project.toml`
[682c06a0] + JSON v0.21.1
Updating `~/.julia/environments/v1.5/Manifest.toml`
[682c06a0] + JSON v0.21.1
[69de0a69] + Parsers v1.1.0
[ade2ca70] + Dates
[a63ad114] + Mmap
[de0858da] + Printf
[4ec0a83e] + Unicode
julia> using JSON
[ Info: Precompiling JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6]
julia>
I am trying to write a simple script that takes as input a URL (or set of URLs) and as output it downloads the contents of that page to a file (in particular I am trying to download hundreds of JSON files, which ultimately I wish to diff against other JSON files).
In a file, download.hs, I have import "HTTP" Network.HTTP.
When I run: $ ghc -o download download.hs
I get the following error:
download.hs:24:1: error:
Could not find module ‘Network.HTTP’
Perhaps you meant Network.TLS (needs flag -package-key tls-1.5.2)
|
24 | import "HTTP" Network.HTTP
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
My GHC version is:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
I also get errors like:
download.hs:22:1: error:
Could not load module ‘Control.Concurrent.Async’
It is a member of the hidden package ‘async-2.2.2’.
You can run ‘:set -package async’ to expose it.
(Note: this unloads all the modules in the current scope.)
|
22 | import "async" Control.Concurrent.Async (mapConcurrently)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I think it's possible there have been breaking changes between the ghc versions, and the examples I am finding online to start with may be outdated.
Any pointers on doing started with Haskell, and particularly easy ways to download and diff JSON files in Haskell?
I have been following this example: Running parallel URL downloads in Haskell, this is where I got the code that is erroring now.
My package depends on some binary files from sourceforge.net, I want to automate building steps, how can I find latest version number to download?
I think this API will help You
https://sourceforge.net/p/forge/documentation/Using%20the%20Release%20API/
As Reza commented, you have to parse the output from:
https://sourceforge.net/projects/<projectname>/best_release.json
Example:
curl -qsL "https://sourceforge.net/projects/openofficeorg.mirror/best_release.json" | sed "s/, /,\n/g" | sed -rn "/release/,/\}/{ /filename/{ 0,//s/([^0-9]*)([0-9\.]+)([^0-9]*.*)/\2/ p }}"
Further info:
#260 JSON url for application code to detect when a new release is available.
#747 allow version metadata for each release
Is there any package for calling R from Smalltalk code and accessing return values? Any example script? I'm not looking any particular R functionality, just exploring possibility.
Any Smalltalk flavor would be ok.
In Pharo 4.0 there is a project named RProjectConnector which connects to your locally installed R system.
If you are using Windows first you should copy your R library files evaluating the following script:
| rPath dlls |
(rPath := WinRegistry
queryValue: 'InstallPath'
fromKey: (WinRegistryKey localMachine queryOpenSubkey: 'Software\\R-core\\R')) notNil
ifTrue: [
dlls := (rPath asFileReference / 'bin' / 'i386') entries
select: [ : entry | entry extension = 'dll' ]
thenDo: [ : dllEntry |
dllEntry asFileReference
copyTo: Smalltalk vmDirectory asFileReference / dllEntry basename ] ].
If you are using another not-Ubuntu Linux try to install R 32-bit (it could be a mess).
And finally follow install instructions
I don't know anything, but of course, in all Smalltalk dialects, you have a FFI plugin where you can talk to any external C-based library, like R in this case. mmmmm I guess R is in C...
Check for example:
http://book.pharo-project.org/book/PharoTools/FFI/