无法在DataSpell中使用WSL启动jupyter服务器



似乎DataSpell正在尝试执行此命令:C:Windowssystem32wsl.exe --distribution Debian --exec /bin/sh -c "export LANGUAGE='' && export LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8 && /usr/bin/python3 -m jupyter notebook --no-browser '--notebook-dir=/mnt/c/Users/Andy Zhou/Desktop/Year 2 stuff/GPT-2/code/SERI MATS IOI' --ip=172.22.246.59"

然而,当我直接在WSL上执行——exec之后的部分时,它工作了。

添加一些关于您的问题的附加信息,例如DataSpell可能返回给您的错误代码,或者htop是否显示正在运行的Jupyter服务器,将使提供准确的答案变得容易得多。

因此,我相信你的问题可以有两种理解,我已经为每一种都提供了答案。

服务器启动但无法连接

当DataSpell启动本地基于wsdl的Jupyter服务器时,它会对连接应该如何工作做出某些假设,它还会使用您的wsdl实例的LAN地址来尝试连接。默认的Jupyter配置假定有一个本地连接,因此DataSpell通过外部IP地址的连接会立即被拒绝。

解决此问题的步骤:

  1. 在WSL运行jupyter notebook --generate-config,它会打印出你的新配置文件的路径
  2. Vim到新文件中并设置以下值:
# Please note that the below values can be unsafe, consider changing these values to only allow your IP address to connect; alternatively you could require authentication to access the server.
## The IP address the notebook server will listen on.
c.NotebookApp.ip = '0.0.0.0'
## Set the Access-Control-Allow-Origin header 
c.NotebookApp.allow_origin = '*'
## Allow requests where the Host header doesn't point to a local server
c.NotebookApp.allow_remote_access = True
  1. 配置一个WSL Python解释器,详细信息如下:https://www.jetbrains.com/help/dataspell/using-wsl-as-a-remote-interpreter.html
  2. 为您的项目更改Jupyter连接,以使用您刚刚设置的解释器,详细信息如下:https://www.jetbrains.com/help/dataspell/using-wsl-as-a-remote-interpreter.html
  3. 在你的笔记本上运行一个cell,服务器应该会自动启动并连接良好。

关于这个问题有一个很好的参考:为什么我不能't访问远程Jupyter Notebook服务器?

使用WSL时服务器未启动

不幸的是,这是更广泛的,几乎肯定需要更多的信息来解决,但以下问题很可能是原因:

  • 您的WSL安装中没有包含rsync: https://www.jetbrains.com/help/dataspell/using-wsl-as-a-remote-interpreter.html#prereq
  • WSl没有安装Jupyter:
    • 安装Jupyter通过pip,或conda:{pip|conda} install jupyter
  • 当DataSpell试图运行笔记本时WSL未运行

不幸的是,没有更多的信息,或至少一个错误代码,是不可能给你一个明确的答案;但希望这对你在正确的方向上有所帮助!

最新更新