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

problem running tox with site module #1432

Closed
vahtras opened this issue Oct 10, 2019 · 2 comments
Closed

problem running tox with site module #1432

vahtras opened this issue Oct 10, 2019 · 2 comments
Labels
bug:normal affects many people or has quite an impact

Comments

@vahtras
Copy link

vahtras commented Oct 10, 2019

The Python version that tox executes has a fundamentally different site module than the standard distrubution. Why is that? The resulting error I have had boils down to the following line

$ ./.tox/py36/bin/python3.6 -c 'import site; print(site.getuserbase())'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'site' has no attribute 'getuserbase'

$ ./.tox/py36/bin/python3.6 --version
Python 3.6.8

to be compared with

$ /usr/bin/python3.6 -c 'import site; print(site.getuserbase())'
/home/olav/.local
$ /usr/bin/python3.6 --version
Python 3.6.8
@vahtras vahtras added the bug:normal affects many people or has quite an impact label Oct 10, 2019
@gaborbernat
Copy link
Member

gaborbernat commented Oct 10, 2019

This is a side-effect of how virtualenv works. See https://www.youtube.com/watch?v=o1Vue9CWRxU for an in-depth detail. The next iteration of virtualenv will solve this (pypa/virtualenv#1377); in the meantime you can switch tox to use venv instead by using https://pypi.org/project/tox-venv/

YouTube
"status quo of virtual environments [EuroPython 2019 - Talk - 2019-07-12 - MongoDB] [Basel, CH] By Bernat Gabor Python is easy to learn and use programming l...
PyPI
Use Python 3 venvs for Python 3 tox testenvs

@vahtras
Copy link
Author

vahtras commented Oct 10, 2019

ok, thanks!

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug:normal affects many people or has quite an impact
Projects
None yet
Development

No branches or pull requests

2 participants