Skip to content
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

Anaconda debug Fails to import mpl_toolkits.mplot3d module #6806

Closed
bryceschober opened this issue Jul 31, 2019 · 3 comments
Closed

Anaconda debug Fails to import mpl_toolkits.mplot3d module #6806

bryceschober opened this issue Jul 31, 2019 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@bryceschober
Copy link

Environment data

Version: 1.36.1 (system setup)
Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Date: 2019-07-08T22:59:35.033Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362

  • Extension version (available under the Extensions sidebar): 2019.6.24221
  • Python version (& distribution if applicable, e.g. Anaconda): conda 4.7.10, Python 3.7.3
  • Type of virtual environment used: (N/A | venv | virtualenv | conda | ...): None
  • Relevant/affected Python packages and their versions: matplotlib matplotlib-3.1.0-py37hc8f65d3_0.conda
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): XXX

Run under default python debug configuration:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal"
    }
  ]
}

As recommended, using cmd.exe as integrated shell in user settings.json:

    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe"

Simple test_import_mplot3d.py:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
my_plot = fig.gca(projection='3d')

Expected behaviour

Debug test_import_mplot3d.py and run to completion without error

Actual behaviour

Debug console traceback:

Traceback (most recent call last):
  File "c:\Users\bschober\.vscode\extensions\ms-python.python-2019.6.24221\pythonFiles\ptvsd_launcher.py", line 43, in <module>
    main(ptvsdArgs)
  File "c:\Users\bschober\.vscode\extensions\ms-python.python-2019.6.24221\pythonFiles\lib\python\ptvsd\__main__.py", line 434, in main
    run()
  File "c:\Users\bschober\.vscode\extensions\ms-python.python-2019.6.24221\pythonFiles\lib\python\ptvsd\__main__.py", line 312, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "e:\git\ops-data-broker\test_import_mplot3d.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\__init__.py", line 138, in <module>
    from . import cbook, rcsetup
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 31, in <module>
    import numpy as np
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
    from . import _distributor_init
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
    from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.

Steps to reproduce:

  1. Run under debugger

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'AlwaysDisplayTestExplorer - control'
Starting Microsoft Python language server.
[Info  - 4:21:56 PM] Analysis cache path: C:\Users\bschober\AppData\Local\Microsoft\Python Language Server
[Info  - 4:21:56 PM] GetCurrentSearchPaths C:\Users\bschober\AppData\Local\Continuum\anaconda3\python.exe 
[Info  - 4:21:56 PM] Interpreter search paths:
[Info  - 4:21:56 PM]     c:\users\bschober\appdata\local\continuum\anaconda3\dlls
[Info  - 4:21:56 PM]     c:\users\bschober\appdata\local\continuum\anaconda3\lib
[Info  - 4:21:56 PM]     c:\users\bschober\appdata\local\continuum\anaconda3
[Info  - 4:21:56 PM]     c:\users\bschober\appdata\local\continuum\anaconda3\lib\site-packages
[Info  - 4:21:56 PM]     c:\users\bschober\appdata\local\continuum\anaconda3\lib\site-packages\win32
[Info  - 4:21:56 PM]     c:\users\bschober\appdata\local\continuum\anaconda3\lib\site-packages\win32\lib
[Info  - 4:21:56 PM]     c:\users\bschober\appdata\local\continuum\anaconda3\lib\site-packages\pythonwin
[Info  - 4:21:56 PM] User search paths:
[Info  - 4:22:12 PM] Microsoft Python Language Server version 0.3.43.0
[Info  - 4:22:12 PM] Initializing for C:\Users\bschober\AppData\Local\Continuum\anaconda3\python.exe

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

XXX
@bryceschober bryceschober added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jul 31, 2019
@DonJayamanne DonJayamanne self-assigned this Aug 1, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 1, 2019
@DonJayamanne
Copy link

Thanks for reporting this issue. Please could you provide a screenshot of the text sent to the terminal (I'd like to check whether the conda environment got activated before the debugger command was sent to the terminal).

@DonJayamanne DonJayamanne added the info-needed Issue requires more information from poster label Aug 2, 2019
@bryceschober
Copy link
Author

I totally forgot to mention that it does actually succeed on the second time, since it seems to re-use the terminal, which now seems to have the default anaconda environment successfully enabled.

Here is the full terminal output from the both runs, using the test python script posted before:

Microsoft Windows [Version 10.0.18362.239]
(c) 2019 Microsoft Corporation. All rights reserved.

E:\git\ops-data-broker>cd e:\git\ops-data-broker && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:\Users\bschober\AppData\Local\Continuum\anaconda3\python.exe c:\Users\bschober\.vscode\extensions\ms-python.python-2019.6.24221\pythonFiles\ptvsd_launcher.py --default --client --host localhost --port 51476 e:\git\ops-data-broker\test_import_mplot3d.py "
Traceback (most recent call last):
  File "c:\Users\bschober\.vscode\extensions\ms-python.python-2019.6.24221\pythonFiles\ptvsd_launcher.py", line 43, in <module>
    main(ptvsdArgs)
  File "c:\Users\bschober\.vscode\extensions\ms-python.python-2019.6.24221\pythonFiles\lib\python\ptvsd\__main__.py", line 434, in main   
    run()
  File "c:\Users\bschober\.vscode\extensions\ms-python.python-2019.6.24221\pythonFiles\lib\python\ptvsd\__main__.py", line 312, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "e:\git\ops-data-broker\test_import_mplot3d.py", line 1, in <module>
    from mpl_toolkits.mplot3d import Axes3D
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\site-packages\mpl_toolkits\mplot3d\__init__.py", line 1, in <module>      
    from .axes3d import Axes3D
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 16, in <module>       
    import numpy as np
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
    from . import _distributor_init
  File "C:\Users\bschober\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
    from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.

E:\git\ops-data-broker>C:/Users/bschober/AppData/Local/Continuum/anaconda3/Scripts/activate.bat

(base) E:\git\ops-data-broker>cd e:\git\ops-data-broker && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:\Users\bschober\AppData\Local\Continuum\anaconda3\python.exe c:\Users\bschober\.vscode\extensions\ms-python.python-2019.6.24221\pythonFiles\ptvsd_launcher.py --default --client --host localhost --port 51486 e:\git\ops-data-broker\test_import_mplot3d.py "

(base) E:\git\ops-data-broker>

@DonJayamanne
Copy link

Duplicate of #5559

@DonJayamanne DonJayamanne marked this as a duplicate of #5559 Aug 7, 2019
@ghost ghost removed the triage label Aug 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants