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

ImportError while debbuging test within conda environment #4974

Closed
MaximeWeyl opened this issue Mar 27, 2019 · 1 comment
Closed

ImportError while debbuging test within conda environment #4974

MaximeWeyl opened this issue Mar 27, 2019 · 1 comment

Comments

@MaximeWeyl
Copy link

Environment data

  • VS Code version: 1.32.3
  • Extension version (available under the Extensions sidebar): 2019.3.6139
  • OS and version: Windows_NT x64 10.0.17134
  • Python version (& distribution if applicable, e.g. Anaconda): conda environment created from simple requirements.txt
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: pytest 4.3.1 and pandas 0.24.2

Expected behaviour

Launching a test works in "Run test" and "Debug test".

Actual behaviour

Launching a test works with "Run test" but not with "Debug test".
Error message is :

_____________________ ERROR collecting tests/test_lib.py ______________________

ImportError while importing test module 'c:\Users\PC\Desktop\test_pytest_debug_vscode\tests\test_lib.py'.

Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests\test_lib.py:1: in <module>
    import pandas as pd
..\..\Anaconda3\envs\m2rp\lib\site-packages\pandas\__init__.py:19: in <module>
    "Missing required dependencies {0}".format(missing_dependencies))
E   ImportError: Missing required dependencies ['numpy']

Steps to reproduce:

  1. From conda (4.6.8), create a new env :
    conda create --name test --file requirements.txt

With requirements.txt :

python=3.7
pytest
pandas

  1. Select the created env as Python Interpreter
  2. Run this test file with pytest from the test menu :
import pandas as pd

def test_sum():
    assert sum([1, 2, 3, 4]) == 10

3a. Running this test is ok
3b. Debugging this test fails

Note

When I create the environment from virtualenv and install the requirements.txt with pip, the bug does not occur.

Logs

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

Nothing

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)

Nothing

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Mar 27, 2019
@DonJayamanne
Copy link

Duplicate of #4300

@DonJayamanne DonJayamanne marked this as a duplicate of #4300 Mar 28, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants