Skip to content
Advertisement

ImportError: DLL load failed: The specified module could not be found in VS code Jupyter notebook with anaconda environment

I have anaconda installed and I have changed the interpreter on the top right to my anaconda environment. When imported a library I am getting the following error

ImportError: DLL load failed: The specified module could not be found

I have added the following variables in PATH

C:Usersnameanaconda3
C:Usersnameanaconda3Scripts
C:Usersnameanaconda3Library
C:Usersnameanaconda3Librarybin
C:Usersnameanaconda3Librarymingw-w64bin

I have added the following variables in Preferences:Settings(JSON)

    "terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe",
    "terminal.integrated.shellArgs.windows": ["/K", "C:\Users\name\anaconda3\Scripts\activate.bat C:\Users\name\anaconda3"],
    "python.condaPath": "C:\Users\name\anaconda3\conda.exe"

None of the solutions worked.

Advertisement

Answer

Posting the answer if anyone is stuck on the same issue. After trying the two above-mentioned steps. I have opened the terminal in VS code and activated my environment

conda activate myenv

Next run

>code .

in the VS code’s terminal. If it does not work close VS code and repeat this step.

If the issue still persists then

  1. Open anaconda prompt.
  2. Change the directory to location where jupyter notebook is preset.
  3. execute code .
  4. Try running the import statement now.

Source

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement