python.languageServer setting: XXXName: Python
Id: ms-python.python
Description: Linting, Debugging (multi-threaded, remote), Intellisense, Jupyter Notebooks, code formatting, refactoring, unit tests, snippets, and more.
Version: 2020.8.101144
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.python
[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance) from the VS Code marketplace to see if that fixes your issue]
Being able to use the step-through debugger.
Any import of numpy results in an import Error. However, if the script is run from the terminal, this numpy import error does not occur. In other words, the issue is specific to the VS Code Python Debugger.
Exception has occurred: ImportError
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.7 from "C:\Users\potassium\Miniconda3\envs\test_numpy37\python.exe"
* The NumPy version is: "1.18.5"
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
import numpy will trigger the error when a Python module is executed with "Start Debugging".
I tried numpy 1.18.5 and 1.19. I reinstalled VS Code and Miniconda. Problem still remains. I didn't have this issue before.
Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
XXX
We just want to quickly acknowledge that we have received the issue and will be looking into it soon.
Thanks @karrtikr appreciate it. Shout if you need more info from my end.
It looks like the code is not running within an activated conda environment when debugging it. Can you try this?
cd to your workspace.conda activatecode .related #10626
hi @karrtikr I followed your instructions and the debugger works when I use the Anaconda Prompt to launch code.
Thanks I can work with this. Is this the a temporary workaround or are you still figuring out another way to address this more permanently?
Great, conda activation is a tricky one to get right for us, but we have plans to fix it, until then please use the workaround. Closing in favor of https://github.com/microsoft/vscode-python/issues/5344
Most helpful comment
hi @karrtikr I followed your instructions and the debugger works when I use the Anaconda Prompt to launch
code.