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

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

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

OpenCV(オープンソースコンピュータービジョン)は、1999年にインテルが開発・公開したオープンソースのコンピュータビジョン向けのクロスプラットフォームライブラリです。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

2920閲覧

さくらレンタルサーバーでOpenCV-Pythonがインストールできない。

found

総合スコア2

OpenCV

OpenCV(オープンソースコンピュータービジョン)は、1999年にインテルが開発・公開したオープンソースのコンピュータビジョン向けのクロスプラットフォームライブラリです。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

1クリップ

投稿2020/08/22 12:46

編集2020/08/22 17:39

前提・実現したいこと

ここに質問の内容を詳しく書いてください。
とある画像処理ができるサイトを作っているのですが、そのサイトのサーバー(さくらレンタルサーバー:スタンダードプラン)にOpenCV-pythonをpipでインストールしたいです。

pip3 install opencv-python

を実行したら以下のエラーメッセージが発生しました。

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

% pip3 install opencv-python Collecting opencv-python Using cached opencv-python-4.4.0.42.tar.gz (88.9 MB) Installing build dependencies ... error ERROR: Command errored out with exit status 1: command: /home/【ドメイン】/local/python/bin/python3.6 /home/【ドメイン】/local/python/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /var/tmp/pip-build-env-zw1hqfla/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"'' cwd: None Complete output (22 lines): Ignoring numpy: markers 'python_version == "3.5"' don't match your environment Ignoring numpy: markers 'python_version == "3.7"' don't match your environment Ignoring numpy: markers 'python_version >= "3.8"' don't match your environment Collecting setuptools Using cached setuptools-49.6.0-py3-none-any.whl (803 kB) Collecting wheel Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB) Collecting scikit-build Using cached scikit_build-0.11.1-py2.py3-none-any.whl (72 kB) Collecting cmake Downloading cmake-3.18.2.tar.gz (28 kB) ERROR: Command errored out with exit status 1: command: /home/【ドメイン】/local/python/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/tmp/pip-install-a96_1o4f/cmake/setup.py'"'"'; __file__='"'"'/var/tmp/pip-install-a96_1o4f/cmake/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /var/tmp/pip-pip-egg-info-fz5tqrbq cwd: /var/tmp/pip-install-a96_1o4f/cmake/ Complete output (5 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/var/tmp/pip-install-a96_1o4f/cmake/setup.py", line 7, in <module> from skbuild import setup ModuleNotFoundError: No module named 'skbuild' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ---------------------------------------- ERROR: Command errored out with exit status 1: /home/【ドメイン】/local/python/bin/python3.6 /home/【ドメイン】/local/python/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /var/tmp/pip-build-env-zw1hqfla/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"'' Check the logs for full command output.

試したこと

調べるとさくらレンタルサーバーには管理者権限が使えないとなっていたのですが、それが関係しているのか、そうだったとしてどうすればいいのか、他のライブラリと同じように使うにはどうすればいいのかが全く分かりません。

エラー文にある"skbuild"というものもインストールしてみましたが、相変わらずOpenCVはインストールできなかったので消しました。

*追記
numpyのバージョンを変えたらうまくいくかもしれないという情報をいただけたので
numpy: 1.19.2, 1.18.2, 1.17.3, 1.14.5
を試しましたがどれも上記のエラーが出ました。

*さらに追記
scikit-buildをインストールして再度インストールしてみたら別のエラーになりました。
長文だったので一部載せておきます。
見てもらえると嬉しいです。

