How to install CVXOPT with Enthought python (Canop

2020-07-18 04:48发布

问题:

Before I start, let me put alternative titles for this post:

How to compile CVXOPT with Intel MKL ?

How to change __init__.py in CVXOPT to compile with Intel MKL ?

Let me explain the issue. I am trying to install pystruct with Enthought python because Enthought python provides significant speed up in comparison to python in the Ubuntu package manager. The speed-up are mostly due to compiling back-end linear algebra libraries with Intel MKL libraries. I have to say that CVXOPT and pystruc works pretty well with gnu python.

I was wondering if anyone tried to install CVXOpt with Enthought python (Canopy formerly EPD) ? It needs to be compiled with Intel MKL.

When I build the CVXOPT and try to import it Enthought python, I get the following error (which seems like a linker error):

>>> import cvxopt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cvxopt/__init__.py", line 32, in <module>
    import cvxopt.base
ImportError: /home/kayhan/Enthought/Canopy_64bit/User/bin/../lib/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3gf)

But if i try to import it in default python, I get no error (the test also works).

I guess the problem is with linking to a wrong library. I also have INTEL MKL in case I need to re-compile CVXOPT with respect to MKL (which seems the version of blas Enthought is using). I could not found any instruction in the documentation how to get it working with Enthough, please advise.

UPDATE: As I mentioned earlier, CVXOPT compiles and run with gnu python. I did the following trick which does not look very good idea but it works:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libfreetype.so:/usr/lib/x86_64-linux-gnu/libgfortran.so.3 python

which I have learned from this post : (libgfortran: version `GFORTRAN_1.4' not found)

Now, the question is what is the clean way to do this? How can I pre-load library only for one package. Or compile CVXOPT with Intel MKL and not have to pre-load library at all?

Thanks,
Kayhan