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

Calling pip download on non-utf system can fail if user home folder has non ASCII chars #2780

Open
rressi-at-globus opened this issue Oct 9, 2024 · 1 comment

Comments

@rressi-at-globus
Copy link

Issue

At this line:

The tool virtualenv is launching pip as a child process:

  • It set the I/O encoding to utf-8
  • But pip may have a different opinion as the encoding is system dependent.

When pip runs and there are some non-asci characters with his traces we may have failures leading to out being set to None.

Environment

Provide at least:

  • OS: Windows 11 (possibly any version of Windows)

Just bare Python embed for Windows:

Very very important to reproduce this issue:

  • The user has a home folder with non-ASCII characters in the path.
  • With another user with the home folder with only ASCII chars everything is fine.

The command which is failing:

{
    "args": [
        "C:/Development/gm-venv/bootstrap_3.12.6-1a8994a/python.exe",
        "-m",
        "virtualenv",
        "C:/Development/gm-venv/venv_da29d03",
        "--always-copy",
        "--download",
        "--prompt",
        "venv_da29d03"
    ],
    "cwd": "C:/Development/gm-venv",
    "env": {
        ...
    }

Note: by adding to the environment "PYTHONIOENCODING": "utf-8", the issue is worked around and everything is fine.

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

fail
Traceback (most recent call last):
  File "C:\Development\gm-venv\bootstrap_3.12.6-1a8994a\Lib\site-packages\virtualenv\seed\embed\via_app_data\via_app_data.py", line 84, in _get
    result = get_wheel(
             ^^^^^^^^^^
  File "C:\Development\gm-venv\bootstrap_3.12.6-1a8994a\Lib\site-packages\virtualenv\seed\wheels\acquire.py", line 36, in get_wheel
    wheel = download_wheel(
            ^^^^^^^^^^^^^^^
  File "C:\Development\gm-venv\bootstrap_3.12.6-1a8994a\Lib\site-packages\virtualenv\seed\wheels\acquire.py", line 77, in download_wheel
    result = _find_downloaded_wheel(distribution, version_spec, for_py_version, to_folder, out)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Development\gm-venv\bootstrap_3.12.6-1a8994a\Lib\site-packages\virtualenv\seed\wheels\acquire.py", line 83, in _find_downloaded_wheel
    for line in out.splitlines():
                ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'splitlines'
@gaborbernat
Copy link
Contributor

PR welcome 😊

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

No branches or pull requests

2 participants