Skip to content
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

Fix pyvenv detection when executing Rally from source #448

Closed
dliappis opened this issue Mar 27, 2018 · 0 comments · Fixed by #449
Closed

Fix pyvenv detection when executing Rally from source #448

dliappis opened this issue Mar 27, 2018 · 0 comments · Fixed by #449
Assignees
Labels
bug Something's wrong :Config Config file format changes, new properties, ...
Milestone

Comments

@dliappis
Copy link
Contributor

Currently ./rally is unable to detect virtualenvs created with pyvenv (which is the case when pyenv is installed).

The reason is that while sys.real_prefix is defined with regular Virtualenv's (such as the one created with python3 -m venv venv or virtualenv -p python3 venv) it is not defined when pyvenv is in use. In other words, if a user has installed pyvenv locally or globally, which is a requirement for integration tests anyway, in some platforms this takes over when creating virtualenv's even with python3 -m venv venv.

No sys.real_path in Python3 when pyvenv is in use
$ pyenv shell 3.6.4
$ which python3
~/.pyenv/shims/python3
$ python3 --version
Python 3.6.4
$ python3 -m venv venv
$ source venv/bin/activate
(venv) dl@MS-7885 ~ $ python3
Python 3.6.4 (default, Mar 12 2018, 11:20:13) 
[GCC 7.3.1 20180130 (Red Hat 7.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.real_prefix
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'sys' has no attribute 'real_prefix'
>>> sys.base_prefix
'/home/dl/.pyenv/versions/3.6.4'
>>> sys.prefix
'/home/dl/venv'
@dliappis dliappis self-assigned this Mar 27, 2018
@dliappis dliappis added this to the 0.10.0 milestone Mar 27, 2018
@dliappis dliappis added bug Something's wrong :Config Config file format changes, new properties, ... labels Mar 27, 2018
dliappis added a commit to dliappis/rally that referenced this issue Mar 27, 2018
This commit fixes two issues. Firstly, let `./rally` start when
executed for the first time with self update disabled (e.g. from a non
master branch in a fork) by ensuring the `esrally` binary has been
installed with setuptools.

Secondly, fix virtualenv detection when pyenv is in use. On some
configurations when pyenv is present, creating a Python3 virtualenv
uses pyvenv instead of Python3's own virtualenv[1] which fails the
current check for a virtualenv in the `run.sh` script.

[1] https://legacy.python.org/dev/peps/pep-0405/

Closes elastic#447
Closes elastic#448
dliappis added a commit that referenced this issue Apr 3, 2018
This commit fixes two issues. Firstly, let `./rally` start when
executed for the first time with self update disabled (e.g. from a non
master branch in a fork) by ensuring the `esrally` binary has been
installed with setuptools.

Secondly, fix virtualenv detection when pyenv is in use. On some
configurations when pyenv is present, creating a Python3 virtualenv
uses pyvenv instead of Python3's own virtualenv[1] which fails the
current check for a virtualenv in the `run.sh` script.

[1] https://legacy.python.org/dev/peps/pep-0405/

Relates  #449
Closes #447
Closes #448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something's wrong :Config Config file format changes, new properties, ...
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant