Skip to content
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

Test jupyter kernel completions in web #10166

Closed
2 tasks done
rchiodo opened this issue May 27, 2022 · 18 comments
Closed
2 tasks done

Test jupyter kernel completions in web #10166

rchiodo opened this issue May 27, 2022 · 18 comments

Comments

@rchiodo
Copy link
Contributor

rchiodo commented May 27, 2022

Testing the jupyter web extension providing completions when typing in a notebook.

Refs: #9977

Complexity: 3

Authors: @rchiodo

Create Issue


Requirements

Pre test steps

  1. Go to a command prompt
  2. Activate the python environment with jupyter in it
  3. Run jupyter with the following command line : jupyter notebook --no-browser --NotebookApp.allow_origin=*
  4. Note the URL it generates for connecting
  5. Start insiders.vscode.dev
  6. Make sure Jupyter prerelease extension is installed
  7. Bring up command palette
  8. Pick 'Jupyter: Specify jupyter server for connections'
  9. Pick 'Existing'
  10. Enter the URL from step 4

Test kernel completions

  1. Open a new notebook
  2. Pick the 'Python 3' kernel
  3. Add some code
  4. Run a cell
  5. Create a new cell with 'import pandas as pd'
  6. On the next line, type 'pd.'
  7. Verify that you get completions for pandas
  8. Try loading a CSV file in pandas (or create a dataframe with columns)
  9. Verify that you can get 'column' completions. For example, if you create a dataframe named df, typing df. should list the columsn of the dataframe.
@rchiodo rchiodo added the bug Issue identified by VS Code Team member as probable bug label May 27, 2022
@github-actions github-actions bot added the triage-needed Issue needs to be triaged label May 27, 2022
@rchiodo rchiodo added testplan-item and removed bug Issue identified by VS Code Team member as probable bug labels May 27, 2022
@ghost ghost assigned isidorn and rzhao271 May 31, 2022
@isidorn
Copy link

isidorn commented May 31, 2022

Sorry but I am not a notebook expert and I hit some issues.

In step 3 I get the following error

Screenshot 2022-05-31 at 10 52 16

If I remove the last argument I can get something running by

python -m notebook --no-browser

That prints out a URL which when I paste in the vscode.dev can not connect

Screenshot 2022-05-31 at 10 53 59

What am I doing wrong? Thanks!

@rchiodo
Copy link
Contributor Author

rchiodo commented May 31, 2022

Your version of jupyter may not support that command line. Try running python -m jupyter notebook --help-all and see what it prints out.

You do need the allow_origin setting or it won't work. I know they are moving that to a --ServerApp.allow_origin but that should print out a warning message? I get this:

[W 2022-05-31 09:22:57.678 LabApp] 'allow_origin' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.

@isidorn
Copy link

isidorn commented May 31, 2022

Thanks for your reply. I just installed the jupyter version today, so I thought it is up to date. Here's what I get as output

Screenshot 2022-05-31 at 19 06 13

@rchiodo
Copy link
Contributor Author

rchiodo commented May 31, 2022

It looks like you don't have full jupyter installed. Or your environment is not the same as the one you used before. It's not finding notebook either, nevermind the option required.

How did you install it? What version of python is this?

@rzhao271 rzhao271 removed their assignment May 31, 2022
@rzhao271 rzhao271 removed the triage-needed Issue needs to be triaged label May 31, 2022
@rzhao271 rzhao271 added this to the May 2022 milestone May 31, 2022
@rzhao271
Copy link
Contributor

rzhao271 commented May 31, 2022

LGTM. For the completions, I had to first run the cell, and then I got completions, but I was working in an untitled notebook.

For the environment, I set up a new venv environment, activated it, and then installed a bunch of libraries. On Windows, I ran the following commands in a new folder specifically for this issue:

python -m venv .venv
.\.venv\Scripts\activate
python -m pip install jupyterlab notebook voila pandas

I then ran the step 3 jupyter command as-is.

@rchiodo
Copy link
Contributor Author

rchiodo commented May 31, 2022

Yes the completions here only work after running a cell. They require an active kernel.

@isidorn
Copy link

isidorn commented Jun 1, 2022

@rchiodo I just followed the steps @rzhao271 provided and I still get the same error. So here are the exact steps

python -m venv .venv
source .venv/Scripts/activate
python -m pip install jupyterlab notebook voila pandas
jupyter notebook --no-browser --NotebookApp.allow_origin=*

And I get the error from yesterday
"zsh: no matches found: --NotebookApp.allow_origin=*"

Let me try to swap with somebody for a test plan item...

@rchiodo
Copy link
Contributor Author

rchiodo commented Jun 1, 2022

Maybe your version of python is 2.7. It's no longer supported but is the default on Mac I think.

@isidorn
Copy link

isidorn commented Jun 1, 2022

When I do python --version in the terminal it says
Python 3.8.9
python -m also points to python version 3

@rchiodo
Copy link
Contributor Author

rchiodo commented Jun 1, 2022

What about this?
python -m notebook --version

@rchiodo
Copy link
Contributor Author

rchiodo commented Jun 1, 2022

Maybe jupyter-notebook is somewhere else on the path. What does which jupyter-notebook give you? For me it's in the environment I'm running.

@isidorn
Copy link

isidorn commented Jun 1, 2022

python -m notebook --version
gives 6.4.11

which jupyter-notebook reveals the actual issue, he does not find it jupyter-notebook not found.

I wonder what I did wrong in the installation...

@rchiodo
Copy link
Contributor Author

rchiodo commented Jun 1, 2022

Oh maybe it was installing jupyterlab. That doesn't have jupyter notebook as part of it. Usually I install just plain 'jupyter' and that pulls in a whole bunch of stuff.

@isidorn
Copy link

isidorn commented Jun 2, 2022

Ok I have fixed jupyter-notebook, so now that works

➜  vscode git:(isidorn/grotesque-panda) ✗ which jupyter-notebook
/Users/isidor/.pyenv/shims/jupyter-notebook

However running jupyter notebook --no-browser --NotebookApp.allow_origin=* still produces
zsh: no matches found: --NotebookApp.allow_origin=*

@rchiodo
Copy link
Contributor Author

rchiodo commented Jun 2, 2022

Okay super weird. Wait, you're using .pyenv? That's not likely the matching/correct jupyter. Certainly not the same one you showed before.

@isidorn
Copy link

isidorn commented Jun 2, 2022

Yes, I started using .pyenv out of desperation because I could not get things to work.
Now that I have it, at least jupyter notebook command seems to work

@rchiodo
Copy link
Contributor Author

rchiodo commented Jun 2, 2022

We finally figured it out. For some reason on Isidor's machine, it needs this jupyter notebook --no-browser --NotebookApp.allow_origin='*'. Quotes around the * in the allow_origin.

@isidorn
Copy link

isidorn commented Jun 2, 2022

Thanks for all the help here, appreciate it.
I tested it and it works nicely.

@isidorn isidorn closed this as completed Jun 2, 2022
@isidorn isidorn removed their assignment Jun 2, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants