プログラミング所学者です。現在VSCodeでPythonを使用しています。
Tree Surrogateを利用したく、Skaterというmoduleを使用したいのですがエラーが多発してインストールできません。
助けてください。
ちなみに
コマンドプロンプト C:\Users\nagayama2>Python -V Python 3.7.0 C:\Users\nagayama2>pip -V pip 22.0.4 from c:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)
でございます。
環境変数のPATHは
C:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages
C:\Users\nagayama2\AppData\Local\Programs\Python\Python37\Scripts
で通しております。
以下エラー発生時の内容です。
コマンドプロンプト C:\Users\nagayama2>pip install skater==1.1.2 Collecting skater==1.1.2 Using cached skater-1.1.2.tar.gz (96 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: scikit-learn>=0.18 in c:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages (from skater==1.1.2) (1.0.2) 省略 Collecting wordcloud==1.3.1 Using cached wordcloud-1.3.1.tar.gz (169 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: joblib==0.11 in c:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages (from skater==1.1.2) (0.11) 省略 Building wheels for collected packages: skater, wordcloud Building wheel for skater (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [127 lines of output] running bdist_wheel 省略 copying skater\util\model_specific\imagenet_label.json -> build\lib\skater\util\model_specific installing to build\bdist.win-amd64\wheel running install Checking .pth file support in build\bdist.win-amd64\wheel\.\ c:\users\nagayama2\appdata\local\programs\python\python37\pythonw.exe -E -c pass TEST FAILED: build\bdist.win-amd64\wheel\.\ does NOT support .pth files error: bad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: build\bdist.win-amd64\wheel\.\ and your PYTHONPATH environment variable currently contains: '' Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations Please make the appropriate changes for your system and try again. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for skater Running setup.py clean for skater Building wheel for wordcloud (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [16 lines of output] running bdist_wheel 省略 running build_ext building 'wordcloud.query_integral_image' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for wordcloud Running setup.py clean for wordcloud Failed to build skater wordcloud Installing collected packages: wordcloud, skater Attempting uninstall: wordcloud Found existing installation: wordcloud 1.8.1 Uninstalling wordcloud-1.8.1: Successfully uninstalled wordcloud-1.8.1 Running setup.py install for wordcloud ... error error: subprocess-exited-with-error × Running setup.py install for wordcloud did not run successfully. │ exit code: 1 ╰─> [16 lines of output] running install 省略 running build_ext building 'wordcloud.query_integral_image' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. WARNING: No metadata found in c:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages Rolling back uninstall of wordcloud Moving to c:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages\wordcloud-1.8.1.dist-info\ from c:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages\~ordcloud-1.8.1.dist-info Moving to c:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages\wordcloud\ from c:\users\nagayama2\appdata\local\programs\python\python37\lib\site-packages\~ordcloud Moving to c:\users\nagayama2\appdata\local\programs\python\python37\scripts\wordcloud_cli.exe from C:\Users\NAGAYA~2\AppData\Local\Temp\pip-uninstall-j4gfc_m7\wordcloud_cli.exe error: legacy-install-failure × Encountered error while trying to install package. ╰─> wordcloud note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
よろしくお願いいたします。
https://github.com/oracle/Skater/issues/264
にあるように更新がまともにされていないらしいので、同じようなことができる別のモジュールを検討するのもありと思います。
それでも何とかSkaterを使いたい、であれば、
■方法1. setuptoolsをアップデートする
https://hahow.in/courses/5b9d3a6dca498a001e917383/discussions/5eeadedb78b2566819394a53?item=5c4c69aa59ffe1002002f3b7
そのあとpip installを試す
■方法2. skater「だけ」インストールする
pip install --no-deps skater
※たぶん依存関係のエラーが起きます。起きたエラーに特化して別途Google検索して探る
■方法3. 適当なパスを加え、コマンドプロンプトを再起動して様子を見る
■方法4. Anaconda環境に移る
同じような事ができるモジュールって何がありますか?
ありがとうございます。試してみます。
今後Skater以外のXAIの技術も試してみたいのですが、決定木を描写できる方法はありますでしょうか。dtreevizやpydotplus以外でLightGBMやXGBoost等の精度を著しく損なわない代替方法を教えていただきたく存じます。
精度を上げたいであればPycaretで根こそぎ検索する、が手の一つです。必ずしも説明可能なものが選択されるとは限りませんが…。
> 決定木を描写できる方法
手法がどれだけあるかわかりませんが、SKLearnの機能で決定木(だけ)は(少なくとも)描画できそうです。困ったときは英語で検索するとそれっぽいのがヒットしやすくなります。
参考: https://mljar.com/blog/visualize-decision-tree/
日本語話者<<英語話者<Pythonを使う上で仕方なく英語を使うことになる人を含めた英語話者のためです。
---
インストールであまりコケるようであれば、別のモジュールを探すのも(私はその場しのぎの策としては)ありと思います。モジュールの更新が止まっている、サポートが切れている、OSが対応していない、環境依存性がひどすぎるみたいなことが時々ありますよね…
あなたの回答
tips
プレビュー