Closed bigrat911 closed 3 years ago
I did not install conda and I solved this problem by following steps.
> python:select interpreter to start jupyter server
I solve this problem by install vscode on Anaconda Navigator. Previously, I install vscode from the official site.
Hi @bigrat911 in my case I had similar issue with Jupyter server and it worked well by doing: 1º Start new .ipynd notebook in Vs 2º Ctrl+shift + P >> Python: Specify local or remote server for connections 3º Default 4º Run some code.
Basically I changed the server and worked well.
Hope this will be helpfull.
This solved the problem for me.
This bug might be related to this: https://discourse.jupyter.org/t/jupyter-core-4-6-2-release-with-insure-mode-option/3300
You could try setting the JUPYTER_ALLOW_INSECURE_WRITES variable globally (or in whatever you start VS code from) to see if the problem goes away
This happened to me on VS code WSL and took me a while to figure it out. Thanks for the tip.
To provide more context, after closing VSCode, I had to edit the environment
file using sudo -H vim /etc/environment
and add the following line after the last line: JUPYTER_ALLOW_INSECURE_WRITES =1
.
Then on Windows PowerShell, I shutdown WSL using wsl --shutdown
, and after running VSCode again, Jupyter started working.
Making sure that VS Code setting
"python.condaPath": "C:\\Program Files\\miniconda3\\Scripts\\conda.exe"
is pointing to the correct directory solved it for me
I am struggling with this too and I have no idea what the heck to even start with.
I did note this though when I toggled back and forth between local and remote and nothing works the remote line changed to: https://hostname:8080/?token=849d61a414abafab97bc4aab1f3547755ddc232c2b8cb7fe
Is "hostname" right because I didn't put that there. vscode-python did.
@jrounds, you shouldn't need to pick remote unless you're running a jupyter sever yourself. In that case you would replace hostname with the dns name or ip address of your remote server.
The default option should be enough though.
To be clear neither option is working. default. my own local. remote. None of them are connecting and I verified the start jupyter with parameters arecorrect.
What I was pointing out was something populated that remotestring like that and it wasnt me, and whatever did populate it I hope that process knows what hostname is.
e.g. I tried managed local it doesnt work. local never appears in the jupyter connection after a restart. e.g. I tried starting my own server. Which works fine for everything else. vscode april doesnt connect to it.
I did note after trying managed local and then switching to try to type in a new remote that vscode-python had put that string in there.
For example, that access key, that wasnt one of mine. None of my started servers and remote entries had that key. That "hostname", that wasnt one of mine. That says to me somewhere in the vscode-python extension there is a function that has put together a connection string involving the impossible "hostname" and an api-key and it got into the remote connection box. Whether I care about that I dont know, but given that nothing involving jupyter notebook and vscode currently works for me... everything is suspicious.
On Fri, Jun 5, 2020 at 12:55 PM Rich Chiodo notifications@github.com wrote:
@jrounds https://github.com/jrounds, you shouldn't need to pick remote unless you're running a jupyter sever yourself. In that case you would replace hostname with the dns name or ip address of your remote server.
The default option should be enough though.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-python/issues/9636#issuecomment-639760559, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSJZIYHELAJQKMGV24PNLRVFEUPANCNFSM4KIHO5GA .
I figured out how to use the dev tools console log and it reports it is trying to connect to the wrong server URI.
Step 1
I ctrl+shift+P and change the remote URL to this. This is one of mine
(local to the machine but in the remote URL box) and it is running.
http://127.0.0.1:8890/?token=57e963c7d222
Step 2: I restart
Step 3: I try to run a block in a python notebook and it logs as:
notificationsAlerts.ts:40 Failed to connect to remote Jupyter notebook.
Check that the Jupyter Server URI setting has a valid running server
specified. http://localhost:8889/ TypeError: request to
http://localhost:8889/api/contents/?1591389625739 failed, reason: connect
ECONNREFUSED 127.0.0.1:8889
console.ts:137 [Extension Host] Error Python Extension: 2020-06-05
13:40:25: DataScience Error [i [Error]: at new i
(/Users/roun308/.vscode/extensions/ms-python.python-2020.5.80290/out/client/extension.js:1:480683)
at
/Users/roun308/.vscode/extensions/ms-python.python-2020.5.80290/out/client/extension.js:16:586710
at processTicksAndRejections
(internal/process/task_queues.js:85:5)FetchError: request to
http://localhost:8889/api/contents/?1591389625739 failed, reason: connect
ECONNREFUSED 127.0.0.1:8889 at ClientRequest.
Why the wrong port?
On Fri, Jun 5, 2020 at 1:24 PM jeremiah rounds roundsjeremiah@gmail.com wrote:
To be clear neither option is working. default. my own local. remote. None of them are connecting and I verified the start jupyter with parameters arecorrect.
What I was pointing out was something populated that remotestring like that and it wasnt me, and whatever did populate it I hope that process knows what hostname is.
e.g. I tried managed local it doesnt work. local never appears in the jupyter connection after a restart. e.g. I tried starting my own server. Which works fine for everything else. vscode april doesnt connect to it.
I did note after trying managed local and then switching to try to type in a new remote that vscode-python had put that string in there.
For example, that access key, that wasnt one of mine. None of my started servers and remote entries had that key. That "hostname", that wasnt one of mine. That says to me somewhere in the vscode-python extension there is a function that has put together a connection string involving the impossible "hostname" and an api-key and it got into the remote connection box. Whether I care about that I dont know, but given that nothing involving jupyter notebook and vscode currently works for me... everything is suspicious.
On Fri, Jun 5, 2020 at 12:55 PM Rich Chiodo notifications@github.com wrote:
@jrounds https://github.com/jrounds, you shouldn't need to pick remote unless you're running a jupyter sever yourself. In that case you would replace hostname with the dns name or ip address of your remote server.
The default option should be enough though.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-python/issues/9636#issuecomment-639760559, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSJZIYHELAJQKMGV24PNLRVFEUPANCNFSM4KIHO5GA .
Can you post your entire console log? (Help | Toggle Developer Tools, click on the console tab, right click, save as, drag into github). That should give me an idea of what's going wrong.
If you can run it locally, then picking 'Default' on this screen should work:
The https://hostname:8080/?token=849d61a414abafab97bc4aab1f3547755ddc232c2b8cb7fe
is supposed to serve as an example of what you should type in.
The default doesn't work.
e.g. Step microsoft/vscode-python#1 Change to Default as you said
Step microsoft/vscode-python#2 Restart
Step microsoft/vscode-python#3 Try to run a code block from a python notebook.
Result errors. Attached log.
Thanks for your help.
Version info is:
Version: 1.44.2
Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
Date: 2020-04-16T17:07:18.473Z (1 mo ago)
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 18.7.0
Unfortunately, I had tried using old versions about an hour ago and forgot I was still running the March version when I did as you suggested.
Need the newest version log? It has been doing the same thing.
On Fri, Jun 5, 2020 at 2:00 PM Rich Chiodo notifications@github.com wrote:
Can you post your entire console log? (Help | Toggle Developer Tools, click on the console tab, right click, save as, drag into github). That should give me an idea of what's going wrong.
If you can run it locally, the picking default on this screen should work: [image: image] https://user-images.githubusercontent.com/19672699/83922087-9c430f80-a734-11ea-978e-d7b3a16569cb.png
The https://hostname:8080/?token=849d61a414abafab97bc4aab1f3547755ddc232c2b8cb7fe is supposed to server as an example of what you should type in.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-python/issues/9636#issuecomment-639815030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSJZMYXZSB4WLSOF4MBWTRVFMGTANCNFSM4KIHO5GA .
I don't see your log.
Sorry I replied by email and thought it would attach. Here it is (I may need to reformat):
That log says this:
Failed to connect to remote Jupyter notebook.
And it looks like your URI is set to http://localhost:8889
Are you sure you picked default? Perhaps this is an old log?
To make sure, open the settings ui and check the 'jupyter server uri' setting. Like so:
Both your global and your workspace should just say local
with no http://
in front of it.
Pretty sure this is the right log file. Only log file I ever made that I cut into another file to edit out identifiers.
If we add up what you just said and what I claimed earlier that the log said it was not using the right remote port they work out to this: Some how it is launching with stale info not represented in the UI.
Is there a way to clean anything that might be cached anywhere?
Incidently I had another data point that points to stale info. When I noticed the remote log was ignoring the port I put into the vscode UI remote URL, I went and set up a jupyter server at the port vscode-python was actually logging as using. That started logging events on the jupyter side but the jupyter server said vscode-python was using bad URLs.
Hmm. Well you might start with updating VS code. It's a bit out of date (should be on 1.45.1 right now).
Then uninstall and reinstall the python extension (reloading VS code in between each). Not sure how the setting would be coming out wrong. You can check the settings.json too (the UI should just be reading the settings.json, which is what we read to get the setting).
The newer version is my actual install in applications. I did the uninstall/restart of vscode-python. This what is in my User settings json looks like
{
"telemetry.enableTelemetry": false,
"workbench.colorTheme": "Default Light+",
"python.linting.pylintCategorySeverity.convention": "Warning",
"python.linting.pylintCategorySeverity.error": "Error",
"python.linting.mypyCategorySeverity.note": "Warning",
"python.linting.pycodestyleCategorySeverity.W": "Error",
"workbench.colorCustomizations": {
"activityBar.background": "#00AA00",
"editorError.foreground": "#ff0000",
"editorError.border": "#ff0000",
"editorWarning.foreground": "#e49638"
},
"python.linting.pylintCategorySeverity.refactor": "Error",
"files.autoSaveDelay": 100,
"files.autoSave": "afterDelay",
"editor.tabCompletion": "on",
"editor.detectIndentation": false,
"editor.formatOnPaste": false,
"terminal.integrated.scrollback": 10000,
"editor.useTabStops": false,
"terminal.external.osxExec": "/bin/bash",
"terminal.integrated.shell.osx": "/bin/bash",
"terminal.integrated.shellArgs.osx": ["-l"],
"terminal.explorerKind": "integrated",
"workbench.iconTheme": "material-icon-theme",
"python.linting.pylintUseMinimalCheckers": false,
"python.analysis.diagnosticPublishDelay": 10,
"python.linting.pylintCategorySeverity.warning": "Error",
"python.linting.pylintArgs": [
"--disable=using-constant-test,logging-not-lazy,invalid-name,trailing-whitespace,mixed-indentation,bad-whitespace,line-too-long,redefined-outer-name"
],
"editor.renderWhitespace": "all",
"editor.trimAutoWhitespace": false,
"python.dataScience.sendSelectionToInteractiveWindow": true,
"terminal.integrated.env.osx": {
"PATH": ""
},
"terminal.integrated.inheritEnv": false,
"window.zoomLevel": -1,
"workbench.tree.indent": 30,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"python.jediEnabled": false,
"terminal.integrated.rendererType": "experimentalWebgl",
"r.bracketedPaste": false,
"python.condaPath":"/Users/USERNAME/anaconda3/condabin/conda"
}
It occurs to me I don't know how that json file stays up to date as new versions of things roll in. That particular one user settings.json is over a year old now.
Fixed it.
Your comments got me thinking about settings so I started sniffing around .vscode folders.
Inside my project directory was a settings.json as:
{
"python.pythonPath": "/Users/USERNAME/anaconda3/envs/m2/bin/python",
"python.dataScience.jupyterServerURI": "http://localhost:8889/?token=7f88c4411629ad42dc415750c8546ef525852090b2f6050b"
}
I deleted the python.dataScience.jupyterServerURI line, restarted and vscode-python took over from there and "local" works again.
I have seen all possible solutions but not work, finally I just upgrade jupyter,notebook,and jupyterlab,like pip3 install -U jupyterlab
, and I can choose the kernel in VScode!
Same issue, but with a solution. I am on
The proximate cause of the problem was an attempt to install a new library (actually pysyft). As far as I can see, this pysyft installation messed up some of the Jupyter dependencies, specificaly messing up the version of tornado (pysyft requires one version, Jupyter requires another, etc).
Here is what solved it for me:
py -m uninstall jupyter
After that everything ran as supposed to (except pysyft, which no longer has the version that it needs).
I hope this helps others. It seems the basic issue is - as you install new things - version dependencies may be different for different projects.
Advice to the vscode-python team: Try installing e.g. pysyft and see its dependencies on tornado and jupyter; verify that with these specific versions - the vscode "data science" functionality does work well (or at least document the requirement mismatch)
Cheers!
Making sure that VS Code setting
"python.condaPath": "C:\\Program Files\\miniconda3\\Scripts\\conda.exe"
is pointing to the correct directory solved it for me
I removed the conda path option and that worked
Fixed it.
Your comments got me thinking about settings so I started sniffing around .vscode folders.
Inside my project directory was a settings.json as:
{ "python.pythonPath": "/Users/USERNAME/anaconda3/envs/m2/bin/python", "python.dataScience.jupyterServerURI": "http://localhost:8889/?token=7f88c4411629ad42dc415750c8546ef525852090b2f6050b" }
I deleted the python.dataScience.jupyterServerURI line, restarted and vscode-python took over from there and "local" works again.
similar to @jrounds solutions, commenting out my python.condaPath
in the setting.json, restarted, and it fixed it for me.
However, for me, the issue came when I started to used the new Settings Sync extension which I believe in the process mess up some file paths in the settings between devices. It's a useful extension when commonly switching between devices but it doesn't come without pain.
Is anyone still running into these issues in the latest version of VS Code & Jupyter extension?
@DonJayamanne Nope.
@janosh thanks for getting back, sorry this didn't get much attention, we've been regularly working on kernel related issues and I'd like to ensure we have a great handle on all of those issues and I'm trying to clean them up. You can see that here https://github.com/microsoft/vscode-jupyter/issues/7901
I'm going to close this for now, thanks again
sorry this didn't get much attention
No complaints from me. Everything Python-related in VS Code been running very smoothly for a while now. Thanks for all your work! 👍
Bug: Notebook Editor, Interactive Window, Editor cells
Steps to cause the bug to occur
Actual behavior
Jupyter Server: No Kernel Python: Not Started Error: [Errno 13] Permission denied: '/Users/XXXXX/Library/Jupyter/kernels/python37364bitbasecondac02285ab1a5b43e69345d43980645608' Perhaps you want
sudo
or--user
?Expected behavior
Jupyter Server worked well
Your Jupyter and/or Python environment
Please provide as much info as you readily know
Developer Tools Console Output
Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer