microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.29k stars 292 forks source link

I cannot select a Python 3.8 virtual environment for Jupyter notebook that is running remotely via SSH plugin #8502

Closed monajalal closed 2 years ago

monajalal commented 2 years ago

Environment data


`$ uname -a
Linux ayan 4.15.0-162-generic #170-Ubuntu SMP Mon Oct 18 11:38:05 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux`

-   Python and/or Anaconda version: XXX

lrwxrwxrwx 1 root root 9 Oct 1 19:43 /SeaExp/mona/venv/dpcc/bin/python -> python3.8

$ /SeaExp/mona/venv/dpcc/bin/python Python 3.8.0 (default, Feb 25 2021, 22:10:10) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

-   Type of virtual environment used (N/A | venv | virtualenv | conda | ...): XXX
venv (but it doesn't even allow to select it via pressing enter)
-   Jupyter server running: Local | Remote | N/A
remote via the SSH extension
<img width="1023" alt="Screen Shot 2021-12-09 at 2 02 42 AM" src="https://user-images.githubusercontent.com/1892917/145349513-e3c9f63f-2502-4b73-bbe5-d0478dca1b54.png">

<img width="1167" alt="Screen Shot 2021-12-09 at 1 35 19 AM" src="https://user-images.githubusercontent.com/1892917/145348254-f273f852-767a-47fa-83b6-be7a974616ca.png">

^ When I press enter here in above image, nothing happens for change kernel. It keeps using Python 2.
<img width="1168" alt="Screen Shot 2021-12-09 at 1 35 00 AM" src="https://user-images.githubusercontent.com/1892917/145348351-841db9c6-b1ba-44c7-a646-e81b9d71a535.png">
^ I tried activating the virt env inside the Jupyter but no luck obviously.

## Expected behaviour
To be able to use my own virt env /SeaExp/mona/venv/dpcc/bin/python here for running Jupyter ( I have no problem doing this for normal Python scripts inside VSCode remote)

## Actual behaviour

Keeps using Python 2 for Jupyter ipynb notebooks.

## Steps to reproduce:

[**NOTE**: Self-contained, minimal reproducing code samples are **extremely** helpful and will expedite addressing your issue]

1. XXX

<!--
Note: If you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ .
-->

## Logs

<details>

<summary>Output for <code>Jupyter</code> in the <code>Output</code> panel (<code>View</code>→<code>Output</code>, change the drop-down the upper-right of the <code>Output</code> panel to <code>Jupyter</code>)
</summary>

<p>

XXX



</p>
</details>

as you can see, I have no problem activating or using this Python Virtual Environment inside VSCode for running normal .py scripts.
<img width="1002" alt="Screen Shot 2021-12-09 at 2 04 56 AM" src="https://user-images.githubusercontent.com/1892917/145349857-06ef6421-774f-4a90-89d2-92cdc5133693.png">
IanMatthewHuff commented 2 years ago

@monajalal Thanks for the detailed report. If you could, could you please pull the logs from the "Jupyter" output panel when you open the ipynb when connected via SSH. Those logs would be the best first step that I could help with debugging here.

IanMatthewHuff commented 2 years ago

I did just notice as well that you seem to be on older versions of VSCode and our extension. If you could please update to the newest versions before you repro that would be very helpful.

monajalal commented 2 years ago

Thank you. Now, it works :)

Screen Shot 2021-12-09 at 8 11 39 PM Screen Shot 2021-12-09 at 8 12 22 PM
IanMatthewHuff commented 2 years ago

Awesome, glad that it's working for you now.

monajalal commented 2 years ago

Hi @IanMatthewHuff I have the same exact problem in VSCode in a new machine we recently purchased that I am connecting remotely to.

So, I basically installed the latest version of VSCode and similarly, the latest version of all the related extensions. Yet, when I click on the "gear" icon, it is not responsive, hence I cannot select my own native Python virtual environment. Also, when I paste the path of my virt env and press "Enter" nothing happens.

Could you please advise what would be a solution in this case? Screen Shot 2022-01-20 at 7 49 17 PM Screen Shot 2022-01-20 at 7 49 35 PM Screen Shot 2022-01-20 at 7 49 58 PM Screen Shot 2022-01-20 at 7 50 07 PM Screen Shot 2022-01-20 at 7 50 24 PM Screen Shot 2022-01-20 at 7 50 37 PM

Screen Shot 2022-01-20 at 8 31 52 PM

IanMatthewHuff commented 2 years ago

@monajalal That control actually can't accept just a path input. When working with python the dropdown selection should show all the possible options, which would be all the Jupyter kernels and Python environments that we detect on that machine.

When you mention your own native python environments do you mean on your machine? If you connect remotely you should just be seeing the python environments installed on that remote box that you are connected to.

monajalal commented 2 years ago

@IanMatthewHuff no this /home/jalal/research/venv/dpcc/bin/python is installed in the remote machine echo.bumc.bu.edu why can't it detect it now while it previously could detect a similar virtual Python env in a remote machine?

monajalal commented 2 years ago

solved, had to initially set the interpreter from the command pallet and then select it in the notebook. Screen Shot 2022-01-20 at 9 00 18 PM Screen Shot 2022-01-20 at 9 00 28 PM Screen Shot 2022-01-20 at 9 00 38 PM