Closed krysros closed 2 years ago
It is customary to install tox at the user level for Unix. Is this an exception for Windows? If so, that can be resolved by exiting the virtual environment then installing it. Alternatively, you could try this workaround: https://github.com/microsoft/vscode-python/issues/14327#issuecomment-757408341
This error occurs on Linux Debian 11.3, while following the instructions in contributing.md.
Is the virtual environment activated when you run $VENV/bin/pip3 install --user tox
? What happens if you use your user pip outside of the virtual environment to install tox, i.e., pip3 install --user tox
?
Using --user
in an activated virtual environment is not recommended. I assumed that using the $VENV
command would still work because it is not using an activated virtual environment, but perhaps its location is what matters? If so, then I will go along with installing tox in the virtual environment. I personally dislike doing that with development tools as I like to keep these tools in my user Python.
I think I know what's going on... pip is not installed by default on Debian. You need to install pip via sudo apt-get install python3-pip
.
Then install tox with
python3 -m pip install --user tox
or
pip3 install --user tox
not
$VENV/bin/pip3 install --user tox
Details:
krystian@debian:~$ cd projects/deform/
krystian@debian:~/projects/deform$ source env/bin/activate
(env) krystian@debian:~/projects/deform$ pip --version
pip 20.3.4 from /home/krystian/projects/deform/env/lib/python3.9/site-packages/pip (python 3.9)
(env) krystian@debian:~/projects/deform$ deactivate
krystian@debian:~/projects/deform$ $VENV/bin/pip3 install --user tox
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
krystian@debian:~/projects/deform$ python3 -m pip install --user tox
/usr/bin/python3: No module named pip
krystian@debian:~/projects/deform$ sudo apt-get install python3-pip
krystian@debian:~/projects/deform$ export VENV=~/projects/deform/env
krystian@debian:~/projects/deform$ export TOX=$(python3 -c 'import site; print(site.USER_BASE + "/bin")')/tox
krystian@debian:~/projects/deform$ $TOX -e py39
GLOB sdist-make: /home/krystian/projects/deform/setup.py
py39 create: /home/krystian/projects/deform/.tox/py39
py39 inst: /home/krystian/projects/deform/.tox/.tmp/package/1/deform-3.0.0.dev0.zip
py39 installed: attrs==21.4.0,beautifulsoup4==4.11.1,Chameleon==3.10.1,colander==1.8.3,coverage==6.4.1,deform @ file:///home/krystian/projects/deform/.tox/.tmp/package/1/deform-3.0.0.dev0.zip,flaky==3.7.0,hupper==1.10.3,iniconfig==1.1.1,iso8601==1.0.2,packaging==21.3,PasteDeploy==2.1.1,peppercorn==0.6,plaster==1.0,plaster-pastedeploy==0.7,pluggy==1.0.0,py==1.11.0,pyparsing==3.0.9,pyramid==2.0,pytest==7.1.2,pytest-cov==3.0.0,soupsieve==2.3.2.post1,tomli==2.0.1,translationstring==1.4,venusian==3.0.0,WebOb==1.8.7,zope.deprecation==4.4.0,zope.interface==5.4.0
py39 run-test-pre: PYTHONHASHSEED='1871869601'
py39 run-test: commands[0] | python --version
Python 3.9.2
py39 run-test: commands[1] | pytest
============================= test session starts ==============================
platform linux -- Python 3.9.2, pytest-7.1.2, pluggy-1.0.0
cachedir: .tox/py39/.pytest_cache
rootdir: /home/krystian/projects/deform, configfile: setup.cfg, testpaths: deform/tests
plugins: cov-3.0.0, flaky-3.7.0
collected 408 items
deform/tests/test_api.py . [ 0%]
deform/tests/test_decorator.py .. [ 0%]
deform/tests/test_exception.py . [ 0%]
deform/tests/test_field.py ............................................. [ 12%]
........................ [ 17%]
deform/tests/test_form.py .................. [ 22%]
deform/tests/test_functional.py ........... [ 25%]
deform/tests/test_interfaces.py . [ 25%]
deform/tests/test_renderer.py . [ 25%]
deform/tests/test_schema.py .......... [ 27%]
deform/tests/test_template.py .............. [ 31%]
deform/tests/test_widget.py ............................................ [ 42%]
........................................................................ [ 59%]
........................................................................ [ 77%]
........................................................................ [ 95%]
.................... [100%]
============================= 408 passed in 2.54s ==============================
___________________________________ summary ____________________________________
py39: commands succeeded
congratulations :)
That's... odd. It sounds like you are using the system Python, and not a user Python or pyenv with multiple Pythons. We use pyenv. We don't document its usage, though.
I'm going to ignore the failures for lint and functional tests, as this is only a documentation change, and merge this PR.
Fix the following error: