-
Notifications
You must be signed in to change notification settings - Fork 6k
[Bug]: Ctrl+Click / Code Jump / Go To Definition Does Not Work Properly in Python/Jupyter Notebooks #6619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am using the same code-server configuration I used in #6323 and it appears to be working as expected by navigating to the correct package within the given conda environment. Confirm that you have selected the correct conda environment within the *.ipynb file. You may need to refresh the page once or twice to load the correct settings. Setup temporary environment...#!/bin/bash
TEST_DIR="$HOME/Documents/github/test"
conda create -n tmp -c conda-forge python=3.10 numpy diffusers -y
if [ ! -d "$TEST_DIR" ]; then
mkdir -p "$TEST_DIR"
fi
if [ ! -f "$TEST_DIR/test.ipynb" ]; then
touch "$TEST_DIR/test.ipynb"
fi conda-jedi-lsp.movBy default, Jedi should be able to work with conda environments. https://jedi.readthedocs.io/en/latest/docs/api.html |
Thanks a lot for your reply @OceanTrader1. I have a university machine allocated to me through SLURM system and I don't have sudo access to it and hence I'm limited in terms of software packages that I can install or settings I can actually change. To be specific, I installed code-server by this command:
I then just copy the ip of the remote machine and visit the URL Im sure I have selected the correct conda environment and I had refreshed multiple times and had also restarted the server many times but still same error, please refer below video: code_jump_not_working.movThese are the extension versions I'm using:
Jupyter
code-server:
Also my settings.json:
|
Yes. It is an HTTP/S issue. I am not able to open *.ipynb files at all on HTTP (blank screen area where file contents should be). For *.py files, I am having success setting the workspace environment to the conda environment using the jedi-over-http.movPython Environment Manager Extension...
|
Regarding not being able to open *.ipynb files, I use this hack which works if you use Google Chrome.
Since with this change we are able to open ipynb files in HTTP, this should not be the reason that Jedi LSP is not working correctly right? Btw I checked out python environment manager extension and it still didn't seem to work :( |
This is a non-answer but since the focus is towards Jupyter notebooks, Jupyter Lab might be a potential alternative that supports user installs, language servers, and runs over HTTP (and early AI code completion in the works). |
Thanks for sharing. I did explore jupyter lab earlier too, but it does not suit me well because I would like to use VS Code while working on my projects so I can make use of all the extensions available in VS Code which also includes Github Copilot that I often use a lot to help me with my projects and easily get the boilerplate code done. Thus, this project (code-server) seems to be the only useful way for me to use VS Code in my remote systems which are allocated to me through SLURM system [I can not use remote SSH feature of my local VS Code to access this SLURM based machines] |
The following trick method works for me:
Then go back to your python file, the code jump works well! Amazing! |
Closing since it looks like there is nothing to fix in code-server? Let me know if I got it wrong. |
I have the same question, and I found when I use the method above like: |
I found the solution!!! You can download the Pyright in vscode extensions market, it is the open source version for pylance。 Then you can see when you debug it can go to the right definition! |
Thanks for sharing, @zengziru. I'm sure it will be helpful for others who happen to come across this same issue/thread. |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
OS/Web Information
code-server --version
: 1.85.10b84523
x64
Steps to Reproduce
settings.json
, and add this line:"python.languageServer": "Jedi",
[following [Bug]: Hover feature does not work in Jupyter notebooks #6323]test.py
ortest.ipynb
, for example: [in activated or selected conda environment]Hover or Ctrl+Click on some libraries like torch and numpy above work, and they open the file located in
/apps/local/anaconda2023/lib/python3.11/site-packages/<library>
However, Hover/Ctrl+Click on
diffusers
does not work. I believe this is because my conda environment is stored in this location, anddiffusers
is available here:/home/rohit.bharadwaj/.conda/envs/learn_diffusion/lib/python3.11/site-packages/diffusers
How can I ensure that Jedi gets the library files from correct location?
My conda environment is called
learn_diffusion
, and when I set the python interpreter in the GUI, the location for it is shown as./conda/envs/learn_diffusion/bin/python
whereas location for
base
conda environment is:/apps/local/anaconda2023/bin/python
, So JEDI seems to be using thebase
conda env location for code jump? How to change it?Expected
Code Jump should work properly for all libraries in current conda environment and should route to proper location.
Actual
Hover/Ctrl+Click on
diffusers
does not work. I believe this is because my conda environment is stored in this location, and diffusers is available here:/home/rohit.bharadwaj/.conda/envs/learn_diffusion/lib/python3.11/site-packages/diffusers
Jedi server is looking for libraries in
/apps/local/anaconda2023/lib/python3.11/site-packages/<library>
My conda environment is called
learn_diffusion
, and when I set the python interpreter in the GUI, the location for it is shown as./conda/envs/learn_diffusion/bin/python
whereas location for
base
conda environment is:/apps/local/anaconda2023/bin/python
, So JEDI seems to be using thebase
conda env location for code jump? How to change it?Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
Are you accessing code-server over a secure context?
Notes
No response
The text was updated successfully, but these errors were encountered: