install CVXpy: compile failed with error code 1

1,286 views
Skip to first unread message

bs

unread,
Sep 20, 2016, 11:34:57 AM9/20/16
to cvxpy
I am trying to install CVXpy on Ubuntu 14.04, with python 2.7.6, pip 1.5.4. I tried the way proposed here: http://www.cvxpy.org/en/latest/install/index.html

It runs smoothly until: nosetests cvxpy where I get the error:

ImportError: No module named canonInterface

So I tried to install the package CVXcanon but the command pip install CVXcanon gives the following error:

Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip_build_baptiste/CVXcanon/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-_ehIzX-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_baptiste/CVXcanon


This package seems useful as I can run examples such as admm_example.py. Error :ImportError: No module named cvxpy


Would you have an advice on how to get this issue settled? Thank you.


Steven Diamond

unread,
Sep 20, 2016, 11:38:17 AM9/20/16
to cvxpy
Are you saying you installed cvxpy with Anaconda, which is the recommended way? It looks like you installed it with pip. My guess is you don't have g++ so you can't compile CVXcanon.

bs

unread,
Sep 20, 2016, 11:58:55 AM9/20/16
to cvxpy
I installed it using Anaconda, and just checked that I have g++ installed.

Steven Diamond

unread,
Sep 20, 2016, 12:12:52 PM9/20/16
to cvxpy
Ok, my guess then is you have multiple Pythons on your system and when you run "nosetests cvxpy" it's not using the Anaconda python. Otherwise I don't see how you could run "conda install -c cvxgrp cvxpy" and not install CVXcanon.

Try running "conda install -c cvxgrp cvxcanon". Then try to import canonInterface in Python.

bs

unread,
Sep 20, 2016, 12:21:18 PM9/20/16
to cvxpy
Indeed you seem to be right. I got no error in doing
conda install -c cvxgrp cvxcanon
as everything was already installed.
but I cant import canonInterface in Python from the terminal.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

bs

unread,
Sep 20, 2016, 4:35:16 PM9/20/16
to cvxpy
I checked indeed two Python versions:
which -a python | xargs ls -li
21758941 lrwxrwxrwx 1 root root  9 aug 17  2015 /usr/bin/python -> python2.7
22157490 lrwxrwxrwx 1 root root 18 sep 20 16:19 /usr/local/bin/python -> /usr/bin/python2.7

How to replace the one in /usr/bin by the one from anaconda? The one installed via anaconda is the second one, seemingly.

Steven Diamond

unread,
Sep 20, 2016, 5:13:37 PM9/20/16
to cvxpy
Either change your python path or rename /usr/bin/python2.7 as /usr/bin/python
Reply all
Reply to author
Forward
0 new messages