# How to run an itensor program in Ubuntu?

commented by (140 points)
Hi Miles,

I've installed ITensor in my computer (Linux-Ubuntu) as well as the Lapack library.
I've tried to compile a program from the ~/itensor/tutorial/01_one_site folder named
one.cc and got the following output:

bonfim@jupiter:~/itensor/tutorial/01_one_site$make one g++ -m64 -std=c++11 -fPIC -I. -I/home/local/CAMPUS/bonfim/itensor -O2 -DNDEBUG -Wall -Wno-unused-variable one.o -o one -L/home/local/CAMPUS/bonfim/itensor/lib -litensor -lpthread -L/usr/lib -lblas -llapack /usr/bin/ld: cannot find -llapack collect2: error: ld returned 1 exit status make: *** [one] Error 1 I think I have to include into options.mk in addition to: ## GNU GCC compiler CCCOM=g++ -m64 -std=c++11 -fPIC PLATFORM=lapack BLAS_LAPACK_LIBFLAGS=-lpthread -L/usr/lib -lblas -llapack the following: BLAS_LAPACK_LIBFLAGS and BLAS_LAPACK_INCLUDEFLAGS. However, I cannot find the right path to add to BLAS_LAPACK_LIBFLAGS and BLAS_LAPACK_INCLUDEFLAGS in my system (Linux-Ubuntu). The working directory for itensor in my computer is: bonfim@jupiter:~/itensor$ pwd
/home/local/CAMPUS/bonfim/itensor

I was wandering if you could tell me how to find the correct path to include
into BLAS_LAPACK_LIBFLAGS and BLAS_LAPACK_INCLUDEFLAGS.

Thank you,

Oz
commented by (29.7k points)
Hi, I posted an answer below just now before I saw your whole question (I just thought your question was how to install ITensor in general). I'm looking up some more Ubuntu specific info though for you - hold on a minute.
commented by (29.7k points)
Ok so from what I'm seeing it looks like "liblapack" (which is what the -llapack directive is trying to link to) should typically be located in /usr/lib.

So most likely if you're getting that error, you haven't yet installed Lapack. Can you please check that it's installed?

sudo apt-get install libblas-dev
sudo apt-get install libblas-dev
commented by (140 points)
Yes, it is installed
commented by (29.7k points)
Ok that's good.

One "fix" is to install MKL instead, since that will actually give you much better performance. When you install it it usually ends up in a folder /opt/intel/mkl/ ...

But you should be able to get ITensor working with the standard Ubuntu packages too. It's hard for me to debug remotely since I don't have my own Ubuntu install...

But could you please try this: cd into /usr/lib and see if there is a file starting with "liblapack" perhaps with various other endings...

If not, please see if there is a similarly named file perhaps in /usr/local/lib or /usr/share/lib
commented by (29.7k points)
Also did you install the packages with the -dev ending and not just the packages called lapack or lapacke ? It's important to install lapack-dev or similar (with the -dev ending).
commented by (140 points)
I found the following files (among many) in /usr/lib:
(the other folders do not exist)

folder name: libblas
files: libblas.a libblas.so libblas.so.3 libblas.so.3.0
commented by (140 points)
I used the packages with the -dev ending for the installation.
I also installed from Ubuntu itself. In both cases I get the same error.
commented by (140 points)
I may have to upgrade my Ubuntu software (now 14.04 LTS)
commented by (29.7k points)
Hi, so I'm not sure where it's supposed to be but those are some common locations. It's good that you found the libblas files, so definitely include the enclosing folder in your -L linker flags (in the options.mk file). But as you can see from the error message, the library that's missing is liblapack. So all I can tell you is please look in the standard install locations for the file liblapack.so If it's not in a standard location then it either means the associated package was not installed (or was somehow damaged) or is not a standard installation in some sense.
commented by (140 points)
It worked. I reinstalled Blas and Lapack using the following command:

sudo apt-get install libblas-dev liblapack-dev

Thanks a lot.
Oz
commented by (29.7k points)
Glad it's working and thanks for the follow-up post to let me know. It will be a valuable thread to have here on the forum for others with similar issues -