Closed rohit901 closed 5 months ago
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.
https://github.com/coder/code-server/assets/69881238/85400cd4-d8a1-4b1f-b8aa-64d00f6b345c
By 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. Its strange that its not working for me, is it because I'm not running in HTTPS?
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:
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method standalone
Then in my allocated remote machine through SLURM system, I run this to start the server:
.local/bin/code-server --bind-addr 0.0.0.0:10000
after running the server this is the output:
.local/bin/code-server --bind-addr 0.0.0.0:10000
[2024-01-04T16:41:31.950Z] info code-server 4.20.0 d0215eca8804d0be5d3551c39404e336032c3141
[2024-01-04T16:41:31.950Z] info Using user-data-dir /home/rohit.bharadwaj/.local/share/code-server
[2024-01-04T16:41:31.959Z] info Using config file /home/rohit.bharadwaj/.config/code-server/config.yaml
[2024-01-04T16:41:31.959Z] info HTTP server listening on http://0.0.0.0:10000/
[2024-01-04T16:41:31.959Z] info - Authentication is enabled
[2024-01-04T16:41:31.959Z] info - Using password from /home/rohit.bharadwaj/.config/code-server/config.yaml
[2024-01-04T16:41:31.959Z] info - Not serving HTTPS
[2024-01-04T16:41:31.959Z] info Session server listening on /home/rohit.bharadwaj/.local/share/code-server/code-server-ipc.sock
[20:41:34]
I then just copy the ip of the remote machine and visit the URL <ip>:10000/
on my local machine to access code server.
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:
https://github.com/coder/code-server/assets/30185369/3bed60bb-6ed2-427d-8850-634ca386ae77
These are the extension versions I'm using: Python
Name: Python
Id: ms-python.python
Description: IntelliSense (Pylance), Linting, Debugging (multi-threaded, remote), code formatting, refactoring, unit tests, and more.
Version: 2023.20.0
Publisher: ms-python
VS Marketplace Link: https://open-vsx.org/vscode/item?itemName=ms-python.python
Jupyter
Name: Jupyter
Id: ms-toolsai.jupyter
Description: Jupyter notebook support, interactive programming and computing that supports Intellisense, debugging and more.
Version: 2023.9.100
Publisher: ms-toolsai
VS Marketplace Link: https://open-vsx.org/vscode/item?itemName=ms-toolsai.jupyter
code-server:
code-server: v4.20.0
Code: 1.85.1
Commit: 0b84523121d6302fbe30eda7899ec3b81810748e
Date: 2023-12-18T20:21:20.879Z
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Also my settings.json:
{
"editor.fontSize": 16,
"debug.console.fontSize": 15,
"terminal.integrated.fontSize": 16,
"markdown.preview.fontSize": 17,
"notebook.output.fontSize": 17,
"workbench.colorTheme": "Default Dark Modern",
// Overrides colors
"workbench.colorCustomizations": {
"[Community Material Theme VARIANT]": {
"sideBar.background": "#ff0000",
}
},
// Overrides editor syntax colors and font style
"editor.tokenColorCustomizations": {
"[Community Material Theme VARIANT]": {
"comments": "#229977"
}
},
"editor.tokenColorCustomizations": {
"[Community Material Theme VARIANT]": {
"textMateRules": [
{
"scope": [
"punctuation.definition.comment",
"comment.block",
"comment.line",
"comment.block.documentation"
],
"settings": {
"foreground": "#FF0000"
}
}
]
},
},
// Controls the font family.
"editor.fontFamily": "Operator Mono",
// Controls the line height. Use 0 to compute the lineHeight from the fontSize.
"editor.lineHeight": 24,
// Enables font ligatures
"editor.fontLigatures": true,
// Controls if file decorations should use badges.
"explorer.decorations.badges": false,
"workbench.iconTheme": "material-icon-theme",
"files.autoSave": "off",
"github.copilot.enable": {
"*": true,
"plaintext": true,
"markdown": false,
"scminput": false,
"python": true
},
"python.languageServer": "Jedi",
"remote.autoForwardPortsSource": "hybrid",
}
is it because I'm not running in HTTPS?
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 Python Environment Manager
extension
https://github.com/coder/code-server/assets/69881238/bab2a402-3f5e-4852-9350-655881c16d04
```text Name: Python Environment Manager Id: donjayamanne.python-environment-manager Description: View and manage Python environments & packages. Version: 1.2.4 Publisher: donjayamanne VS Marketplace Link: https://open-vsx.org/vscode/item?itemName=donjayamanne.python-environment-manager ```
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).
Regarding not being able to open *.ipynb files, I use this hack which works if you use Google Chrome.
chrome://flags/#unsafely-treat-insecure-origin-as-secure
Insecure origins treated as secure
in that page, and in the input text box there, type this:
http://<ip_of_the_machine>:10000
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).
This is a non-answer but since the focus is towards Jupyter notebooks, Jupyter Lab might be a potential alternative that supports user installs and runs over HTTP.
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: Click "File -> New File..." at the top left corner menu bar Choose "Jupyter Notebook" to create a new blank jupyter notebook file I found the new file will be save to /opt/conda/lib....., but not the current workspace folder like:/workspace/my_user/project.... It seems like the code-server is in the system conda environment but not in the current python interpreter. How should we solve it?
This is a non-answer but since the focus is towards Jupyter notebooks, Jupyter Lab might be a potential alternative that supports user installs and runs over HTTP.
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]
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.
Is there an existing issue for this?
OS/Web Information
code-server --version
: 1.85.1 0b84523121d6302fbe30eda7899ec3b81810748e x64Steps to Reproduce
settings.json
, and add this line:"python.languageServer": "Jedi",
[following #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 forbase
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 forbase
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