Skip to content

Jupyter Lab: go to def to dependencies not working #1045

@yangdanny97

Description

@yangdanny97

Describe the Bug

Repro:

  • pip install jupyterlab jupyter-lsp jupyterlab-lsp matplotlib
  • run jupyter lab & create a new notebook
  • verify that Pyrefly is running in the bottom left, and select Pyrefly if it's not automatically turned on
Image
  • add from matplotlib.ticker import MaxNLocator to the first cell
  • put cursor on MaxNLocator, right click, go to def
  • server attempts to open pyplot.py but fails with 404

Logs

I wonder if the .lsp_symlink in the path is messing things up.

[E 2025-09-04 22:53:18.763 ServerApp] Uncaught exception GET /api/contents/.lsp_symlink/Users/dannyyang/Documents/Documents/GitHub/scratch/venv/lib/python3.12/site-packages/matplotlib/pyplot.py?type=file&content=1&hash=1&format=text&contentProviderId=undefined&1757040798753 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/contents/.lsp_symlink/Users/dannyyang/Documents/Documents/GitHub/scratch/venv/lib/python3.12/site-packages/matplotlib/pyplot.py?type=file&content=1&hash=1&format=text&contentProviderId=undefined&1757040798753', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/jupyter_server/services/contents/handlers.py", line 156, in get
        model = await ensure_async(
                ^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/jupyter_core/utils/__init__.py", line 197, in ensure_async
        result = await obj
                 ^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/jupyter_server/services/contents/filemanager.py", line 910, in get
        raise web.HTTPError(404, "No such file or directory: %s" % path)
    tornado.web.HTTPError: HTTP 404: Not Found (No such file or directory: .lsp_symlink/Users/dannyyang/Documents/Documents/GitHub/scratch/venv/lib/python3.12/site-packages/matplotlib/pyplot.py)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/tornado/web.py", line 1848, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/jupyter_server/auth/decorator.py", line 73, in inner
        return await out
               ^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/jupyter_server/services/contents/handlers.py", line 182, in get
        await self._finish_error(
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/jupyter_server/services/contents/handlers.py", line 114, in _finish_error
        self.write(message)
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/tornado/web.py", line 964, in write
        raise RuntimeError("Cannot write() after finish()")
    RuntimeError: Cannot write() after finish()

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions