Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
749 views
in Technique[技术] by (71.8m points)

python - installing glpk cvxopt with conda

I have set up an environment where all packages are managed by conda (even for gcc). What i want to do is to install, cvxopt with GLPK support:

CVXOPT_BUILD_GLPK=1 pip install cvxopt 

Doing tha directly leads to

src/C/glpk.c:24:18: fatal error: glpk.h: No such file or directory
 #include <glpk.h>
                  ^
compilation terminated.
error: command 'gcc' failed with exit status 1

So I install glpk with conda with:

conda install -c conda-forge glpk=4.60

and try again:

CVXOPT_BUILD_GLPK=1 pip install cvxopt 

Getting error:

src/C/umfpack.c:23:21: fatal error: umfpack.h: No such file or directory
 #include "umfpack.h"
                     ^
compilation terminated.
error: command 'gcc' failed with exit status 1

So I try to resolve it with:

conda install -c conda-forge scikit-umfpack=0.2.3

So in this case, CVXOPT_BUILD_GLPK=1 pip install cvxopt is successful,

However, when i try to run a python programme:

Traceback (most recent call last):
  File "my_programme.py", line 19, in <module>
    from cvxopt import normal, matrix
  File "/home/me/anaconda2/lib/python2.7/site-packages/cvxopt/__init__.py", line 32, in <module>
    import cvxopt.base
ImportError: /home/me/anaconda2/lib/python2.7/site-packages/cvxopt/base.so: undefined symbol: _gfortran_st_write_done

I do not know how to resolve this then.... Any help? Thank you. I will prefer to manage all programmes using conda....

Edit: afterwards I tried:

pip uninstall cvxopt
conda install -c jjhelmus cvxopt_glpk=1.1.6

then I got this error:

  File "my_code.py", line 19, in <module>
    from cvxopt import normal, matrix
  File "/home/me/anaconda2/lib/python2.7/site-packages/cvxopt/__init__.py", line 32, in <module>
    import cvxopt.base
ImportError: liblapack.so.3gf: cannot open shared object file: No such file or directory

I am really not sure why this has to be so complicated even after i uniformly manage my packages using conda....Further, after i do all this mess... my system becomes buggy also. I am so upset about all this....

Now... I am on the verge of breaking down.... I completely remove conda and install conda clean... and then do

conda install -c jjhelmus cvxopt_glpk=1.1.6

After running the programme, I get:

Traceback (most recent call last):
  File "extract_small_confgs_from_GMC.py", line 19, in <module>
    from cvxopt import normal, matrix
  File "/home/me/anaconda2/lib/python2.7/site-packages/cvxopt/__init__.py", line 32, in <module>
    import cvxopt.base
ImportError: liblapack.so.3gf: cannot open shared object file: No such file or directory

Oh my god.....

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I resolve my issue with:

conda install -c conda-forge glpk=4.60
conda install -c conda-forge cvxopt=1.1.8

Basically, we would need use the consistent condo-forge's everything. e.g. their glpk and cvxopt.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...