ipywidgetsプラグインに関して、エラー 'ウィジェットJavascriptが検出されませんでした。正しくインストールまたは有効化されていない可能性があります。



Regarding Ipywidgets Plugin



1.問題の説明:

ipywidgetsをインストールした後、次のコードを実行すると、エラーが発生しました ``

import torch import torchvision import torchvision.transforms as transforms import matplotlib.pyplot as plt import ipywidgets as widgets import sys sys.path.append('..') import d2lzh_pytorch as d2l

エラー表示:



Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz to C:Users /Datasets/FashionMNISTFashionMNIST aw rain- images-idx3-ubyte.gz Widget Javascript not detected. It may not be installed or enabled properly. A Jupyter widget could not be displayed because the widget state could not be found. This could happen if the kernel storing the widget is no longer available, or if the widget state was not saved in the notebook. You may be able to create the widget by running the appropriate cells.

エラーのスクリーンショット:

2.問題分析:

コマンドpip search widgetsnbextensionを使用できます。このプラグインがバックグラウンドで見つかるかどうかを確認します。見つからない場合は、再インストールする必要があります。次の解決策を試すことができます。



しかし、上記の操作は解決できなかったので、次のステップに進みました。インストールしたバージョンは4.xで、一連のソリューションを確認しました。これはおそらく、この4.Xバージョンがjupyter Notebookで機能し、サポートされていないものがあることを意味します。バージョン5.0.0をインストールすると、「このバージョンに見つからない」という問題を解決できます。
プラグインの問題」。そこで、バージョン5.0.0を再インストールしました。 (詳細は3点目)

3.問題解決:

1.最初にコマンドを使用しますpip install ipywidgets==5.0.0(4.xバージョンを既にインストールしていてダウンロードできないため失敗しました。)

エラーコード:



Installing collected packages: ipywidgets Found existing installation: ipywidgets 6.0.0 ERROR: Cannot uninstall 'ipywidgets'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

エラーのスクリーンショット:

これはアナコンダの保護メカニズムであり、次のことを示しています。 これはdistutilsインストールプロジェクトであるため、どのファイルがそれに属しているかを正確に特定できず、部分的なアンインストールのみが発生します。 、環境破壊を防ぐため。アンインストールする場合、この種のエラーがより一般的です。本当にアンインストールしたい場合は、サードパーティのフォルダのアクセス許可を変更することもできます。 (他のブログ投稿を参照してください)

2.コマンド:(まだ失敗します)

pip install --ignore-installed --upgrade ipywidgets==5.0.0 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

このコマンド--ignore-installedインストールされているバージョンを無視して、特定のバージョンをインストールできます。インターネットの速度を上げるために、AlibabaCloudのミラーイメージが特別に追加されました。
エラーコード:

Installing collected packages: attrs, setuptools, zipp, importlib-metadata, six, pyrsistent, jsonschema, ipython-genutils, pywin32, decorator, traitlets, jupyter-core, nbformat, Send2Trash, tornado, prometheus-client, MarkupSafe, jinja2, pywinpty, terminado, pyzmq, python-dateutil, jupyter-client, pickleshare, colorama, parso, jedi, pygments, backcall, wcwidth, prompt-toolkit, ipython, ipykernel, webencodings, bleach, entrypoints, testpath, defusedxml, mistune, pandocfilters, nbconvert, notebook, widgetsnbextension, ipywidgets ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied. :'d:\installsoftware\anaconda\envs\spyder_py3.5\Lib\site-packages\win32\win32api.pyd' Consider using the `--user` option or check the permissions.

エラーのスクリーンショット:

その結果、アクセスが拒否され、環境エラーのためにパッケージをインストールできなくなります。同時に、ソリューションにプラス--userを与えます。

3.インストールコマンド(ipywidgets 5.0.0バージョンが正常にインストールされました)

pip install --ignore-installed --upgrade ipywidgets==5.0.0 --user -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

スクリーンショット:

警告はたくさんありますが、大丈夫です。インストールはようやく成功しました。この時点で、このプラグインが見つけられなかった問題は解決されました。

GitHubディスカッション掲示板リファレンス: https://github.com/jupyter/notebook/issues/1386