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

AttributeError: 'NoneType' object has no attribute 'group' with virtualenv 20.0.32 on CygWin #1962

Closed
andy-maier opened this issue Oct 2, 2020 · 4 comments · Fixed by #1964
Labels

Comments

@andy-maier
Copy link

andy-maier commented Oct 2, 2020

Issue
We are also testing on CygWin (using appveyor), and since this morning, tox fails creating a virtualenv with an AttributeError. Unfortunately, tox does not display the entire traceback, but just the exception.
Since virtualenv 20.0.32 was released just 4h ago, I suspect that to be the culprit.

From https://ci.appveyor.com/project/andy-maier/pywbem/builds/35526352/job/l3k6a2vb39bweqsw#L936:

if "%UNIX_PATH%"=="C:\cygwin64\bin" ( bash -c "which tox && tox -vv -e %TOX_ENV% && echo appveyor.yml: tox rc=$?" )
/usr/bin/tox
using tox.ini: /cygdrive/c/projects/pywbem/tox.ini (pid 1822)
using tox-3.20.0 from /usr/lib/python3.8/site-packages/tox/__init__.py (pid 1822)
skipping sdist step
cygwin64_py38 uses /usr/bin/python3.8.exe
cygwin64_py38 start: getenv /cygdrive/c/projects/pywbem/.tox/cygwin64_py38
cygwin64_py38 cannot reuse: no previous config /cygdrive/c/projects/pywbem/.tox/cygwin64_py38/.tox-config1
cygwin64_py38 create: /cygdrive/c/projects/pywbem/.tox/cygwin64_py38
setting PATH=/cygdrive/c/projects/pywbem/.tox/cygwin64_py38/bin:/usr/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/ProgramData/chocolatey/bin
[1825] /cygdrive/c/projects/pywbem/.tox$ /usr/bin/python3.8.exe -m virtualenv --no-download --python /usr/bin/python3.8.exe cygwin64_py38
AttributeError: 'NoneType' object has no attribute 'group'
ERROR: invocation failed (exit code 1)
ERROR: InvocationError for command /usr/bin/python3.8.exe -m virtualenv --no-download --python /usr/bin/python3.8.exe cygwin64_py38 (exited with code 1)
cygwin64_py38 finish: getenv /cygdrive/c/projects/pywbem/.tox/cygwin64_py38 after 4.23 seconds

I am setting up a direct invocation of virtualenv in that environment, in order to get the full traceback, and will post that here.

Environment

Provide at least:

  • OS: CygWin64
  • pip list of the host python where virtualenv is installed:
    See next comment, below

Output of the virtual environment creation

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

See next comment, below
@andy-maier
Copy link
Author

Here is the full traceback of virtualenv, using -vvv --with-traceback:

