質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python 2.7

Python 2.7は2.xシリーズでは最後のメジャーバージョンです。Python3.1にある機能の多くが含まれています。

pip

pipとは、Pythonを用いて書かれているパッケージソフトのインストールや管理を行うためのパッケージマネジメントシステムです。pipを使う主なメリットは、コマンドラインインターフェースにて容易にPythonパッケージソフトをインストール可能だという点です。

Q&A

解決済

1回答

1896閲覧

python2.7にcvxpyをinstallしたい

macumoyo

総合スコア0

Python 2.7

Python 2.7は2.xシリーズでは最後のメジャーバージョンです。Python3.1にある機能の多くが含まれています。

pip

pipとは、Pythonを用いて書かれているパッケージソフトのインストールや管理を行うためのパッケージマネジメントシステムです。pipを使う主なメリットは、コマンドラインインターフェースにて容易にPythonパッケージソフトをインストール可能だという点です。

0グッド

0クリップ

投稿2021/07/25 07:35

編集2021/07/25 07:45

前提・実現したいこと

python2.7にcvxpyをinstallしたいです。
cvxpy1.0.11であればpython2.7に対応しているみたいなのでpip install cvxpy==1.0.11でインストールしようとしたのですがエラーになります。

発生している問題・エラーメッセージ

<省略> building 'osqp._osqp' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/extension creating build/temp.linux-x86_64-2.7/extension/src x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-gnDdqE/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPYTHON -Iosqp_sources/include -Iosqp_sources/lin_sys/direct/qdldl -Iosqp_sources/lin_sys/direct/qdldl/qdldl_sources/include -Iextension/include -I/tmp/pip-build-env-PwsYHN/overlay/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c extension/src/osqpmodule.c -o build/temp.linux-x86_64-2.7/extension/src/osqpmodule.o -O3 extension/src/osqpmodule.c:33:16: error: variable 'moduledef' has initializer but incomplete type static struct PyModuleDef moduledef = { ^~~~~~~~~~~ extension/src/osqpmodule.c:34:6: error: 'PyModuleDef_HEAD_INIT' undeclared here (not in a function); did you mean 'PyObject_HEAD_INIT'? PyModuleDef_HEAD_INIT, "_osqp", /* m_name */ ^~~~~~~~~~~~~~~~~~~~~ PyObject_HEAD_INIT extension/src/osqpmodule.c:34:6: warning: excess elements in struct initializer extension/src/osqpmodule.c:34:6: note: (near initialization for 'moduledef') extension/src/osqpmodule.c:34:29: warning: excess elements in struct initializer PyModuleDef_HEAD_INIT, "_osqp", /* m_name */ ^~~~~~~ extension/src/osqpmodule.c:34:29: note: (near initialization for 'moduledef') extension/src/osqpmodule.c:35:6: warning: excess elements in struct initializer NULL, /* m_doc */ ^~~~ extension/src/osqpmodule.c:35:6: note: (near initialization for 'moduledef') extension/src/osqpmodule.c:36:6: warning: excess elements in struct initializer -1, /* m_size */ ^ extension/src/osqpmodule.c:36:6: note: (near initialization for 'moduledef') extension/src/osqpmodule.c:37:6: warning: excess elements in struct initializer OSQP_module_methods, /* m_methods */ ^~~~~~~~~~~~~~~~~~~ extension/src/osqpmodule.c:37:6: note: (near initialization for 'moduledef') extension/src/osqpmodule.c:38:6: warning: excess elements in struct initializer NULL, /* m_reload */ ^~~~ extension/src/osqpmodule.c:38:6: note: (near initialization for 'moduledef') extension/src/osqpmodule.c:39:6: warning: excess elements in struct initializer NULL, /* m_traverse */ ^~~~ extension/src/osqpmodule.c:39:6: note: (near initialization for 'moduledef') extension/src/osqpmodule.c:40:6: warning: excess elements in struct initializer NULL, /* m_clear */ ^~~~ extension/src/osqpmodule.c:40:6: note: (near initialization for 'moduledef') extension/src/osqpmodule.c:41:6: warning: excess elements in struct initializer NULL, /* m_free */ ^~~~ extension/src/osqpmodule.c:41:6: note: (near initialization for 'moduledef') extension/src/osqpmodule.c: In function 'moduleinit': extension/src/osqpmodule.c:50:9: warning: implicit declaration of function 'PyModule_Create'; did you mean '_PyModule_Clear'? [-Wimplicit-function-declaration] m = PyModule_Create(&moduledef); ^~~~~~~~~~~~~~~ _PyModule_Clear extension/src/osqpmodule.c:50:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion] m = PyModule_Create(&moduledef); ^ extension/src/osqpmodule.c: In function 'PyInit__osqp': extension/src/osqpmodule.c:77:12: warning: 'return' with a value, in function returning void return moduleinit(); ^~~~~~~~~~~~ extension/src/osqpmodule.c:75:16: note: declared here PyMODINIT_FUNC PyInit__osqp(void) { ^~~~~~~~~~~~ extension/src/osqpmodule.c: At top level: extension/src/osqpmodule.c:33:28: error: storage size of 'moduledef' isn't known static struct PyModuleDef moduledef = { ^~~~~~~~~ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for osqp Failed to build osqp ERROR: Could not build wheels for osqp which use PEP 517 and cannot be installed directly

試したこと

最後のあたりにosqpについて書いてあるのでpip listosqpを確認したところosqp自体がないことがわかりました。そこでpip install osqpを実行したら、pip install cvxpy==1.0.11と同じエラーになりました。

どなたか詳しい方よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

osqp==0.6.2ではなくosqp==0.4.1ならインストールすることができた.
osqpのインストールに成功すればもう一度pip instal cvxpyを実行することでcvxpyのインストールに成功した.

投稿2021/07/29 06:50

macumoyo

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問