how to find version number of Julia? Is there a ver() command? - julia

I installed Julia studio 0.4.4, and found it does not support multi-line comments #=...=# so I wanted to find what version of Julia it is running.
In Matlab one types the command ver which not only shows the version number of matlab, but also the version numbers of all toolboxes installed.
I googled for sometime, but not able to find similar command for Julia. Is there such a command for Julia?
julia> Version
ErrorException("Version not defined")
julia> ver
ErrorException("ver not defined")
julia> ver()
ErrorException("ver not defined")
julia> Version()
ErrorException("Version not defined")

Just entering out the constant VERSION would also display the version number.
julia> VERSION
v"0.4.0"

Use the versioninfo command:
From the documentation:
versioninfo([verbose::Bool])
Print information about the version of Julia in use. If the verbose argument
is true, detailed system information is shown as well.

If you are using windows,you can use julia -version of the cmd command

Related

Installing sqlite driver in Haskell using stack

I have sqlite3 installed in Ubuntu.
$ which sqlite3
/home/user/anaconda3/bin/sqlite3
I'm trying to install the sqlite driver in Haskell and see the following error:
$ stack install sqlite
sqlite-0.5.5: configure
sqlite-0.5.5: build
-- While building custom Setup.hs for package sqlite-0.5.5 using:
/tmp/stack16820/sqlite-0.5.5/.stack-work/dist/x86_64-linux/Cabal-2.2.0.1/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /home/user/.stack/global-project/.stack-work/logs/sqlite-0.5.5.log
[1 of 2] Compiling Main ( /tmp/stack16820/sqlite-0.5.5/Setup.hs, /tmp/stack16820/sqlite-0.5.5/.stack-work/dist/x86_64-linux/Cabal-2.2.0.1/setup/Main.o )
[2 of 2] Compiling StackSetupShim ( /home/user/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack16820/sqlite-0.5.5/.stack-work/dist/x86_64-linux/Cabal-2.2.0.1/setup/StackSetupShim.o )
Linking /tmp/stack16820/sqlite-0.5.5/.stack-work/dist/x86_64-linux/Cabal-2.2.0.1/setup/setup ...
Configuring sqlite-0.5.5...
Preprocessing library for sqlite-0.5.5..
Building library for sqlite-0.5.5..
[1 of 5] Compiling Database.SQL.Types ( Database/SQL/Types.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Database/SQL/Types.o )
/tmp/stack16820/sqlite-0.5.5/Database/SQL/Types.hs:481:37: error:
Ambiguous occurrence ‘<>’
It could refer to either ‘Prelude.<>’,
imported from ‘Prelude’ at Database/SQL/Types.hs:15:8-25
(and originally defined in ‘GHC.Base’)
or ‘Text.PrettyPrint.HughesPJ.<>’,
imported from ‘Text.PrettyPrint.HughesPJ’ at Database/SQL/Types.hs:56:1-32
|
481 | FunSQLExpr f es -> text f <> parens (commaH ppSQLExpr es)
| ^^
Which of ghc, stack, cabal, anaconda, sqlite should I interrogate to figure out what is failing?
I'm trying to install the sqlite driver in Haskell and see the following error
The sqlite package is deprecated in favour of sqlite-simple So, I would recommend you to not use this. If you are looking for a much higher level of interface to sqlite, I would recommend persistent library.
If you want to still make it work, the easiest way is to just fix the compile errors by forking the code and make it work with the required GHC version.
TL;DR
stack install sqlite --resolver=lts-11.22 should work
First of all i would follow sibi advise and install the maintaned package sqlite-simple.
But if you want to use the deprecated one we could analyze the error:
The error is thrown in the haskell part, the combination of stack and haskell. No mention about c code so the sqlite lib (or anaconda) is not involved here
Ambiguous occurrence ‘<>’ It could refer to either ‘Prelude.<>’, or ‘Text.PrettyPrint.HughesPJ.<>’: The simbol <> is defined in two modules and the client code doesn't disambiguate them (surely cause it was only in one module at the time)
So we have to compile with a version of Prelude or Text.PrettyPrint.HughesPJ without the definition of <>
Text.PrettyPrint.HughesPJ is a module from the pretty package and all versions of the package have the operator exported
The Prelude is defined in the base library and it is fixed for each version of ghc, that in turn is fixed for each major version of the stackage resolver. You can set the global stack resolver in ~/stack/global-project/stack.yaml or in each call to stack with the option --resolver=
The package sqlite accepts base versions in the range >=3 && <5 (in fact that is the cause of the problem, it is too flexible)
If we search for <> in the changelog of base we can see it was exported since version 4.11.0. And that version was shipped with ghc-8.4.1 (you can see the matrix between versions here). So we have to choose a stackage resolver linked to a previous version of ghc: f.e. lts-11.22 with ghc-8.2.2

How to check what cpu features can be used in my current system image?

I found on the internet a performance tip for Julia: compile the system image for your architecture.
Besides the fact, that the process gives an error
julia> include(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "build_sysimg.jl"))
julia> build_sysimg()
ERROR: UndefVarError: Libdl not defined
I am wondering, how to check all the supported instruction sets that my current system image is using? (i.e. can it use avx2?)
I use Julia 1.0.0
I don't know that Julia has an out-of-the box function for this, but if you add the CpuId.jl package via ]add CpuId in the REPL, you can call using CpuId; cpufeaturetable(), as stated in their README.md.
(Note - we are in the process of upgrading it to 1.0 - so do file an issue/PR if you run into bugs.)

Julia#1.0.0: How to get installed Pkg.uuid in REPL

I want to use Base.compilecache.
It needs PkgId(UUID). But I don't know how to get installed Pkg.uuid in REPL.
https://docs.julialang.org/en/v1.0.0/base/base/#Base.compilecache
I tried Pkg.PackageSpec but can't get UUID.
https://docs.julialang.org/en/stable/stdlib/Pkg/#Pkg.PackageSpec
julia> using Pkg
julia> Pkg.status()
Status `~/.julia/environments/v1.0/Project.toml`
[8f4d0f93] Conda v1.0.1
[7073ff75] IJulia v1.9.3
julia> Pkg.PackageSpec("Conda")
PackageSpec(name=Conda)
julia> Pkg.PackageSpec("Conda").uuid
UUID("00000000-0000-0000-0000-000000000000")
My goal is to call Base.compilecache at Docker file.
Julia v0.6.4 code
julia -e "Base.compilecache(\"JSON\")"
You can use Base.identify_package("Conda").

failed to precompile Gurobi (on Windows, using Julia)?

I am trying to run a Julia program using Gurobi solver on Windows.
I have already set up my GUROBI_HOME in windows as C:\gurobi701\win64.
Here is the error message in Atom:
error msg
I have done the following in Julia interactive shell:
Pkg.add("Gurobi")
also
Pkg.update()
Also, I checked whether or not my gurobi license file is not properly set up by running their example:
> gurobi_cl C:\gurobi701\win64\examples\data\coins.lp
The output seems fine: output for gurobi command line
What is the possible error here?
Thanks a lot for help!!!

Julia error: no method haskey(Dict{String,Dict{String,String}},ASCIIString)

I'm trying to test out the Winston plotting engine in Julia. I installed the package but I'm getting some errors now when I try to compile one of the examples:
> julia example1.jl
Warning: could not import Base.haskey into Inifile
Warning: could not import Graphics.set_source into Color
ERROR: no method haskey(Dict{String,Dict{String,String}},ASCIIString)
in read at /Users/thinkpad20/.julia/IniFile/src/IniFile.jl:41
in read at /Users/thinkpad20/.julia/IniFile/src/IniFile.jl:67
in anonymous at /Users/thinkpad20/.julia/Winston/src/Winston.jl:39
in include_from_node1 at loading.jl:88
in reload_path at loading.jl:111
in require at loading.jl:46
in include_from_node1 at loading.jl:88
in process_options at client.jl:253
in _start at client.jl:334
at /Users/thinkpad20/.julia/Winston/src/Winston.jl:31
at /Users/thinkpad20/.julia/Winston/examples/example1.jl:3
can anyone tell me what's going on? It seems to be that it can't find Base.haskey, but I'm not sure how to address that.
Try inspecting Base.VERSION
haskey was introduced in Julia v0.2 (still pre-release as of this writing), I suspect that you are running a version 0.1.x
The real problem is inside of the Winston package. It sounds like they have their REQUIRES information set up wrong. You should file an issue here: https://github.com/nolta/Winston.jl
You can also download pre-release version of 0.2 for windows and mac here: https://code.google.com/p/julialang/downloads/list

Resources