Python autocomplete doesnt work on notebook
Type: Bug
get into a notebook
case 1: type import no package can be found
case 2: type "pri" "print" is not shown in suggestions.
VS Code version: Positron 1.90.0 (9f24124be55ef409fb6b6c75ee80232f298cd56b, 2024-07-12T03:18:15.685Z) OS version: Windows_NT x64 10.0.22621 Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz (8 x 2400) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
| Load (avg) | undefined |
| Memory (System) | 15.86GB (6.41GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
I can't reproduce on a mac. Can anyone on Windows reproduce?
I can't reproduce this issue in Positron on Windows with a basic Notebook using Python 3.11.6 as the kernel.
It is possible the language runtime stopped somehow and thus a kernel and LSP are not available to the notebook? To see if you have a kernel, you could declare a variable and assign it a value. After executing the cell, if the variable shows up in the Variables pane for that notebook's runtime, at least the kernel is running.
Beyond that, we'd need to look at the relevant python runtime related channels for the notebook in the Output tab of the Panel to see if there are any hints as to what happened.
I think I reproduced..
Left is the jupyter noteook file which I created before using Positron Right is the jupyter notebook file which I created using Positron.
As you see, both notebook using same python environment.
I think I successfully reproduced, even though I didn't want to.....
I saved jupyter notebook on the right ( I mentioned above... that had not been not saved)
Now code suggestion is gone...
Spec: Windows11 python 3.8.13 Positron-2024.07.0-52
I attached my python environment yaml file. yamlfile.zip
same here - autocomplee works in python .py file but not in jupyter notebook .ipynb
Hmmmm, if you are experiencing this problem, could you go to "Output" and choose the channel for your notebook? It will look something like this:
Could you save that log and attach it as a file to a comment here? We're especially interested in what these notebook logs say about the LSP server. Mine, with working autocomplete, says near the beginning:
[Positron] Starting Positron LSP server on port 46057
[Positron] Starting LSP server positron-lsp-python-2-8f657d76 for 127.0.0.1:46057
[Positron] Creating 'positron.lsp' client for Python
[Positron] SEND comm_open to Shell: {"buffers":[],"content":{"target_name":"positron.lsp","comm_id":"positron-lsp-python-2-8f657d76","data":{"client_address":"127.0.0.1:46057"}},"header":{"msg_id":"72634796-6f97-403d-be0d-3ca5d4ae185a","msg_type":"comm_open","version":"5.0","date":"2024-07-17T21:46:39.365Z","session":"5dc885ad16f7276fa0abd509a20e03a6","username":"juliasilge"},"metadata":{},"parent_header":{}}
Thanks for sharing the logs! I can't see anything suspicious from those. Could you please try updating the python.languageServerLogLevel setting to debug and sharing the logs if it fails again? Note that you will have to wait for it to happen again since the log level will only be set for future sessions.
Thanks for sharing the logs! I can't see anything suspicious from those. Could you please try updating the
python.languageServerLogLevelsetting todebugand sharing the logs if it fails again? Note that you will have to wait for it to happen again since the log level will only be set for future sessions.
I'm sorry, Could you please show me how to do it? I'm so new to this IDE that I don't know how to set.
If you could let me know how, then I would share the whole logs again. Sad to say, it's very easy for me to reproduce...
edit>>
is it right setting?
I think I reproduced again.
this is the log Output_Log3.txt
Thanks! You will also need to close and reopen Positron, since I see in the logs that it hasn't taken effect yet i.e. --loglevel error.
I hope that any suspicious parts are found in this log. If there's anything additional you would like me to try, please let me know. I will try and upload the log again.
Thank you for sharing the log! I can't figure out how to reproduce the issue from the logs, but there are clues:
- So far we've only seen this reported on Windows.
- The LSP server successfully starts, accepts the connection from the editor, initializes, and receives a
workspace/didChangeConfigurationmessage. - No
textDocument/didOpenLSP messages are received. On my laptop, I see onetextDocument/didOpenmessage for each cell in the notebook, and numeroustextDocument/didChangeas I type. This makes me think that the problem is on the client side.
Could you please also share the log file for the "Python" output channel? You can run the "Output: Show Output Channels..." command and then select "Python".
Log_Console.txt Log_Notebook.txt Log_Python.txt
Something different happened this time. Positron asked me to install ipykernel, and I accepted. (it was my first time to see this.) It was not helpful anyway. All the screenshots and the logfiles in this comment were made after installing ipykernel.
Thank you again @RayleighKim! I've created PR #4137 with a potential fix for this issue but have not yet been able to verify it on a Windows computer. We'll post follow-up messages here as the PR goes through verification.
Thank you.
To be honest, I'm not very familiar with GitHub(and opensource communication culture..), so I might have ignored many guidelines/rules of writing issue comment. Even so, thank you for guiding me on exactly what I need to do. If there's anything else that needs to be checked or tested, please let me know.
I am noticing the same issue in Quarto markdown with R code in Windows. I searched and landed on this issue. I think this is being actively worked on but I am sharing screenshots in case they help. Let me know if sharing any logs would help.
Autocomplete in question is for a variable that exists in the current session environment. Console works but editor doesn't.
@piyuranjan That is a pretty different problem, I believe. Do you mind opening a new issue with your details? If you are able to recreate the problem with a pretty minimal Quarto file (i.e. short) and latest Positron build that would be super helpful.
@juliasilge, thank you for responding! You are correct that this is a different problem. I was able to get to the source when I was trying to create a minimal example. The issue is caused when a code block is inside a callout and they both end at adjacent lines (without an extra new line between them). This causes the autocomplete/intellisense in Positron to completely stop after it has happened in the markdown. I am unsure if this is a Positron or Quarto issue. Let me know if I should open a new issue with Positron. I couldn't find any mentions of this with Quarto as well. Edit: I should also add that Quarto's visual editing is taking the empty lines out. So adjacent code-callout begin/ends are expected.
@piyuranjan That is a a Quarto VS Code extension issue, and especially the problem where the visual editor takes out the empty line (I predict they will say it is normal to need the extra line). Can you open an issue outlining your problem there? https://github.com/quarto-dev/quarto/issues
Verified Fixed
Positron Version(s) : ?
OS Version : Windows
Test scenario(s)
Marking as verified based on Pete's note on the PR.
Link(s) to TestRail test cases run or created: N/A
Thank you all for fix.
I want to know which version that I can use.
Hi @RayleighKim ,
Please try 2024.07.0-125 We verified this issue with a dev build but it should be fixed in 125.
Please let me know if you still see issues.
Thank you for your report!