Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Environments needs to be activated before running code on the user's behalf (e.g. unit tests or DS) #3330
Tests are discovered and run in Python-3.6 conda env, but not in Python-3.7, which doesn't discover tests and/or fails in
Also I can even run
Same issue with both
discover and run tests in Python-3.7 same as in Python-3.6
Steps to reproduce:
here's the output from
I can discover and run tests fine under conda using Python 3.7 and pytest without numpy, but I do get the same failure if the environment is not activated. It seems conda has chosen to package numpy in such a way that it can't be imported unless the environment is activated (which we don't do when running tests).
With a test of:
import numpy def test_fake(): return True
and settings of:
"python.unitTest.pyTestArgs": [ "." ], "python.unitTest.unittestEnabled": false, "python.unitTest.nosetestsEnabled": false, "python.unitTest.pyTestEnabled": true
I end up with:
referenced this issue
Nov 15, 2018
I also forgot to mention that I verified this in an Anaconda Prompt by running directly the Python interpreter and then indirectly through an activated terminal and got the same results, so it's definitely based on how they have chosen to package numpy for at least Python 3.7.
We might have to use
Although numpy is a stubborn one, with it's BLAS and LAPACK dependencies. Maybe there's more to this? Do you think I should open a conda issue?
This is not a conda bug. The conda package manager allows packages to specify activation and deactivation scripts which, generally speaking must be run for the software to work correctly.
These scripts can do arbitrary things, setting env vars, running programs, whatever they need to.
Simply put, running any Anaconda Distribution software outside of using the correct activation procedure is not and never will be supported. In this particular instance, it's not actually the problem that the activation scripts are not run, it is the more fundamental fact that conda activation sets
People are free to avoid this advice and in many cases everything will be fine, but it's unsupported (and I have no idea why people think avoiding activation would be considered reasonable, to be clear, if activation was optional it wouldn't exist!).
Finally please remember AD is about more than just Python too.
I agree, @mingwandroid, and I'm sorry. I typed too hastily, and I should've thought about it more carefully.
I started to realize this as I was typing, but I should have revised my comments before submitting.
referenced this issue
Nov 16, 2018