if "%UNIX_PATH%"=="C:\cygwin64\bin" ( bash --noprofile --norc -c "%PYTHON_CMD% -m virtualenv -vvv --with-traceback --no-download --python %PYTHON_CMD% test_py38" )
133 setup logging to NOTSET [DEBUG report:43]
134 created app data folder /home/appveyor/.local/share/virtualenv [DEBUG __init__:30]
144 find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [INFO builtin:44]
144 proposed PythonInfo(spec=CPython3.8.3.final.0-64, exe=/usr/bin/python3.8.exe, platform=cygwin, version='3.8.3 (default, May 23 2020, 15:50:53) \n[GCC 9.3.0]', encoding_fs_io=utf-8-utf-8) [INFO builtin:50]
144 accepted PythonInfo(spec=CPython3.8.3.final.0-64, exe=/usr/bin/python3.8.exe, platform=cygwin, version='3.8.3 (default, May 23 2020, 15:50:53) \n[GCC 9.3.0]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:52]
147 filesystem is not case-sensitive [DEBUG info:28]
211 create virtual environment via CPython3Posix(dest=/cygdrive/c/projects/pywbem/test_py38, clear=False, global=False) [INFO session:52]
211 create folder /cygdrive/c/projects/pywbem/test_py38/bin [DEBUG _sync:25]
216 create folder /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages [DEBUG _sync:25]
216 write /cygdrive/c/projects/pywbem/test_py38/pyvenv.cfg [DEBUG pyenv_cfg:34]
216 	home = /usr [DEBUG pyenv_cfg:38]
216 	implementation = CPython [DEBUG pyenv_cfg:38]
216 	version_info = 3.8.3.final.0 [DEBUG pyenv_cfg:38]
216 	virtualenv = 20.0.32 [DEBUG pyenv_cfg:38]
217 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
217 	base-prefix = /usr [DEBUG pyenv_cfg:38]
217 	base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
217 	base-executable = /usr/bin/python3.8.exe [DEBUG pyenv_cfg:38]
220 symlink /usr/bin/python3.8.exe to /cygdrive/c/projects/pywbem/test_py38/bin/python [DEBUG _sync:44]
221 create virtualenv import hook file /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/_virtualenv.pth [DEBUG api:95]
222 create /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/_virtualenv.py [DEBUG api:98]
223 ============================== target debug ============================== [DEBUG session:54]
223 debug via /cygdrive/c/projects/pywbem/test_py38/bin/python /usr/lib/python3.8/site-packages/virtualenv/create/debug.py [DEBUG creator:213]
223 {
  "sys": {
    "executable": "/cygdrive/c/projects/pywbem/test_py38/bin/python",
    "_base_executable": "/cygdrive/c/projects/pywbem/test_py38/bin/python",
    "prefix": "/cygdrive/c/projects/pywbem/test_py38",
    "base_prefix": "/usr",
    "real_prefix": null,
    "exec_prefix": "/cygdrive/c/projects/pywbem/test_py38",
    "base_exec_prefix": "/usr",
    "path": [
      "/usr/lib/python38.zip",
      "/usr/lib/python3.8",
      "/usr/lib/python3.8/lib-dynload",
      "/cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "utf-8"
  },
  "version": "3.8.3 (default, May 23 2020, 15:50:53) \n[GCC 9.3.0]",
  "makefile_filename": "/usr/lib/python3.8/config-3.8-x86_64-cygwin/Makefile",
  "os": "<module 'os' from '/usr/lib/python3.8/os.py'>",
  "site": "<module 'site' from '/usr/lib/python3.8/site.py'>",
  "datetime": "<module 'datetime' from '/usr/lib/python3.8/datetime.py'>",
  "math": "<module 'math' from '/usr/lib/python3.8/lib-dynload/math.cpython-38-x86_64-cygwin.dll'>",
  "json": "<module 'json' from '/usr/lib/python3.8/json/__init__.py'>"
} [DEBUG session:55]
302 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/appveyor/.local/share/virtualenv) [INFO session:59]
309 wrote embed update of distribution setuptools at /home/appveyor/.local/share/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:162]
309 wrote embed update of distribution pip at /home/appveyor/.local/share/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:162]
309 wrote embed update of distribution wheel at /home/appveyor/.local/share/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:162]
347 triggered periodic upgrade of setuptools==50.3.0 (for python 3.8) via background process having PID 311 [INFO periodic_update:194]
386 triggered periodic upgrade of wheel==0.35.1 (for python 3.8) via background process having PID 312 [INFO periodic_update:194]
389 got embed update of distribution setuptools from /home/appveyor/.local/share/virtualenv/wheel/3.8/embed/1/setuptools.json [DEBUG via_disk_folder:133]
389 got embed update of distribution wheel from /home/appveyor/.local/share/virtualenv/wheel/3.8/embed/1/wheel.json [DEBUG via_disk_folder:133]
515 triggered periodic upgrade of pip==20.2.3 (for python 3.8) via background process having PID 313 [INFO periodic_update:194]
517 got embed update of distribution pip from /home/appveyor/.local/share/virtualenv/wheel/3.8/embed/1/pip.json [DEBUG via_disk_folder:133]
543 install setuptools from wheel /usr/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/setuptools-50.3.0-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
544 Attempting to acquire lock 123145287546336 on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any.lock [DEBUG filelock:270]
544 Lock 123145287546336 acquired on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any.lock [INFO filelock:274]
544 build install image for setuptools-50.3.0-py3-none-any.whl to /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any [DEBUG base:52]
679 install wheel from wheel /usr/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/wheel-0.35.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
679 Attempting to acquire lock 123145287461616 on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any.lock [DEBUG filelock:270]
680 install pip from wheel /usr/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:53]
681 Attempting to acquire lock 123145287461520 on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.3-py2.py3-none-any.lock [DEBUG filelock:270]
681 Lock 123145287461616 acquired on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any.lock [INFO filelock:274]
681 build install image for wheel-0.35.1-py2.py3-none-any.whl to /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any [DEBUG base:52]
682 Lock 123145287461520 acquired on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.3-py2.py3-none-any.lock [INFO filelock:274]
682 build install image for pip-20.2.3-py2.py3-none-any.whl to /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.3-py2.py3-none-any [DEBUG base:52]
1440 Attempting to release lock 123145287461616 on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any.lock [DEBUG filelock:315]
1441 Lock 123145287461616 released on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any.lock [INFO filelock:318]
1442 copy directory /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any/wheel to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/wheel [DEBUG _sync:52]
1485 copy directory /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any/wheel-0.35.1.dist-info to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/wheel-0.35.1.dist-info [DEBUG _sync:52]
1509 copy /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.35.1-py2.py3-none-any/wheel-0.35.1.virtualenv to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/wheel-0.35.1.virtualenv [DEBUG _sync:52]
1523 generated console scripts wheel3 wheel3.8 wheel-3.8 wheel [DEBUG base:48]
1698 Attempting to release lock 123145287546336 on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any.lock [DEBUG filelock:315]
1698 Lock 123145287546336 released on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any.lock [INFO filelock:318]
1700 copy /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any/distutils-precedence.pth to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/distutils-precedence.pth [DEBUG _sync:52]
1702 copy /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any/easy_install.py to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/easy_install.py [DEBUG _sync:52]
1704 copy directory /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any/pkg_resources to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/pkg_resources [DEBUG _sync:52]
1747 copy directory /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any/setuptools to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/setuptools [DEBUG _sync:52]
2037 Attempting to release lock 123145287461520 on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.3-py2.py3-none-any.lock [DEBUG filelock:315]
2038 Lock 123145287461520 released on /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.3-py2.py3-none-any.lock [INFO filelock:318]
2038 copy directory /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.3-py2.py3-none-any/pip to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/pip [DEBUG _sync:52]
2152 copy directory /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any/setuptools-50.3.0.dist-info to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/setuptools-50.3.0.dist-info [DEBUG _sync:52]
2168 copy /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any/setuptools-50.3.0.virtualenv to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/setuptools-50.3.0.virtualenv [DEBUG _sync:52]
2170 copy directory /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-50.3.0-py3-none-any/_distutils_hack to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/_distutils_hack [DEBUG _sync:52]
2179 generated console scripts easy_install3.8 easy_install3 easy_install easy_install-3.8 [DEBUG base:48]
3542 copy directory /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.3-py2.py3-none-any/pip-20.2.3.dist-info to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/pip-20.2.3.dist-info [DEBUG _sync:52]
3549 copy /home/appveyor/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.2.3-py2.py3-none-any/pip-20.2.3.virtualenv to /cygdrive/c/projects/pywbem/test_py38/lib/python3.8/site-packages/pip-20.2.3.virtualenv [DEBUG _sync:52]
3552 generated console scripts pip-3.8 pip3.8 pip3 pip [DEBUG base:48]
3552 add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [INFO session:64]
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.8/site-packages/virtualenv/__main__.py", line 77, in <module>
    run_with_catch()  # pragma: no cov
  File "/usr/lib/python3.8/site-packages/virtualenv/__main__.py", line 62, in run_with_catch
    run(args, options)
  File "/usr/lib/python3.8/site-packages/virtualenv/__main__.py", line 16, in run
    session = cli_run(args, options)
  File "/usr/lib/python3.8/site-packages/virtualenv/run/__init__.py", line 28, in cli_run
    of_session.run()
  File "/usr/lib/python3.8/site-packages/virtualenv/run/session.py", line 48, in run
    self._activate()
  File "/usr/lib/python3.8/site-packages/virtualenv/run/session.py", line 69, in _activate
    activator.generate(self.creator)
  File "/usr/lib/python3.8/site-packages/virtualenv/activation/via_template.py", line 29, in generate
    replacements = self.replacements(creator, dest_folder)
  File "/usr/lib/python3.8/site-packages/virtualenv/activation/via_template.py", line 41, in replacements
    virtual_env = "/" + match.group(1).lower() + match.group(2)
AttributeError: 'NoneType' object has no attribute 'group'

Here is the pip list from before invoking tox, i.e. in the environment when the above error happens:

pip 20.2.3 from /usr/lib/python3.8/site-packages/pip (python 3.8)
Package    Version
---------- -------
appdirs    1.4.4
distlib    0.3.1
filelock   3.0.12
packaging  20.4
pip        20.2.3
pluggy     0.13.1
py         1.9.0
pyparsing  2.4.7
setuptools 50.3.0
six        1.15.0
toml       0.10.1
tox        3.20.0
virtualenv 20.0.32
wheel      0.35.1

The above is both on CygWin with Python 3.8.
Appveyor run for the above: https://ci.appveyor.com/project/andy-maier/pywbem/builds/35526924/job/dhx7u89pe2tbebwu#L1045

@gaborbernat
Copy link
Contributor

cc @danyeaw seems #1952 introduced this

@danyeaw
Copy link
Sponsor Contributor

danyeaw commented Oct 2, 2020

@gaborbernat thanks I'll take a look

@gaborbernat
Copy link
Contributor

Looking at the above log it seems the path is already cygwin formatted (/cygdrive/c/projects/pywbem/test_py38/bin), so we probably should not transform already good paths. 👍 If you can put in a PR to fix this today that would be much appreciated. Thanks!

gaborbernat pushed a commit that referenced this issue Oct 3, 2020
Closes #1962. Corrects an AttributeError for a regex match not
found if the cygwin path is already in posix format.
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 29, 2020
https://build.opensuse.org/request/show/840217
by user StevenK + dimstar_suse
- Update to 20.0.33:
  * Fix ``None`` type error in cygwin if POSIX path in dest - by :user:`danyeaw`. (`#1962 <https://github.com/pypa/virtualenv/issues/1962>`_)
  * Fix Python 3.4 incompatibilities (added back to the CI) - by :user:`gaborbernat`. (`#1963 <https://github.com/pypa/virtualenv/issues/1963>`_)
  * For activation scripts always use UNIX line endings (unless it's BATCH shell related) - by :user:`saytosid`. (`#1818 <https://github.com/pypa/virtualenv/issues/1818>`_)
  * Avoid spawning new windows when doing seed package upgrades in the background on Windows - by :user:`gaborbernat`. (`#1928 <https://github.com/pypa/virtualenv/issues/1928>`_)
  * Fix a bug that reading and writing on the same file may cause race on multiple processes. (`#1938 <https://github.com/pypa/virtualenv/is
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants