当python软件包安装在本地计算机而不是virtualenv上时,如何在virtualenv上安装pytest?

时间:2020-05-04 19:29:38

标签: python linux virtualenv onnx

这是我在虚拟环境中尝试为ONNX框架安装pytest和nbval时遇到的错误。主目录(〜/)的内存有限。当我尝试使用变量$ IPYTHONDIR更改IPython目录路径时,表明pytest中提到的模块丢失了 当我在virtualenv中运行测试时,得到以下结果。

platform linux -- Python 3.7.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /local/mnt2/workspace2/Virtual_Env/venv-onnx
plugins: nbval-0.9.5
collected 0 items / 1 error                                                                                                                                                                                                                 

================================================================================================================== ERRORS ===================================================================================================================
_______________________________________________________________________________________________________ ERROR collecting test session _______________________________________________________________________________________________________
lib/python3.7/site-packages/_pytest/config/__init__.py:495: in _importconftest
    return self._conftestpath2mod[key]
E   KeyError: PosixPath('/local/mnt2/workspace2/Virtual_Env/venv-onnx/lib/python3.7/site-packages/IPython/conftest.py')

During handling of the above exception, another exception occurred:
lib/python3.7/site-packages/_pytest/config/__init__.py:501: in _importconftest
    mod = conftestpath.pyimport()
lib/python3.7/site-packages/py/_path/local.py:701: in pyimport
    __import__(modname)
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:677: in _load_unlocked
    ???
lib/python3.7/site-packages/_pytest/assertion/rewrite.py:152: in exec_module
    exec(co, module.__dict__)
lib/python3.7/site-packages/IPython/conftest.py:69: in <module>
    inject()
lib/python3.7/site-packages/IPython/conftest.py:59: in inject
    builtins._ip = get_ipython()
lib/python3.7/site-packages/IPython/conftest.py:21: in get_ipython
    shell = TerminalInteractiveShell.instance(config=config)
lib/python3.7/site-packages/traitlets/config/configurable.py:412: in instance
    inst = cls(*args, **kwargs)
lib/python3.7/site-packages/IPython/terminal/interactiveshell.py:520: in __init__
    super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
lib/python3.7/site-packages/IPython/core/interactiveshell.py:637: in __init__
    self.init_ipython_dir(ipython_dir)
lib/python3.7/site-packages/IPython/core/interactiveshell.py:737: in init_ipython_dir
    self.ipython_dir = get_ipython_dir()
lib/python3.7/site-packages/traitlets/traitlets.py:585: in __set__
    self.set(obj, value)
lib/python3.7/site-packages/traitlets/traitlets.py:574: in set
    obj._notify_trait(self.name, old_value, new_value)
lib/python3.7/site-packages/traitlets/traitlets.py:1139: in _notify_trait
    type='change',
lib/python3.7/site-packages/traitlets/traitlets.py:1176: in notify_change
    c(change)
lib/python3.7/site-packages/IPython/core/interactiveshell.py:714: in _ipython_dir_changed
    ensure_dir_exists(change['new'])
lib/python3.7/site-packages/IPython/utils/path.py:431: in ensure_dir_exists
    os.makedirs(path, mode=mode)
/usr/lib/python3.7/os.py:223: in makedirs
    mkdir(name, mode)
E   OSError: [Errno 122] Disk quota exceeded: '/usr2/tkavathe/.ipython'

During handling of the above exception, another exception occurred:
lib/python3.7/site-packages/py/_path/common.py:383: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
lib/python3.7/site-packages/py/_path/common.py:435: in gen
    for p in self.gen(subdir):
lib/python3.7/site-packages/py/_path/common.py:435: in gen
    for p in self.gen(subdir):
lib/python3.7/site-packages/py/_path/common.py:435: in gen
    for p in self.gen(subdir):
lib/python3.7/site-packages/py/_path/common.py:424: in gen
    dirs = self.optsort([p for p in entries
lib/python3.7/site-packages/py/_path/common.py:425: in <listcomp>
    if p.check(dir=1) and (rec is None or rec(p))])
lib/python3.7/site-packages/_pytest/nodes.py:506: in _recurse
    ihook = self._gethookproxy(dirpath)
lib/python3.7/site-packages/_pytest/nodes.py:487: in _gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
lib/python3.7/site-packages/_pytest/config/__init__.py:473: in _getconftestmodules
    mod = self._importconftest(conftestpath)
lib/python3.7/site-packages/_pytest/config/__init__.py:509: in _importconftest
    raise ConftestImportFailure(conftestpath, sys.exc_info())
E   _pytest.config.ConftestImportFailure: (local('/local/mnt2/workspace2/Virtual_Env/venv-onnx/lib/python3.7/site-packages/IPython/conftest.py'), (<class 'OSError'>, OSError(122, 'Disk quota exceeded'), <traceback object at 0x7f1874042460>))
========================================================================================================== short test summary info ==========================================================================================================
ERROR  - _pytest.config.ConftestImportFailure: (local('/local/mnt2/workspace2/Virtual_Env/venv-onnx/lib/python3.7/site-packages/IPython/conftest.py'), (<class 'OSError'>, OSError(122, 'Disk quota exceeded'), <traceback object at 0x7f1...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================================= 1 error in 0.34s ==============================================================================================================

1 个答案:

答案 0 :(得分:1)

请清除所有临时文件夹和所有不需要的文件。

您的堆栈跟踪明确表明磁盘配额已超出。 磁盘配额是您允许在给定磁盘或位置中存储的最大数据量