Failed to create virtualenv

Ubuntu 16.04 64位,跑VTS时报错,之后无法正常测试,重装python 环境也不行。

03-28 18:47:01 D/RunUtil: Running [virtualenv, /tmp/2dda8284800eb328b87b7161c94104e2-virtualenv1403893971550289422]
03-28 18:47:17 D/RunUtil: [virtualenv, /tmp/2dda8284800eb328b87b7161c94104e2-virtualenv1403893971550289422] command failed. return code 1
03-28 18:47:17 E/VtsPythonVirtualenvPreparer: Failed to create virtualenv with : /tmp/2dda8284800eb328b87b7161c94104e2-virtualenv1403893971550289422.
03-28 18:47:17 E/ModuleDef: TargetSetupError in preparer: com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer
03-28 18:47:17 E/TestInvocation: Unexpected exception when running invocation: java.lang.RuntimeException: com.android.tradefed.targetprep.TargetSetupError: Failed to create virtualenv
03-28 18:47:17 E/TestInvocation: com.android.tradefed.targetprep.TargetSetupError: Failed to create virtualenv
java.lang.RuntimeException: com.android.tradefed.targetprep.TargetSetupError: Failed to create virtualenv
at com.android.compatibility.common.tradefed.testtype.ModuleDef.runPreparerSetup(ModuleDef.java:354)
at com.android.compatibility.common.tradefed.testtype.ModuleDef.runPreparerSetups(ModuleDef.java:288)
at com.android.compatibility.common.tradefed.testtype.ModuleDef.run(ModuleDef.java:250)
at com.android.compatibility.common.tradefed.testtype.CompatibilityTest.run(CompatibilityTest.java:477)
at com.android.tradefed.invoker.TestInvocation.runTests(TestInvocation.java:796)
at com.android.tradefed.invoker.TestInvocation.prepareAndRun(TestInvocation.java:471)
at com.android.tradefed.invoker.TestInvocation.performInvocation(TestInvocation.java:322)
at com.android.tradefed.invoker.TestInvocation.invoke(TestInvocation.java:984)
at com.android.tradefed.command.CommandScheduler$InvocationThread.run(CommandScheduler.java:558)
Caused by: com.android.tradefed.targetprep.TargetSetupError: Failed to create virtualenv
at com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer.startVirtualenv(VtsPythonVirtualenvPreparer.java:281)
at com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer.setUp(VtsPythonVirtualenvPreparer.java:98)
at com.android.compatibility.common.tradefed.testtype.ModuleDef.runPreparerSetup(ModuleDef.java:344)
… 8 more

$pip -V

Traceback (most recent call last):
File “/usr/bin/pip”, line 9, in <module>
from pip import main
File “/usr/lib/python2.7/dist-packages/pip/__init__.py”, line 4, in <module>
import locale
File “/usr/lib/python2.7/locale.py”, line 13, in <module>
import encodings
ImportError: No module named encodings

参考文章:

刷入GSI之后无法开机或者是VTS环境下Case无法执行

作者: RESSRC

个人资源站

《Failed to create virtualenv》有10个想法

    1. 感谢分享您的解决方法;
      遇到问题的朋友可以试下;
      解决后是否还会复现? 我们验证应该是使用sudo root 权限执行测试引起的,再具体深入的原因就不清楚了;
      MTK的FAQ中也有提到以root权限执行会引起环境破坏。
      谷歌讨论组中有反馈这个问题,但没有给出具体的原因;有客户提出不要以sudo root权限执行测试;

      1. 您好,我这边也碰到这种情况,出现这种问题有没有什么办法可以修复呢?是不是必须要重新安装环境啊

    2. sudo pip install pysocks
      Traceback (most recent call last):
      File “/usr/bin/pip”, line 9, in
      from pip import main
      File “/usr/lib/python2.7/dist-packages/pip/__init__.py”, line 4, in
      import locale
      File “/usr/lib/python2.7/locale.py”, line 13, in
      import encodings
      ImportError: No module named encodings

      `
      WHY? DO YOU KNOW WHY?

  1. 你好,关于这个问题,现在有解决方法没?我测试也遇到,尝试弄的时候就把服务器给搞坏了。

  2. 你好 今天测试VTS也遇到这个问题,解决方法如下:
    手动在本地运行 virtualenv ven 创建一个python虚拟环境出现报错,把报错问题解决后,这个就能通过了。
    在本地能创建环境的话,在vts测试中应该也是可以的

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.