question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VS Code Terminal Cannot Find Numpy. VS Code Interactive Can

See original GitHub issue

Issue Type: Bug

Running .py files which import numpy is no longer possible using ‘Run Python File in Terminal’. The same files can be run in the same environment using ‘Run Current File in Interactive Window’.

Attempting to run in Terminal generates

C:\Users\kbrady\Anaconda3\envs\py39\lib\site-packages\numpy\__init__.py:143: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init
Traceback (most recent call last):
  File "c:\Users\kbrady\Git Repos\Study-20SLE1\data\TDM\insert_duk_hcq.py", line 4, in <module>
    from exagentools.DatasetTools import ODBCSources
  File "C:\Users\kbrady\Anaconda3\envs\py39\lib\site-packages\exagentools\DatasetTools.py", line 1, in <module>
    import pandas as pd
  File "C:\Users\kbrady\Anaconda3\envs\py39\lib\site-packages\pandas\__init__.py", line 16, in <module>
    raise ImportError(
ImportError: Unable to import required dependencies:
numpy:

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.9 from "C:\Users\kbrady\Anaconda3\envs\py39\python.exe"
  * The NumPy version is: "1.20.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

Running the same file, using the same environment via ‘Run Current File in Interactive Window’ runs with no errors. Seems possibly related to #17278 ?

Extension version: 2021.9.1191016588 VS Code version: Code 1.60.0 (e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff, 2021-09-01T10:41:52.311Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No

System Info
Item Value
CPUs Intel® Core™ i7-10750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.76GB (23.50GB free)
Process Argv –crash-reporter-id e99da718-44d6-48c6-b1aa-1ddafa4cfc71
Screen Reader no
VM 40%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805:30301674
pythonvspyt200:30340761
vscextlangct:30333562
binariesv615:30325510
pythonvssor306:30344512
bridge0708:30335490
pygetstartedt2:30360495
bridge0723:30353136
pythonrunftest32:30361774
pythonf5test824cf:30361778
vsdyn321cf:30356811
pythonvspyt187cf:30362783
pydsgst2:30361792
vscus224cf:30358040
vssid140cf:30362081

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
AkutLunacommented, Sep 9, 2021

The 3 steps work BUT this way I have to re-add all my folders to my workspace every time. If close and reopen VSCode the problem is back.

1reaction
karrtikrcommented, Sep 9, 2021

If it does not help, another thing to try is this:

  1. Anaconda prompt and cd to your workspace.
  2. Activate the environment using conda activate
  3. Start VS Code using code .

cc @AkutLuna

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found