尝试在虚拟环境中使用 ipywidgets 时 npm 不起作用
npm does not work when trying to use ipywidgets in a virtual environment
我在服务器上使用 python 虚拟环境。现在我正在尝试使用 ipywidgets 和显示。这是我的环境有:
看来我已经安装了 jupyter、nodejs 和 npm。
然后我安装
看起来不错。
然后我安装:
现在我正在尝试安装:
你可以看到关于 npm 的错误。
日志信息为:
Node v12.16.3
Yarn configuration loaded.
> /bin/npm pack @jupyter-widgets/jupyterlab-manager@2.0
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/@jupyter-widgets%2fjupyterlab-manager failed, reason: unable to verify the first certificate
npm ERR! A complete log of this run can be found in:
npm ERR! /home/fefechen/.npm/_logs/2020-05-25T04_59_34_698Z-debug.log
Traceback (most recent call last):
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
yield
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/labextensions.py", line 93, in start
ans = self.run_task()
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/labextensions.py", line 149, in run_task
for i, arg in enumerate(self.extra_args)
......
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/labextensions.py", line 149, in <listcomp>
for i, arg in enumerate(self.extra_args)
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/commands.py", line 388, in install_extension
return handler.install_extension(extension, pin=pin)
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/commands.py", line 603, in install_extension
info = self._install_extension(extension, tempdir, pin=pin)
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/commands.py", line 1499, in _install_extension
info = self._extract_package(extension, tempdir, pin=pin)
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/commands.py", line 1578, in _extract_package
raise ValueError(msg % source)
ValueError: "@jupyter-widgets/jupyterlab-manager@2.0" is not a valid npm package
Exiting application: jupyter
那么,如何处理这个问题:ValueError: "@jupyter-widgets/jupyterlab-manager@2.0" is not a valid npm package
这是因为防火墙。我 运行 在我的本地计算机上使用相同的代码,很好
我为此苦苦挣扎,最终放弃了 conda,然后是 pipenv,即使在计算机全局环境中完全按照安装说明进行操作后,问题仍然存在;防火墙 on/off 等
显然有很多人遇到了这个问题,不幸的是有很多答案。我尝试了很多,通过蛮力发现了以下内容:
jupyter lab paths
... 打印出 jupyter 的环境所在的位置。当您 cd 到 C:\Users\<username>\.jupyter\lab
和 运行 相同的 jupyter labextension install @jupyter-widgets/jupyterlab-manager
安装命令时,我得到一个可爱的旋转反斜杠,它闪烁了 30 秒,最终 returns 一条模棱两可的消息 Building jupyterlab assets (build:prod:minimize)
.
您可以检查以确保安装了:jupyter labextension list
,在我的例子中输出了:
Known labextensions:
app dir: c:\python38\share\jupyter\lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled ok
很抱歉,现在已经太晚了,我无法继续设置虚拟环境,但我希望这指向正确的方向,并为其他人节省 3-4 小时的无效谷歌搜索:-P
我在服务器上使用 python 虚拟环境。现在我正在尝试使用 ipywidgets 和显示。这是我的环境有:
看来我已经安装了 jupyter、nodejs 和 npm。
然后我安装
看起来不错。
然后我安装:
现在我正在尝试安装:
你可以看到关于 npm 的错误。
日志信息为:
Node v12.16.3
Yarn configuration loaded.
> /bin/npm pack @jupyter-widgets/jupyterlab-manager@2.0
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/@jupyter-widgets%2fjupyterlab-manager failed, reason: unable to verify the first certificate
npm ERR! A complete log of this run can be found in:
npm ERR! /home/fefechen/.npm/_logs/2020-05-25T04_59_34_698Z-debug.log
Traceback (most recent call last):
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
yield
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/labextensions.py", line 93, in start
ans = self.run_task()
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/labextensions.py", line 149, in run_task
for i, arg in enumerate(self.extra_args)
......
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/labextensions.py", line 149, in <listcomp>
for i, arg in enumerate(self.extra_args)
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/commands.py", line 388, in install_extension
return handler.install_extension(extension, pin=pin)
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/commands.py", line 603, in install_extension
info = self._install_extension(extension, tempdir, pin=pin)
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/commands.py", line 1499, in _install_extension
info = self._extract_package(extension, tempdir, pin=pin)
File "/scratch/feng/py36env/lib64/python3.6/site-packages/jupyterlab/commands.py", line 1578, in _extract_package
raise ValueError(msg % source)
ValueError: "@jupyter-widgets/jupyterlab-manager@2.0" is not a valid npm package
Exiting application: jupyter
那么,如何处理这个问题:ValueError: "@jupyter-widgets/jupyterlab-manager@2.0" is not a valid npm package
这是因为防火墙。我 运行 在我的本地计算机上使用相同的代码,很好
我为此苦苦挣扎,最终放弃了 conda,然后是 pipenv,即使在计算机全局环境中完全按照安装说明进行操作后,问题仍然存在;防火墙 on/off 等
显然有很多人遇到了这个问题,不幸的是有很多答案。我尝试了很多,通过蛮力发现了以下内容:
jupyter lab paths
... 打印出 jupyter 的环境所在的位置。当您 cd 到 C:\Users\<username>\.jupyter\lab
和 运行 相同的 jupyter labextension install @jupyter-widgets/jupyterlab-manager
安装命令时,我得到一个可爱的旋转反斜杠,它闪烁了 30 秒,最终 returns 一条模棱两可的消息 Building jupyterlab assets (build:prod:minimize)
.
您可以检查以确保安装了:jupyter labextension list
,在我的例子中输出了:
Known labextensions:
app dir: c:\python38\share\jupyter\lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled ok
很抱歉,现在已经太晚了,我无法继续设置虚拟环境,但我希望这指向正确的方向,并为其他人节省 3-4 小时的无效谷歌搜索:-P