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 -m to create virtualenvs #1316

Merged
merged 1 commit into from
Jun 2, 2015

Conversation

takluyver
Copy link
Contributor

Fixes gh-1263, failure to create Python 3 virtualenvs (I hope)

The problem appears to be that virtualenv -p python3 re-executes its own file in site-packages as a script under Python 3. Because the directory containing a script is prepended to sys.path, the contents of Python 2 site-packages are then on sys.path for Python 3. python-future is installed in Python 2, providing certain standard library modules under their Python 3 names. So when it tries to import copyreg, it finds the compatibility module for Python 2 instead of the standard Python 3 module, making future fail with the error:

ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

As suggested by @dstufft, this invokes python3 -m virtualenv instead, which will cause Python 3 to run its own copy of virtualenv, and should avoid this issue. This requires virtualenv to be installed in Python 3 as well; I don't know if it already is, but it should be easy to arrange if not.

Fixes readthedocsgh-1263, failure to create Python 3 virtualenvs (I hope)

The problem appears to be that `virtualenv -p python3` re-executes its
own file in site-packages as a script under Python 3. Because the
directory containing a script is prepended to `sys.path`, the contents
of Python 2 site-packages are then on sys.path for Python 3. [python-
future](http://python-future.org/) is installed in Python 2, providing
certain standard library modules under their Python 3 names. So when it
tries to import copyreg, it finds the compatibility module for Python 2
instead of the standard Python 3 module, making future fail with the
error:

ImportError: This package should not be accessible on Python 3. Either
you are trying to run from the python-future src folder or your
installation of python-future is corrupted.

As suggested by @dstufft, this invokes `python3 -m virtualenv` instead,
which will cause Python 3 to run its own copy of virtualenv, and should
avoid this issue. This requires virtualenv to be installed in Python 3
as well; I don't know if it already is, but it should be easy to arrange
if not.
@takluyver
Copy link
Contributor Author

I'm not exactly sure how the failures could be transient, as some people report, but if there are multiple builders and not all of them have python-future installed, that would do it.

@ericholscher
Copy link
Member

Looks sane. Let's see if it fixes the build issues we've been seeing.

ericholscher added a commit that referenced this pull request Jun 2, 2015
Use python -m to create virtualenvs
@ericholscher ericholscher merged commit 2930d83 into readthedocs:master Jun 2, 2015
@ericholscher
Copy link
Member

Looks like it's fixed for me. I checked and nothing had python-future installed. I couldn't make heads or tails of the randomness of the errors, but it seems this did it.

@ankostis
Copy link
Contributor

I possibly bumped onto the same issue today.
See https://readthedocs.org/builds/pandalone/2991313/

@takluyver
Copy link
Contributor Author

That's a new issue - the cause is unrelated, but the symptom is similar. See #1350 and sphinx-doc/alabaster#40. It's actually already fixed, but it needs a new release of alabaster now. Or RTD could make a temporary workaround.

@bitprophet, is there an ETA on alabaster 0.7.6?

@takluyver takluyver deleted the fix-py3-venvs branch June 22, 2015 17:26
@bitprophet
Copy link
Contributor

Should be up just now, @takluyver.

@takluyver
Copy link
Contributor Author

takluyver commented Jun 23, 2015 via email

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

Successfully merging this pull request may close these issues.

"sphinx-build not found" error in a Py3k venv
4 participants