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

Use python from virtualenv's bin directory when executing commands #5107

Merged
merged 2 commits into from Jan 15, 2019

Conversation

@stsewd
Copy link
Member

@stsewd stsewd commented Jan 15, 2019

We are executing python commands like

python /path/to/bin/command

Sometimes it gives a non-deterministic behaviour.
Like using pip from the virtualenv in the first build
and using pip from the global installation other times.

Commands like sphinx-build and mkdocs have an console_scripts entry
point and shouldn't be a problem.

Now we are running the commands like /path/to/bin/virtualenv/python -m pip install ..., which gives a deterministic behaviour in every build.

I notice this problem while implementing #5006.

When calling the pyhton /path/to/pip list command it gives an error (pypa/pip#5373), and when calling /path/to/pip list it lists only the local packages, and in the second build /path/to/pip list list only the global packages. With this fix, /path/to/python -m pip list list global and local packages (in every build) as the docs say.

I'm not sure about conda, but I think we have a command that uses pip there. But first I'd like to have some opinions here. And maybe someone using rtd without docker can test this to make sure this doesn't break that workflow.

We are executing python commands like

`python /path/to/bin/command`

Sometimes it gives a non-deterministic behaviour.
Like using pip from the virtualenv in the first build
and using pip from the global installation other times.

Commands like sphinx-build and mkdocs have an `console_scripts` entry
point and shouldn't be a problem.
@stsewd stsewd requested a review from Jan 15, 2019
Copy link
Member

@ericholscher ericholscher left a comment

Makes sense. Weird that this is an issue, but nothing really surprises me with virtualenv path hacking.

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Jan 15, 2019

(We can ship this with the deploy today after the tests are 👍)

@ericholscher ericholscher merged commit a972eb1 into readthedocs:master Jan 15, 2019
2 checks passed
@stsewd stsewd deleted the use-python-from-virtualenv branch Jan 15, 2019
@humitos
Copy link
Member

@humitos humitos commented Jan 15, 2019

When calling the pyhton /path/to/pip list command it gives an error (pypa/pip#5373), and when calling /path/to/pip list it lists only the local packages, and in the second build /path/to/pip list list only the global packages

Oh boy! This is crazy! Nice that you find this issue. It's a good one to be bitten off 😢

stsewd added a commit to stsewd/readthedocs.org that referenced this issue Jan 15, 2019
stsewd added a commit to stsewd/readthedocs.org that referenced this issue Mar 27, 2019
There are some cases were rtd uses the old installed version of mkdocs
instead of the one installed by the user, like in
readthedocs#5532 (comment)

Which gives an error because it's using a yaml file
supported only in new mkdocs versions.

This is similar to readthedocs#5107
stsewd added a commit to stsewd/readthedocs.org that referenced this issue Mar 27, 2019
There are some cases were rtd uses the old installed version of mkdocs
instead of the one installed by the user, like in
readthedocs#5532 (comment)

Which gives an error because it's using a yaml file
supported only in new mkdocs versions.

This is similar to readthedocs#5107
@stsewd stsewd mentioned this pull request Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants