Skip to content

No such file or directory: '.tox/py27/bin/pip' in Ubuntu 16.04 #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vijeth-aradhya opened this issue Oct 30, 2016 · 7 comments
Closed

Comments

@vijeth-aradhya
Copy link

BUG:

I'm getting this error in Ubuntu 16.04

virtualenv 15.0.1

pytest 3.0.3

pip 8.1.1

python 2.7

GLOB sdist-make: /home/asd/setup.py

py27 create: /home/asd/.tox/py27

py27 installdeps: -r/home/asd/requirements.txt, pytest

ERROR: invocation failed (errno 2), args: [local('/home/ads/.tox/py27/bin/pip'), 'install', '-r/home/asd/requirements.txt', 'pytest'], cwd: /home/asd

Traceback (most recent call last):
File "/usr/bin/tox", line 9, in
load_entry_point('tox==2.3.1', 'console_scripts', 'tox')()
File "/usr/lib/python3/dist-packages/tox/session.py", line 39, in main
retcode = Session(config).runcommand()
File "/usr/lib/python3/dist-packages/tox/session.py", line 375, in runcommand
return self.subcommand_test()
File "/usr/lib/python3/dist-packages/tox/session.py", line 526, in subcommand_test
if self.setupenv(venv):
File "/usr/lib/python3/dist-packages/tox/session.py", line 434, in setupenv
status = venv.update(action=action)
File "/usr/lib/python3/dist-packages/tox/venv.py", line 153, in update
self.hook.tox_testenv_install_deps(action=action, venv=self)
File "/usr/lib/python3/dist-packages/pluggy.py", line 724, in call
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/usr/lib/python3/dist-packages/pluggy.py", line 338, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/lib/python3/dist-packages/pluggy.py", line 333, in
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/usr/lib/python3/dist-packages/pluggy.py", line 596, in execute
res = hook_impl.function(*args)
File "/usr/lib/python3/dist-packages/tox/venv.py", line 401, in tox_testenv_install_deps
venv._install(deps, action=action)
File "/usr/lib/python3/dist-packages/tox/venv.py", line 284, in _install
action=action)
File "/usr/lib/python3/dist-packages/tox/venv.py", line 257, in run_install_command
self._pcall(argv, cwd=self.envconfig.config.toxinidir, action=action)
File "/usr/lib/python3/dist-packages/tox/venv.py", line 362, in _pcall
redirect=redirect, ignore_ret=ignore_ret)
File "/usr/lib/python3/dist-packages/tox/session.py", line 136, in popen
stdout=stdout, stderr=STDOUT)
File "/usr/lib/python3/dist-packages/tox/session.py", line 224, in _popen
stdout=stdout, stderr=stderr, env=env)
File "/usr/lib/python3.5/subprocess.py", line 947, in init
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)

FileNotFoundError: [Errno 2] No such file or directory: '.tox/py27/bin/pip'

@obestwalter
Copy link
Member

@vijeth-aradhya Thanks for the report. I can't reproduce it on my Ubuntu 16.04 though. Could you give us specifics about your setup and your Ubuntu install regarding Python and virtualenvs? Do you also use virtualenvwrapper like in the similar bug reported in #123?

@vijeth-aradhya
Copy link
Author

I found the exact bug. Sorry, I had changed the path due to confidentiality before. My path actually had a space in between! (like "/home/username/school project/")

BUG -

  • I think it's actually a bug associated with virtualenv
  • Cannot execute pip on virtualenv created in directory path with spaces

REFERENCE -

Take a look at this answer in stackoverflow which tells that you have to run virtualenv only in the PATH with no spaces. The original question was this.

REPRODUCE BUG -

  • If your cwd has a PATH say : "/home/username/school project/" then it will throw an error due to the shebang on the executables in virtualenv [ school project has a space in between ]
  • This can be done with tox as well, it will throw an error because it can't find that path (with spaces)

@obestwalter
Copy link
Member

obestwalter commented Nov 2, 2016

@vijeth-aradhya ok thanks for clarifying that. Although tox borks over this, IMHO this is not actually a bug in tox and not even a bug in virtualenv.

The main thing to keep in mind is to use

#!/usr/bin/env python or #!/usr/bin/env python3 or #!/usr/bin/env python2

as shebang line. As an aside: this is even supported by the program launcher on Windows.

@obestwalter obestwalter added invalid and removed bug labels Nov 2, 2016
@vijeth-aradhya
Copy link
Author

vijeth-aradhya commented Nov 2, 2016

@obestwalter Thank you! I will keep that in mind :) Do we close the issue then?

@prot0man
Copy link

Is it unrealistic to think that tox would be able to run from an directory with a space in it? I wouldn't consider this issue closed until I handled that issue if I were responsible for the repo.

@The-Compiler
Copy link
Member

@prot0man There's nothing tox can do about this. You'd first need to "fix" the Linux kernel to have some way to escape spaces in shebangs, and then update virtualenv/pip(?) to use that escape mechanism.

@obestwalter
Copy link
Member

obestwalter commented Apr 20, 2017

@prot0man The bug report as it stood was invalid, because the referenced path did not contain a space. The actual problem surfaced later and the reporter suggested to close it, that's why this particular issue is closed. It's also closed because there is already an open issue about the space-in-paths-problem (open since 2013): #121 and if what @The-Compiler says is correct it will likely stay open for a very long time :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants