【问题标题】:Cannot start jupyter server with WSL in DataSpell无法在 DataSpell 中使用 WSL 启动 jupyter 服务器
【发布时间】:2023-01-15 10:51:04
【问题描述】:

似乎 DataSpell 正在尝试执行此命令:C:\Windows\system32\wsl.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 之后的部分时,它起作用了。

【问题讨论】:

    标签: python jupyter-notebook windows-subsystem-for-linux dataspell


    【解决方案1】:

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

    因此,我相信您的问题可以用两种方式解读,我已经为每种方式提供了答案。

    服务器启动但无法连接

    当 DataSpell 启动本地基于 WSL 的 Jupyter 服务器时,它会对连接的工作方式做出某些假设,它还会使用 WSL 实例的 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. 在笔记本中运行一个单元,服务器应该自动启动并正常连接。

      以下问题是一个很好的资源:@​​987654323@

      使用 WSL 时服务器不启动

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

      不幸的是,如果没有更多信息,或者至少没有错误代码,就不可能给你一个明确的答案;但希望这能帮助您朝着正确的方向前进!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-03
      • 1970-01-01
      • 2017-09-15
      • 2019-09-18
      • 1970-01-01
      相关资源
      最近更新 更多