0

While working in an virtualenv [3.4] I was trying to run tox for running the tests when I got the error:

py34 develop-inst-nodeps: /home/horcrux/dir-sub/dir
py34 runtests: commands[0] | python -m nose2 -v
/home/horcrux/dir-sub/dir/.tox/py34/bin/python: No module named nose2
ERROR: InvocationError: '/home/horcrux/dir-sub/dir/.tox/py34/bin/python -m nose2 -v'
_____________________________ summary ______________________________________
ERROR:   py34: commands failed

I've already tried to install nose2 using pip install nose2 but still the problem remains the same.

David K. Hess
  • 16,632
  • 2
  • 49
  • 73
horcrux
  • 11
  • 1
  • 2

1 Answers1

1

sudo clears the environment. You have to invoke the virtualenv inside of the sudo execution environment. Try:

sudo bash -c ". [venv/bin/activate] ; [tox]"

Replace [venv/bin/activate] with the path to your virtualenv activate script and replace [tox] with whatever command you are using to invoke it.

David K. Hess
  • 16,632
  • 2
  • 49
  • 73