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

Cygwin job is broken on "Set up virtualenv" step #2004

Closed
EliahKagan opened this issue Feb 20, 2025 · 2 comments · Fixed by #2009
Closed

Cygwin job is broken on "Set up virtualenv" step #2004

EliahKagan opened this issue Feb 20, 2025 · 2 comments · Fixed by #2009

Comments

@EliahKagan
Copy link
Member

The Cygwin CI test job is failing now, including when rerun at the tip of the main branch where it formerly passed. The failure occurs in the "Set up virtualenv" step, which runs python -m venv .venv. The log does not how a detailed error message, just:

Run python -m venv .venv
  python -m venv .venv
  echo 'BASH_ENV=.venv/bin/activate' >>"$GITHUB_ENV"
  shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr "{0}"
  env:
    CHERE_INVOKING: 1
    CYGWIN_NOWINPATH: 1
    CYGWIN: 
+ python -m venv .venv
Error: Command '['/cygdrive/d/a/GitPython/GitPython/.venv/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
Error: Process completed with exit code 1.

I first noticed this when checking the current status of #1988 (see #1988 (comment)), but it is not specific to that PR.

I do not know why this happens.

@Byron
Copy link
Member

Byron commented Feb 21, 2025

It is very puzzling indeed, and seemingly impossible to error out without any form of message.

EliahKagan added a commit to EliahKagan/GitPython that referenced this issue Feb 21, 2025
Some of the other changes undertaken to investigate gitpython-developers#2004 may be of
value, but they don't seem to be needed to get it working, so let's
put them off to be evaluated later.
@EliahKagan
Copy link
Member Author

The absence of output is due to venv not showing the error in its output. In 4605dd6, I had venv not install pip but instead attempted to do so in a very similar way to how venv does, in a subsequent step. That produces this error:

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/usr/lib/python3.9/ensurepip/__init__.py", line [30](https://github.com/EliahKagan/GitPython/actions/runs/13454947366/job/37596811693#step:10:31), in <module>
    _SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools")
  File "/usr/lib/python3.9/ensurepip/__init__.py", line 27, in _get_most_recent_wheel_version
    return str(max(_wheels[pkg], key=distutils.version.LooseVersion))
ValueError: max() arg is an empty sequence

I haven't found a good way to fix this entirely, but in #2007 I have worked around it by having the Cygwin CI job install pip in the virtual environment using the bootstrap script, which fixes the problem that kept tests from running, but does not fix the problem for test_installation where it also separately occurs.

Byron added a commit that referenced this issue Feb 25, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Work around Cygwin CI failure #2004, except for `test_installation`
EliahKagan added a commit to EliahKagan/GitPython that referenced this issue Mar 6, 2025
Instead of downloading and running the boostrap script.

Various Cygwin packages have been tried here for gitpython-developers#2004, but I don't
recall having explicitly specified `python39-pip-wheel`. On the
Cygwin mailing list, Daniel Abrahamsson reported a problem that
seems to be the same as encountered here, and noted that installing
`python39-pip-wheel` fixed it. So maybe that will help here.

This commit also delists the `python39-virtualenv` pacakge, which
it looks like we have not been using (anytime recently) because it
actually provides the `virtualenv` module and command, while we are
using `venv` from the Python standard library, including on Cygwin.
EliahKagan added a commit to EliahKagan/GitPython that referenced this issue Mar 6, 2025
Instead of downloading and running the boostrap script.

Various Cygwin packages have been tried here for gitpython-developers#2004, but I don't
recall having explicitly specified `python39-pip-wheel`. On the
Cygwin mailing list, Daniel Abrahamsson reported a problem that
seems to be the same as encountered here, and noted that installing
`python39-pip-wheel` fixed it. So maybe that will help here. See:

https://cygwin.com/pipermail/cygwin/2025-March/257583.html

This commit also delists the `python39-virtualenv` pacakge, which
it looks like we have not been using (anytime recently) because it
actually provides the `virtualenv` module and command, while we are
using `venv` from the Python standard library, including on Cygwin.
EliahKagan added a commit to EliahKagan/GitPython that referenced this issue Mar 6, 2025
Instead of downloading and running the boostrap script.

Various Cygwin packages have been tried here for gitpython-developers#2004, but I don't
recall having explicitly specified `python39-pip-wheel`. On the
Cygwin mailing list, Daniel Abrahamsson reported a problem that
seems to be the same as encountered here, and noted that installing
`python-pip-wheel` fixed it. So maybe that will help here. See:

https://cygwin.com/pipermail/cygwin/2025-March/257583.html

This commit also delists the `python39-virtualenv` pacakge, which
it looks like we have not been using (anytime recently) because it
actually provides the `virtualenv` module and command, while we are
using `venv` from the Python standard library, including on Cygwin.
EliahKagan added a commit to EliahKagan/GitPython that referenced this issue Mar 6, 2025
Together with gitpython-developers#2007, this works around gitpython-developers#2004, allowing all tests to
pass on Cygwin CI.

In gitpython-developers#2007, installation of the environment in which tests run was
fixed by downloading and running the `get-pip.py` bootstrap script.
If we were to modify our helper that sets up the (separate) virtual
environment in `test_installation` so that it does the same thing
(or conditionally does so on CI, since the problem does not seem to
happen in local installations), that would likely "fix" this more
thoroughly, allowing the test to pass.

But part of the goal of the installation test is to test that
installation works in a typical environment on the platform it runs
on. So it is not obivous that making it pass in that way would be
an improvement compared to marking it `xfail` with the exception
type that occurs due to gitpython-developers#2004. So this just does that, for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants