I am trying to install the Julia version on some supercomputer . In order to have a local installation, I need to use some local environments using:
import Pkg; Pkg.activate("ITensors")
Then I do a standard installation using:
import Pkg; Pkg.add("ITensors")
using ITensors
ITensors.compile()
Then, if I try to create simple tensors everything is fine but I cannot run the basic dmrg examples due to errors, e.g.
julia> OpSum()
ERROR: UndefVarError: OpSum not defined
Stacktrace:
[1] top-level scope at REPL[4]:1
I am beginner in Julia so it might be a stupid mistake… Any help would be appreciated, thanks in advance.
In the same Julia session, did you execute using ITensors
before executing OpSum()
? For example:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.7.2 (2022-02-06)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> OpSum()
ERROR: UndefVarError: OpSum not defined
Stacktrace:
[1] top-level scope
@ REPL[1]:1
julia> using ITensors
julia> OpSum()
OpSum:
julia>
yes indeed and if I type something else:
sites = siteinds("S=1/2",10; conserve_qns=true)
it works perfectly.
Actually in my local installation, the content of the .julia/packages
is not the same as on my laptop so I’m wondering if the installation was done correctly. Is there another way to install ITensor with Julia ?
Does the installation work if you skip the step of making a local environment?
To do a basic installation of ITensors.jl, all you have to do is:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.7.2 (2022-02-06)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> import Pkg; Pkg.add("ITensors")
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/.julia/environments/v1.7/Project.toml`
[9136182c] + ITensors v0.3.9
No Changes to `~/.julia/environments/v1.7/Manifest.toml`
julia> using ITensors
julia> OpSum()
OpSum:
julia> sites = siteinds("S=1/2",10; conserve_qns=true)
10-element Vector{Index{Vector{Pair{QN, Int64}}}}:
(dim=2|id=824|"S=1/2,Site,n=1") <Out>
1: QN("Sz",1) => 1
2: QN("Sz",-1) => 1
[...]
Does that work for you?
If so, the issues you are seeing are probably related to making the local environment, which we can try to help with but I just want to check first that the basic installation process works for you.
No if I do that, I get this error:
ERROR: SystemError: opening file "/usr/local/julia/julia-1.5.3/local/share/julia/environments/v1.5/Project.toml": Permission denied
since I cannot install in the /usr directory. So I do need to activate some local environment…
I see, are you using a pre-installed version of Julia on a cluster?
I would recommend installing your own version of Julia. First of all, Julia 1.5.3 is pretty old right now and the latest versions of ITensors.jl (after ITensors 0.3) have dropped support for Julia 1.5 and below. Second, it will make it easier for you to install your own packages without having to mess with environments.
You should be able to follow the instructions here: Installing Julia and ITensor · ITensors.jl to install your own local version of Julia on a cluster.
1 Like
Thanks a lot, it seems to work now !
1 Like