% pip3 install opencv-python Collecting opencv-python Using cached opencv-python-4.4.0.42.tar.gz (88.9 MB) Installing build dependencies ... error ERROR: Command errored out with exit status 1: command: /home/【ドメイン】/local/python/bin/python3.7 /home/【ドメイン】/local/python/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /var/tmp/pip-build-env-_ojj78bc/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"'' cwd: None Building wheel for cmake (setup.py): started Building wheel for cmake (setup.py): finished with status 'error' ERROR: Command errored out with exit status 1: command: /home/【ドメイン】/local/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/tmp/pip-install-ylk1gk11/cmake/setup.py'"'"'; __file__='"'"'/var/tmp/pip-install-ylk1gk11/cmake/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /var/tmp/pip-wheel-xawe3pgz cwd: /var/tmp/pip-install-ylk1gk11/cmake/ Complete output (325 lines): [ 1%] Building C object CMakeFiles/uv_a.dir/src/fs-poll.c.o In file included from /tmp/pip-install-ylk1gk11/cmake/_skbuild/freebsd-11.2-RELEASE-p14-amd64-3.7/cmake-build/LibUV-src/src/fs-poll.c:22: /tmp/pip-install-ylk1gk11/cmake/_skbuild/freebsd-11.2-RELEASE-p14-amd64-3.7/cmake-build/LibUV-src/include/uv.h:1030:25: error: field has incomplete type 'struct sockaddr_in6' struct sockaddr_in6 address6; ^ /tmp/pip-install-ylk1gk11/cmake/_skbuild/freebsd-11.2-RELEASE-p14-amd64-3.7/cmake-build/LibUV-src/include/uv.h:1030:12: note: forward declaration of 'struct sockaddr_in6' struct sockaddr_in6 address6; ^ /tmp/pip-install-ylk1gk11/cmake/_skbuild/freebsd-11.2-RELEASE-p14-amd64-3.7/cmake-build/LibUV-src/include/uv.h:1034:25: error: field has incomplete type 'struct sockaddr_in6' struct sockaddr_in6 netmask6; ^ /tmp/pip-install-ylk1gk11/cmake/_skbuild/freebsd-11.2-RELEASE-p14-amd64-3.7/cmake-build/LibUV-src/include/uv.h:1030:12: note: forward declaration of 'struct sockaddr_in6' struct sockaddr_in6 address6; ^ 2 errors generated. gmake[5]: *** [CMakeFiles/uv_a.dir/build.make:63: CMakeFiles/uv_a.dir/src/fs-poll.c.o] Error 1 gmake[4]: *** [CMakeFiles/Makefile2:77: CMakeFiles/uv_a.dir/all] Error 2 gmake[3]: *** [Makefile:141: all] Error 2 gmake[2]: *** [CMakeFiles/LibUV.dir/build.make:115: LibUV-prefix/src/LibUV-stamp/LibUV-build] Error 2 gmake[1]: *** [CMakeFiles/Makefile2:112: CMakeFiles/LibUV.dir/all] Error 2 gmake: *** [Makefile:130: all] Error 2 Traceback (most recent call last): File "/home/【ドメイン】/local/python/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 589, in setup cmkr.make(make_args, env=env) File "/home/【ドメイン】/local/python/lib/python3.7/site-packages/skbuild/cmaker.py", line 507, in make os.path.abspath(CMAKE_BUILD_DIR()))) An error occurred while building with CMake. Command: cmake --build . --target install --config Release -- Source directory: /var/tmp/pip-install-ylk1gk11/cmake Working directory: /var/tmp/pip-install-ylk1gk11/cmake/_skbuild/freebsd-11.2-RELEASE-p14-amd64-3.7/cmake-build Please see CMake's output for more information. ---------------------------------------- ERROR: Command errored out with exit status 1: /home/【ドメイン】/local/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/tmp/pip-install-ylk1gk11/cmake/setup.py'"'"'; __file__='"'"'/var/tmp/pip-install-ylk1gk11/cmake/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /var/tmp/pip-record-qo8ikt2i/install-record.txt --single-version-externally-managed --prefix /var/tmp/pip-build-env-_ojj78bc/overlay --compile --install-headers /var/tmp/pip-build-env-_ojj78bc/overlay/include/python3.7m/cmake Check the logs for full command output. ---------------------------------------- ERROR: Command errored out with exit status 1: /home/【ドメイン】/local/python/bin/python3.7 /home/【ドメイン】/local/python/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /var/tmp/pip-build-env-_ojj78bc/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"'' Check the logs for full command output.

お力を拝借したいです。
宜しくお願い致します。

補足情報(FW/ツールのバージョンなど)

Python3.6 (3.6を使っている理由は一番安定していると聞いたためです。)
OpenCV-Python4.4.0.42 OpenCVはほかのバージョンも試しましたが変化はありませんでした。

宜しくお願い致します。

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

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

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

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

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

glyzinieh

2020/08/22 14:18

詳しくないので、具体的には分かりませんが、numpyが悪さをしているような気がします。 調べてみてもnumpyでつまづいている方がチラホラいらっしゃいました。 numpyのバージョンを下げてインストールするなどしてみてはいかがですか?
found

2020/08/22 14:56

回答ありがとうございます。 numpyのバージョンを変えたときに変化はありませんでした。 他に解決策をご存じでしたら教えていただけると幸いです。 宜しくお願い致します。
guest

回答1

0

ベストアンサー

同様のERRORを経験しました。 因みに環境は(python3.8.2,raspberry pi zero)です。
以前4.1をインストールした時は苦労せず出来たので、ERRORが出た時は正直焦りました。

先ず、numpyはver1.13以上であればOkだと思います。
私の場合、skbuildインストール後に再度pip3にて試みたところ、ERRORは吐かなかったのですが、
Installing build dependencies...
の表示のまま3~4時間進展が無かったので、結局諦めてcmake、buildしてインストール(4.4.0)しました。
フリーズしている様子では無かったので、諦めずにそのまま放置していれば出来たかもしれませんが、精神衛生上好ましくないと思い、切り換えました。

OpenCV-Python4.4.0.42 OpenCVはほかのバージョンも試しましたが変化はありませんでした。

どのバージョンをお試しになったのか定かではありませんが、pip3でのインストールに拘りがあるようなら、比較的新しめversionは避けた方が良いのかなと個人的には思います。

以上、御参考になれば...。

投稿2020/08/30 07:57

aks_works

総合スコア9

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

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

found

2020/08/30 08:26

回答ありがとうございます。 管理者権限を使えないのですが、それでも問題ないのですかね? ローカルにインストールしても使える(?)ようなのですが実環境かつ初心者なのであまり冒険はしたくないのでソースビルドではなくpipでのインストールが良いですね。 > 私の場合、skbuildインストール後に再度pip3にて試みたところ、ERRORは吐かなかったのですが、 Installing build dependencies... の表示のまま3~4時間進展が無かった 私の場合ここで直ぐにエラーが出るので少し環境は違うんですかね? 現在はawsで試してすぐに出来たのでそちらで継続していきたいと思います。 この質問はもうしばらく回答受付中にしたいと思います。 ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問