Skip to content

AttributeError when creating Python 2 virtualenvs on macOS (arm64) #2269

@moreati

Description

@moreati

Issue

Creation of Python 2.7 virtualenv fails with AttributeError: 'bool' object has no attribute 'error' on macOS 12.x/arm64 using 51408e6. It may also other macOS releases, and on x86_64

In the test suite this causes est_python_activator_cross() to fail. I believe the error is a result of using a boolean returned by can_describe() as the return of can_create(). Prior to #2233 can_create() returned an instance of something else.

PR incoming.

Environment

Provide at least:

  • OS: macOS 12.1, on M1 Max (arm64)

  • pip list of the host python where virtualenv is installed:

    $ .tox/py39/bin/pip list
    Package                           Version
    --------------------------------- ---------------------
    attrs                             21.2.0
    backports.entry-points-selectable 1.1.1
    coverage                          6.2
    coverage-enable-subprocess        1.0
    distlib                           0.3.4
    filelock                          3.4.0
    flaky                             3.7.0
    freezegun                         1.1.0
    importlib-metadata                4.10.0
    iniconfig                         1.1.1
    packaging                         21.3
    pip                               21.3.1
    platformdirs                      2.4.0
    pluggy                            1.0.0
    py                                1.11.0
    pyparsing                         3.0.6
    pytest                            6.2.5
    pytest-env                        0.6.2
    pytest-freezegun                  0.4.2
    pytest-mock                       3.6.1
    pytest-randomly                   3.10.3
    pytest-timeout                    2.0.2
    python-dateutil                   2.8.2
    setuptools                        59.2.0
    six                               1.16.0
    toml                              0.10.2
    virtualenv                        20.12.1.dev1+g51408e6
    wheel                             0.37.0
    zipp                              3.6.0
    

Output of the virtual environment creation

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

