-
Notifications
You must be signed in to change notification settings - Fork 293
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
VS Code not finding conda python interpreter & failing to open ipynb file #513
Comments
Thanks for the bug. Does it work if you delete the metadata from the notebook? The notebook opens fine for me. I'm guessing the conda environment referenced in the notebook is either corrupt or no longer available on your machine. |
Hi had what appears to be a similar issue. When I tried to run "Python: Create Python Interactive Window" in the command palette using a the python interpreter from a conda virtual environment I got this error message
The conda env I am using was created with the --prefix argument and so doesn't have a name, I wonder if that is the problem? I am running VS code on Mac OS 10.14.6 (screen shot of error attached) Do you think this is the same problem or a different one? UPDATE |
@Tony-Boksic, can you try deleting the metadata per Rich's comment above? We think this will resolve the issue. Thanks for the feedback! |
Thanks to both Rich and Greazer for your help. Deleting the metadata has resolved the issue. cheers! Here is the metadata from the corrupted file that I deleted. "metadata": { |
Hi again, many thanks for your help on this issue previously. The solution that you provided worked(for a while). Once, I deleted the metadata, the ipynb file opened just fine in VS Code. However, now I can now longer open the ipynb file. I get the same error as before: Command failed: C:/Users/Tony/anaconda3/Scripts/activate && conda activate base && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\Tony.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\pyvsc-run-isolated.py c:/Users/Tony/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/printEnvVariables.py I have tried with the 2020.10 version of the python extension in VS Code but I get the same error. Here is the ipynb file without the metadata Might there be a way of modifying the JSON file so as to open the file in VS Code? Many thanks for your help, Tony |
If this command is failing:
It's likely the notebook is specifying a kernel that doesn't exist or can't run on your machine. The root cause is not really the notebook being wrong, but that there's a kernel on your machine that isn't runnable. You can check them all by using |
Hi Rich, Thanks for getting back. I've got just the one Kernel available: C:\Users\Tony\anaconda3\share\jupyter\kernels\python3 As I have deleted the metadata from the ipynb file, it doesn't seem like the notebook is pointing to any specific kernel. Do I need to specify the above kernel in the JSON file? |
Sorry I may have misunderstood. I thought it wasn't working with the metadata in the notebook? Or is the metadata not in the notebook? If it's the latter, you may have a problem with the 'jupyter interpreter' being set to a non existent interpreter. You can verify this by picking the 'Select interpreter to start jupyter server'. If that fixes it, I should reopen this bug and change it to be about us using a non existent interpreter. |
Hi Rich, Thanks for taking the time to help. That has fixed it. You're correct that the jupyter interpreter was incorrectly set. I understand that it is confusing so I'll recap what has happened.
Command failed: C:/Users/Tony/anaconda3/Scripts/activate && conda activate base && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\Tony.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\pyvsc-run-isolated.py c:/Users/Tony/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/printEnvVariables.py As Rich indicated, by selecting the correct jupyter interpreter, this resolved the issue. cheers, Tony |
Thanks Tony. I think I'm going to open another issue that makes sure we verify the jupyter intepreter before attempting to use it. |
Bug: VS Code not finding conda python interpreter & failing to open ipynb file
Steps to cause the bug to occur
Actual behavior
The ipynb file fails to open and returns the following error message:
Command failed: C:/Users/Tony/anaconda3/Scripts/activate && conda activate base && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\Tony.vscode\extensions\ms-python.python-2020.9.112786\pythonFiles\pyvsc-run-isolated.py c:/Users/Tony/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/printEnvVariables.py
Source: Python(Extension)
VS Code fails to find the conda python interpreter and the kernel is not found.
From the Developer Tools Console Output below, it looks like the corrupted file is pointing to the MYSQL Workbench python interpreter.
Expected behavior
I can no longer open the attached ipynb file in a VS-Code jupyter notebook. I have a problem with this one particular file as my other files open without a problem. I think that the problem comes from an error in the metadata as the metadata in this file looks very different to the metadata structure of the other files that successfully open.
This file used to open without any glitch in the past but now when I try to open the file, I see the above error.
I have pasted below the metadata information from a ipynb that opens successfully. The corrupted file used to open just like all my other files but recently it has produced this bug and I'm wondering how I can alter the metadata of the corrupted file in order to successfully open the file in a VS Code jupyter notebook.
Jupyter and/or Python environment
##Developer Tools Console Output
notificationsAlerts.ts:40
Command failed: C:/Users/Tony/anaconda3/Scripts/activate && conda activate base && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\Tony.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\pyvsc-run-isolated.py c:/Users/Tony/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/printEnvVariables.py
onDidChangeNotification @ notificationsAlerts.ts:25
DevTools failed to load SourceMap: Could not load content for file:///C:/Users/Tony/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/semver-umd.js.map:
DevTools failed to load SourceMap: Could not load content for file:///C:/Users/Tony/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/tas-client-umd.js.map:
DevTools failed to load SourceMap: Could not load content for file:///C:/Users/Tony/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/main.js.map:
Corrupted IPYNB file
Corrupted_file.txt
Metadata of IPYNB file that opens successfully in VS Code
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.3 64-bit ('base': conda)",
"language": "python",
"name": "python_defaultSpec_1597947257101"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3-final"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
The text was updated successfully, but these errors were encountered: