tox: No such file or directory: '.tox/py33/bin/pip'

Hi,

I’m trying to use tox, but when I run it, I get the following error (full stacktrace below):

FileNotFoundError: [Errno 2] No such file or directory: ‘.tox/py33/bin/pip’

I’m running Tox on a project created with Cookiecutter, in a virtualenv, on my Mac.

This is my tox.ini:

#!python


[tox]
envlist = py33, style

[testenv]
setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/HuetonApi
deps =
    -r{toxinidir}/requirements.txt
    pytest
commands =
    python setup.py test

[testenv:style]
deps =
    -r{toxinidir}/requirements.txt
    flake8
commands =
    python setup.py flake8

And I have no idea how to fix this 😃 thanks for the help!

Full stacktrace:

py33 installdeps: -r/Users/erikp/User Files/Projects/python/hueton/HuetonApi/requirements.txt, pytest
Traceback (most recent call last):
  File "/Users/erikp/Envs/hueton/bin/tox", line 9, in <module>
    load_entry_point('tox==1.6.1', 'console_scripts', 'tox')()
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_cmdline.py", line 26, in main
    retcode = Session(config).runcommand()
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_cmdline.py", line 301, in runcommand
    return self.subcommand_test()
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_cmdline.py", line 433, in subcommand_test
    if self.setupenv(venv):
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_cmdline.py", line 358, in setupenv
    status = venv.update(action=action)
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_venv.py", line 142, in update
    self.install_deps(action)
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_venv.py", line 272, in install_deps
    self._install(deps, action=action)
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_venv.py", line 334, in _install
    extraenv=extraenv)
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_venv.py", line 303, in run_install_command
    extraenv=env, action=action)
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_venv.py", line 382, in _pcall
    return action.popen(args, cwd=cwd, env=env, redirect=redirect)
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_cmdline.py", line 96, in popen
    popen = self._popen(args, cwd, env=env, stdout=f, stderr=STDOUT)
  File "/Users/erikp/Envs/hueton/lib/python3.3/site-packages/tox/_cmdline.py", line 153, in _popen
    stdout=stdout, stderr=stderr, env=env)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/subprocess.py", line 820, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/subprocess.py", line 1438, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '.tox/py33/bin/pip'

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

This error has also occured for me too, turns out that a virtualenv is created with tox which has an asolute path with length about 96 characters but whenever it takes your absolute ‘bin/pip’ path to near about 123 chars, there is an invocation error, OSError2.

‘ERROR: invocation failed (errno 2), OSError: [Errno 2] No such file or directory’

Python: Python 2.7.6 virtualenv:15.1.0 tox: 2.9.1 pip: 9.0.1 ubuntu 14.04 test ran with coverage: django(1.8-1.11) tests with py27, py35 each

Resolution: I created my virtualenv(with abs path <=(96-100) chars) first where tox is installed, cloned my project to be used with this tox installation and virtualenv, tox creates it own virtualenvs now and it runs fine.

hope it helps.

I’ve worked around the bug by adding this to my environment configuration in tox.ini

commands =
  {envbindir}/python {envbindir}/py.test --junitxml=results.xml

install_command = {envbindir}/python {envbindir}/pip install {opts} {packages}
list_dependencies_command = {envbindir}/python {envbindir}/pip freeze