$ .tox/py39/bin/python -mvirtualenv --python python2 -vvv --with-traceback v27
23 setup logging to NOTSET [DEBUG report:39]
27 find interpreter for spec PythonSpec(implementation=CPython, major=2) [INFO builtin:62]
27 discover exe for PythonInfo(spec=CPython3.9.9.final.0-64, exe=/Users/alex/src/virtualenv/.tox/py39/bin/python, platform=darwin, version='3.9.9 (main, Nov 21 2021, 03:16:13) \n[Clang 13.0.0 (clang-1300.0.29.3)]', encoding_fs_io=utf-8-utf-8) in /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9 [DEBUG py_info:403]
28 filesystem is not case-sensitive [DEBUG info:29]
28 Attempting to acquire lock 4389639552 on /Users/alex/Library/Application Support/virtualenv/py_info/1/345aa2f3f3153332aa0250f3057c4206b814c74c10594863073df44855256fe2.lock [DEBUG _api:165]
28 Lock 4389639552 acquired on /Users/alex/Library/Application Support/virtualenv/py_info/1/345aa2f3f3153332aa0250f3057c4206b814c74c10594863073df44855256fe2.lock [DEBUG _api:169]
28 got python info of /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/bin/python3.9 from /Users/alex/Library/Application Support/virtualenv/py_info/1/345aa2f3f3153332aa0250f3057c4206b814c74c10594863073df44855256fe2.json [DEBUG via_disk_folder:135]
29 Attempting to release lock 4389639552 on /Users/alex/Library/Application Support/virtualenv/py_info/1/345aa2f3f3153332aa0250f3057c4206b814c74c10594863073df44855256fe2.lock [DEBUG _api:199]
29 Lock 4389639552 released on /Users/alex/Library/Application Support/virtualenv/py_info/1/345aa2f3f3153332aa0250f3057c4206b814c74c10594863073df44855256fe2.lock [DEBUG _api:202]
29 Attempting to acquire lock 4389640176 on /Users/alex/Library/Application Support/virtualenv/py_info/1/50292dbb1f747f7151d445135d392af3138fb3c65386d17d9510cb605222b10b.lock [DEBUG _api:165]
29 Lock 4389640176 acquired on /Users/alex/Library/Application Support/virtualenv/py_info/1/50292dbb1f747f7151d445135d392af3138fb3c65386d17d9510cb605222b10b.lock [DEBUG _api:169]
29 got python info of /opt/homebrew/opt/[email protected]/bin/python3.9 from /Users/alex/Library/Application Support/virtualenv/py_info/1/50292dbb1f747f7151d445135d392af3138fb3c65386d17d9510cb605222b10b.json [DEBUG via_disk_folder:135]
29 Attempting to release lock 4389640176 on /Users/alex/Library/Application Support/virtualenv/py_info/1/50292dbb1f747f7151d445135d392af3138fb3c65386d17d9510cb605222b10b.lock [DEBUG _api:199]
29 Lock 4389640176 released on /Users/alex/Library/Application Support/virtualenv/py_info/1/50292dbb1f747f7151d445135d392af3138fb3c65386d17d9510cb605222b10b.lock [DEBUG _api:202]
29 proposed PythonInfo(spec=CPython3.9.9.final.0-64, system=/opt/homebrew/opt/[email protected]/bin/python3.9, exe=/Users/alex/src/virtualenv/.tox/py39/bin/python, platform=darwin, version='3.9.9 (main, Nov 21 2021, 03:16:13) \n[Clang 13.0.0 (clang-1300.0.29.3)]', encoding_fs_io=utf-8-utf-8) [INFO builtin:69]
30 discover PATH[0]=/opt/homebrew/bin [DEBUG builtin:114]
30 discover PATH[1]=/opt/homebrew/sbin [DEBUG builtin:114]
30 discover PATH[2]=/usr/local/bin [DEBUG builtin:114]
30 discover PATH[3]=/usr/bin [DEBUG builtin:114]
30 Attempting to acquire lock 4389412192 on /Users/alex/Library/Application Support/virtualenv/py_info/1/f92b2924b84ff19c1c3dc485f7644d4486f64738191026bf8e6de303969141b5.lock [DEBUG _api:165]
30 Lock 4389412192 acquired on /Users/alex/Library/Application Support/virtualenv/py_info/1/f92b2924b84ff19c1c3dc485f7644d4486f64738191026bf8e6de303969141b5.lock [DEBUG _api:169]
30 got python info of /usr/bin/python2 from /Users/alex/Library/Application Support/virtualenv/py_info/1/f92b2924b84ff19c1c3dc485f7644d4486f64738191026bf8e6de303969141b5.json [DEBUG via_disk_folder:135]
30 Attempting to release lock 4389412192 on /Users/alex/Library/Application Support/virtualenv/py_info/1/f92b2924b84ff19c1c3dc485f7644d4486f64738191026bf8e6de303969141b5.lock [DEBUG _api:199]
30 Lock 4389412192 released on /Users/alex/Library/Application Support/virtualenv/py_info/1/f92b2924b84ff19c1c3dc485f7644d4486f64738191026bf8e6de303969141b5.lock [DEBUG _api:202]
31 Attempting to acquire lock 4389529776 on /Users/alex/Library/Application Support/virtualenv/py_info/1/545e036c4b32438aced1f6b3c8d38ca151d9c36189e05839cb0aa568fda70ddd.lock [DEBUG _api:165]
31 Lock 4389529776 acquired on /Users/alex/Library/Application Support/virtualenv/py_info/1/545e036c4b32438aced1f6b3c8d38ca151d9c36189e05839cb0aa568fda70ddd.lock [DEBUG _api:169]
31 got python info of /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python from /Users/alex/Library/Application Support/virtualenv/py_info/1/545e036c4b32438aced1f6b3c8d38ca151d9c36189e05839cb0aa568fda70ddd.json [DEBUG via_disk_folder:135]
31 Attempting to release lock 4389529776 on /Users/alex/Library/Application Support/virtualenv/py_info/1/545e036c4b32438aced1f6b3c8d38ca151d9c36189e05839cb0aa568fda70ddd.lock [DEBUG _api:199]
31 Lock 4389529776 released on /Users/alex/Library/Application Support/virtualenv/py_info/1/545e036c4b32438aced1f6b3c8d38ca151d9c36189e05839cb0aa568fda70ddd.lock [DEBUG _api:202]
31 proposed PathPythonInfo(spec=CPython2.7.18.final.0-64, system=/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python, exe=/usr/bin/python2, platform=darwin, version='2.7.18 (default, Nov 13 2021, 06:17:34) \n[GCC Apple LLVM 13.0.0 (clang-1300.0.29.10) [+internal-os, ptrauth-isa=deployme', encoding_fs_io=utf-8-utf-8) [INFO builtin:69]
31 accepted PathPythonInfo(spec=CPython2.7.18.final.0-64, system=/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python, exe=/usr/bin/python2, platform=darwin, version='2.7.18 (default, Nov 13 2021, 06:17:34) \n[GCC Apple LLVM 13.0.0 (clang-1300.0.29.10) [+internal-os, ptrauth-isa=deployme', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:71]
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/alex/src/virtualenv/.tox/py39/lib/python3.9/site-packages/virtualenv/__main__.py", line 80, in <module>
    run_with_catch()  # pragma: no cov
  File "/Users/alex/src/virtualenv/.tox/py39/lib/python3.9/site-packages/virtualenv/__main__.py", line 65, in run_with_catch
    run(args, options, env)
  File "/Users/alex/src/virtualenv/.tox/py39/lib/python3.9/site-packages/virtualenv/__main__.py", line 18, in run
    session = cli_run(args, options, env)
  File "/Users/alex/src/virtualenv/.tox/py39/lib/python3.9/site-packages/virtualenv/run/__init__.py", line 30, in cli_run
    of_session = session_via_cli(args, options, setup_logging, env)
  File "/Users/alex/src/virtualenv/.tox/py39/lib/python3.9/site-packages/virtualenv/run/__init__.py", line 48, in session_via_cli
    parser, elements = build_parser(args, options, setup_logging, env)
  File "/Users/alex/src/virtualenv/.tox/py39/lib/python3.9/site-packages/virtualenv/run/__init__.py", line 74, in build_parser
    CreatorSelector(interpreter, parser),
  File "/Users/alex/src/virtualenv/.tox/py39/lib/python3.9/site-packages/virtualenv/run/plugin/creators.py", line 15, in __init__
    creators, self.key_to_meta, self.describe, self.builtin_key = self.for_interpreter(interpreter)
  File "/Users/alex/src/virtualenv/.tox/py39/lib/python3.9/site-packages/virtualenv/run/plugin/creators.py", line 27, in for_interpreter
    if meta.error:
AttributeError: 'bool' object has no attribute 'error'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions