[wkrd] Use pip install --editable --user
Prior to pip 21.1, pip install --editable --target fails because it results in wrong parameters being passed to setup.py develop by pip. Prior to setuptools 45.2.0, both pip install --editable --target and pip install --editable --prefix fail because the temporary install directory used internally by pip is not added to PYTHONPATH prior to pip calling setup.py develop. In later version setuptools emits a warning instead of an error. Temporarily override PYTHONUSERBASE to point to the target directory, so as to emulate --prefix=<dir> with PYTHONUSERBASE=<dir> and --user. This is needed for Python2 because pip 21.1 and setuptools 45.2.0 are both Python3 only.
-
Owner
I don't know if this is related but python2 tests seem to fail in loop https://erp5.nexedi.net/test_result_module/20240908-1310003AB
2024-09-09 01:54:19,002 INFO $ PATH=/srv/slapgrid/slappart6/srv/slapos/soft/53fcf681ef67cd4481fe1120e21c79d7/bin:/opt/slapos/parts/bison/bin:/opt/slapos/parts/bzip2/bin:/opt/slapos/parts/gettext/bin:/opt/slapos/parts/glib/bin:/opt/slapos/parts/libxml2/bin:/opt/slapos/parts/libxslt/bin:/opt/slapos/parts/m4/bin:/opt/slapos/parts/ncurses/bin:/opt/slapos/parts/openssl/bin:/opt/slapos/parts/pkgconfig/bin:/opt/slapos/parts/python3/bin:/opt/slapos/parts/readline/bin:/opt/slapos/parts/sqlite3/bin:/opt/slapos/parts/swig/bin:/opt/slapos/bin:/opt/slapos/parts/patch/bin:/opt/slapos/parts/socat/bin:/usr/bin:/usr/sbin:/sbin:/bin SLAPOS_TEST_LOG_DIRECTORY=/srv/slapgrid/slappart6/var/log/testnode/ddv-gcczHmoEQs SLAPOS_TEST_SHARED_PART_LIST=:/srv/slapgrid/slappart6/srv/shared:/srv/slapgrid/slappart6/t/ddv/shared /srv/slapgrid/slappart6/t/ddv/soft/fff494c099a0d2609cd92b10b9b49fdf/bin/runTestSuite_py /srv/slapgrid/slappart6/t/ddv/i/0/bin/runTestSuite --master_url $DISTRIBUTOR_URL --revision slapos=17024-9085318c2a9f896d28d1c2fab1fe68e630ccd6cf,slapos.buildout=1818-fb45b3e5e43a8ab7246d05e5f8ad7dce94c8e03d --test_node_title rapidspace-testnode-009-3Nodes-ERP5PROJECT1 --test_suite SLAPOS --test_suite_title SlapOS.Buildout.UnitTest-Master.Python2 --project_title 'Rapid.Space Project' 2024-09-09 01:54:19,812 INFO runTestSuite: Creating directory '/srv/slapgrid/slappart6/t/ddv/test_suite/eggs'. 2024-09-09 01:54:19,813 INFO runTestSuite: Creating directory '/srv/slapgrid/slappart6/t/ddv/test_suite/bin'. 2024-09-09 01:54:19,813 INFO runTestSuite: Creating directory '/srv/slapgrid/slappart6/t/ddv/test_suite/parts'. 2024-09-09 01:54:19,813 INFO runTestSuite: Creating directory '/srv/slapgrid/slappart6/t/ddv/test_suite/develop-eggs'. 2024-09-09 01:54:19,813 INFO runTestSuite: Develop: '/srv/slapgrid/slappart6/t/ddv/i/0/parts/slapos.buildout-repository' 2024-09-09 01:54:22,429 INFO runTestSuite: ERROR: Command errored out with exit status 1: 2024-09-09 01:54:22,430 INFO runTestSuite: command: /srv/slapgrid/slappart6/t/ddv/shared/python2.7/0caabaf5db1645243f5d32834d6c3d6e/bin/python2.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/srv/slapgrid/slappart6/t/ddv/i/0/parts/slapos.buildout-repository/setup.py'"'"'; __file__='"'"'/srv/slapgrid/slappart6/t/ddv/i/0/parts/slapos.buildout-repository/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= 2024-09-09 01:54:22,430 INFO runTestSuite: cwd: /srv/slapgrid/slappart6/t/ddv/i/0/parts/slapos.buildout-repository/ 2024-09-09 01:54:22,430 INFO runTestSuite: Complete output (6 lines): 2024-09-09 01:54:22,430 INFO runTestSuite: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] 2024-09-09 01:54:22,430 INFO runTestSuite: or: setup.py --help [cmd1 cmd2 ...] 2024-09-09 01:54:22,430 INFO runTestSuite: or: setup.py --help-commands 2024-09-09 01:54:22,430 INFO runTestSuite: or: setup.py cmd --help 2024-09-09 01:54:22,430 INFO runTestSuite: 2024-09-09 01:54:22,430 INFO runTestSuite: error: option --user not recognized 2024-09-09 01:54:22,430 INFO runTestSuite: ---------------------------------------- 2024-09-09 01:54:22,430 INFO runTestSuite: ERROR: Command errored out with exit status 1: /srv/slapgrid/slappart6/t/ddv/shared/python2.7/0caabaf5db1645243f5d32834d6c3d6e/bin/python2.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/srv/slapgrid/slappart6/t/ddv/i/0/parts/slapos.buildout-repository/setup.py'"'"'; __file__='"'"'/srv/slapgrid/slappart6/t/ddv/i/0/parts/slapos.buildout-repository/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output. 2024-09-09 01:54:22,763 INFO runTestSuite: Traceback (most recent call last): 2024-09-09 01:54:22,763 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/soft/fff494c099a0d2609cd92b10b9b49fdf/bin/runTestSuite_py", line 37, in <module> 2024-09-09 01:54:22,763 INFO runTestSuite: exec(compile(__file__f.read(), __file__, "exec")) 2024-09-09 01:54:22,763 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/i/0/bin/runTestSuite", line 139, in <module> 2024-09-09 01:54:22,763 INFO runTestSuite: main() 2024-09-09 01:54:22,763 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/i/0/bin/runTestSuite", line 129, in main 2024-09-09 01:54:22,763 INFO runTestSuite: Buildout('buildout.cfg', {}).install(None) 2024-09-09 01:54:22,763 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/soft/fff494c099a0d2609cd92b10b9b49fdf/eggs/zc.buildout-3.0.1+slapos004-py2.7.egg/zc/buildout/buildout.py", line 855, in install 2024-09-09 01:54:22,763 INFO runTestSuite: self._install_parts(install_args) 2024-09-09 01:54:22,763 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/soft/fff494c099a0d2609cd92b10b9b49fdf/eggs/zc.buildout-3.0.1+slapos004-py2.7.egg/zc/buildout/buildout.py", line 890, in _install_parts 2024-09-09 01:54:22,763 INFO runTestSuite: installed_develop_eggs = self._develop() 2024-09-09 01:54:22,764 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/soft/fff494c099a0d2609cd92b10b9b49fdf/eggs/zc.buildout-3.0.1+slapos004-py2.7.egg/zc/buildout/buildout.py", line 1139, in _develop 2024-09-09 01:54:22,764 INFO runTestSuite: verbosity=-20) 2024-09-09 01:54:22,764 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/soft/fff494c099a0d2609cd92b10b9b49fdf/eggs/zc.buildout-3.0.1+slapos004-py2.7.egg/zc/buildout/easy_install.py", line 1253, in develop 2024-09-09 01:54:22,764 INFO runTestSuite: directory, tmp3, options, verbosity=verbosity) 2024-09-09 01:54:22,764 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/soft/fff494c099a0d2609cd92b10b9b49fdf/eggs/zc.buildout-3.0.1+slapos004-py2.7.egg/zc/buildout/easy_install.py", line 2051, in call_pip_editable 2024-09-09 01:54:22,764 INFO runTestSuite: options, verbosity) 2024-09-09 01:54:22,764 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/soft/fff494c099a0d2609cd92b10b9b49fdf/eggs/zc.buildout-3.0.1+slapos004-py2.7.egg/zc/buildout/easy_install.py", line 2007, in call_pip_command 2024-09-09 01:54:22,764 INFO runTestSuite: subprocess.check_call(args, env=env) 2024-09-09 01:54:22,764 INFO runTestSuite: File "/srv/slapgrid/slappart6/t/ddv/shared/python2.7/0caabaf5db1645243f5d32834d6c3d6e/lib/python2.7/subprocess.py", line 190, in check_call 2024-09-09 01:54:22,764 INFO runTestSuite: raise CalledProcessError(retcode, cmd) 2024-09-09 01:54:22,764 INFO runTestSuite: subprocess.CalledProcessError: Command '['/srv/slapgrid/slappart6/t/ddv/shared/python2.7/0caabaf5db1645243f5d32834d6c3d6e/bin/python2.7', '-m', 'pip', 'install', '--user', '--no-deps', '-qq', '--no-cache-dir', '--editable', '/srv/slapgrid/slappart6/t/ddv/i/0/parts/slapos.buildout-repository']' returned non-zero exit status 1
-
Owner
Thanks @jerome for pointing this out. This is indeed related.
After investigating for a while, I found what was going on: the buildout.cfg of buildout-testing's runTestSuite (used for setting up the tests) does not set
allow-picked-versions=false
, thuspip
uses build isolation (the default for pip) when installing runningpip install --editable <buildout-repository>
to install buildout in develop mode from sources (for the tests), which a) reinstalls setuptools and b) breaks--user
option.So the fix I have in mind will be to force
--no-build-isolation
when we're in this# BBB pip < 21.1, setuptools < 45.2.0, Python2
case. -
Owner
I think this is fixed in !35 (merged) @xavier_thompson ?
If yes, could you mark this thread as resolved ?
-
Owner
this is a comment on a commit so we can't mark it as "Resolved". But it is "resolved". I don't know why this comment is displayed on !34 (merged)