Reputation: 6870
import numpy
print "asdf"
When I try to debug/run the above Python code in Visual Studio Code I get the following error (Using OSX)
ImportError, cannot import name float96
What is the resolution ?
I have installed python from the python website. Tried to run after installing from brew too but no effect.
EDIT
The problem is with all imports for Visual Studio
Upvotes: 4
Views: 4603
Reputation: 5067
I had this issue because I had a conflicting install of Anaconda in the system that I was in the middle of removing. Once I cleaned up all vestiges of anaconda from my shell, it started working!
Upvotes: 1
Reputation: 6870
Re-insatlling python extension solved my issue. It was not a problem of configuration after all.
https://code.visualstudio.com/docs/languages/python_c
Tip: Don Jayamanne's Python extension gives you the option of using three different linters - Pylint, Pep8, and Flake8. See the wiki for more details.
Upvotes: 3
Reputation: 950
In my case, the problem was that vscode was using the python (v2) interpreter but I had installed the module using python3.
I fixed this modifying the launch.json file and specifying the pythonPath for python3, as explained here.
Upvotes: 5
Reputation: 6862
this is an issue with the debugger, in the manner in which it loads the modules and such import errors can be safely ignored. To ignore these errors, please go into the launch.json file and edit it as follows (to add the section to ignore the "ImportError"):
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"program": "${file}",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
],
"exceptionHandling": {
"ignore": ["ImportError"]
}
},
Upvotes: 4