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

[regression] When there's setup.cfg with attr: in CWD, pip install crashes under virtualenv 20+ #1685

Closed
webknjaz opened this issue Mar 2, 2020 · 12 comments · Fixed by #1688
Labels

Comments

@webknjaz
Copy link
Member

webknjaz commented Mar 2, 2020

Issue

$sbj. Possibly related to #1670.
Reproducible under Python 2 specifically, doesn't seem to affect py3.

Repro

  1. Create setup.cfg in CWD
$ cat setup.cfg 
[metadata]
name = boom
version = attr: boom.versiontools.get_self_version
python2 -m pip install 'virtualenv >= 20'
python2 -m virtualenv test-venv-py2
  1. DON'T CHDIR ELSEWHERE
  2. Install some existing package there:
test-venv-py2/bin/pip install setuptools

(not necessarily setuptools, could be pip, six, anything really, but has to exist on PyPI)

  1. Observe an ImportError because it loads the config from CWD which in turn tries to import boom.versiontools.get_self_version:
$ test-venv-py2/bin/pip install setuptools
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: setuptools in ~/src/github/experiments/boom/test-venv-py2/lib/python2.7/site-packages (44.0.0)
ERROR: Exception:
Traceback (most recent call last):
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 412, in run
    isolated=options.isolated_mode,
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 543, in get_lib_location_guesses
    scheme = distutils_scheme('', *args, **kwargs)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/pip/_internal/locations.py", line 109, in distutils_scheme
    d.parse_config_files()
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site.py", line 153, in parse_config_files
    result = old_parse_config_files(self, *args, **kwargs)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site.py", line 153, in parse_config_files
    result = old_parse_config_files(self, *args, **kwargs)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/_distutils_patch_virtualenv.py", line 19, in parse_config_files
    result = old_parse_config_files(self, *args, **kwargs)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/dist.py", line 702, in parse_config_files
    ignore_option_errors=ignore_option_errors)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 121, in parse_configuration
    meta.parse()
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 426, in parse
    section_parser_method(section_options)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 399, in parse_section
    self[name] = value
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 184, in __setitem__
    value = parser(value)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 515, in _parse_version
    version = self._parse_attr(value, self.package_dir)
  File "~/src/experiments/boom/test-venv-py2/lib/python2.7/site-packages/setuptools/config.py", line 349, in _parse_attr
    module = import_module(module_name)
  File "~/.pyenv/versions/2.7.15/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named boom.versiontools

Environment

  • OS: Gentoo Linux (also reproducible under centos:7 docker container)

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

      $ python2 -m pip list                                      
      Package             Version    
      ------------------- -----------
      appdirs             1.4.3      
      configparser        4.0.2      
      contextlib2         0.6.0.post1
      distlib             0.3.0      
      filelock            3.0.12     
      importlib-metadata  1.5.0      
      importlib-resources 1.1.0      
      pathlib2            2.3.5      
      pip                 18.1       
      scandir             1.10.0     
      setuptools          40.5.0     
      singledispatch      3.4.0.3    
      six                 1.14.0     
      typing              3.7.4.1    
      virtualenv          20.0.7     
      wheel               0.32.2     
      zipp                1.2.0      
      You are using pip version 18.1, however version 20.0.2 is available.
      You should consider upgrading via the 'pip install --upgrade pip' command.

Output of the virtual environment creation

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

$ python2 -m virtualenv -vvv --with-traceback test-venv-py2
58 setup logging to NOTSET [DEBUG report:43]
69 find interpreter for spec PythonSpec(path=~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/bin/python2) [INFO builtin:44]
69 discover exe for PythonInfo(spec=CPython2.7.15.final.0-64, exe=~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/bin/python2, platform=linux2, version=u'2.7.15 (default, Sep 25 2018, 19:19:39) \n[GCC 7.3.0]', encoding_fs_io=UTF-8-UTF-8) in ~/.pyenv/versions/2.7.15 [DEBUG py_info:340]
70 filesystem is case-sensitive [DEBUG info:28]
71 Attempting to acquire lock 139774354598416 on ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.lock [DEBUG filelock:270]
72 Lock 139774354598416 acquired on ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.lock [INFO filelock:274]
72 get PythonInfo from ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.json for ~/.pyenv/versions/2.7.15/bin/python2.7 [DEBUG cached_py_info:76]
73 Attempting to release lock 139774354598416 on ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.lock [DEBUG filelock:315]
73 Lock 139774354598416 released on ~/.local/share/virtualenv/py_info/20.0.7/0743af9fc1da334fdaa3884a6e8f56610e0b07773619ca8d43ce29ac2a098866.lock [INFO filelock:318]
73 proposed PythonInfo({u'base_exec_prefix': None, u'system_stdlib': u'~/.pyenv/versions/2.7.15/lib/python2.7', u'has_venv': False, u'prefix': u'~/.pyenv/versions/2.7.15', u'stdout_encoding': None, u'executable': '~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/bin/python2', u'implementation': u'CPython', u'exec_prefix': u'~/.pyenv/versions/2.7.15', u'platform': u'linux2', u'version': u'2.7.15 (default, Sep 25 2018, 19:19:39) \n[GCC 7.3.0]', u'sysconfig_paths': {u'platstdlib': u'{platbase}/lib/python{py_version_short}', u'platlib': u'{platbase}/lib/python{py_version_short}/site-packages', u'purelib': u'{base}/lib/python{py_version_short}/site-packages', u'stdlib': u'{base}/lib/python{py_version_short}', u'scripts': u'{base}/bin', u'include': u'{base}/include/python{py_version_short}', u'data': u'{base}'}, u'base_prefix': None, u'file_system_encoding': u'UTF-8', u'version_info': VersionInfo(major=2, minor=7, micro=15, releaselevel=u'final', serial=0), u'sysconfig_vars': {u'base': u'~/.pyenv/versions/2.7.15', u'platbase': u'~/.pyenv/versions/2.7.15', u'PYTHONFRAMEWORK': u'', u'py_version_short': u'2.7'}, u'path': [u'~/.pyenv/versions/2.7.15/envs/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/discovery', u'~/.pyenv/versions/2.7.15/lib/python27.zip', u'~/.pyenv/versions/2.7.15/lib/python2.7', u'~/.pyenv/versions/2.7.15/lib/python2.7/plat-linux2', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-tk', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-old', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload', u'~/.pyenv/versions/2.7.15/lib/python2.7/site-packages'], u'max_size': 9223372036854775807, u'real_prefix': None, u'distutils_install': {u'purelib': u'lib/python2.7/site-packages', u'headers': u'include/python2.7/UNKNOWN', u'platlib': u'lib/python2.7/site-packages', u'data': u'', u'scripts': u'bin'}, u'architecture': 64, u'original_executable': u'~/.pyenv/versions/2.7.15/bin/python2.7', u'os': u'posix', u'system_executable': u'~/.pyenv/versions/2.7.15/bin/python2.7'}) [INFO builtin:50]
74 accepted PythonInfo({u'base_exec_prefix': None, u'system_stdlib': u'~/.pyenv/versions/2.7.15/lib/python2.7', u'has_venv': False, u'prefix': u'~/.pyenv/versions/2.7.15', u'stdout_encoding': None, u'executable': '~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/bin/python2', u'implementation': u'CPython', u'exec_prefix': u'~/.pyenv/versions/2.7.15', u'platform': u'linux2', u'version': u'2.7.15 (default, Sep 25 2018, 19:19:39) \n[GCC 7.3.0]', u'sysconfig_paths': {u'platstdlib': u'{platbase}/lib/python{py_version_short}', u'platlib': u'{platbase}/lib/python{py_version_short}/site-packages', u'purelib': u'{base}/lib/python{py_version_short}/site-packages', u'stdlib': u'{base}/lib/python{py_version_short}', u'scripts': u'{base}/bin', u'include': u'{base}/include/python{py_version_short}', u'data': u'{base}'}, u'base_prefix': None, u'file_system_encoding': u'UTF-8', u'version_info': VersionInfo(major=2, minor=7, micro=15, releaselevel=u'final', serial=0), u'sysconfig_vars': {u'base': u'~/.pyenv/versions/2.7.15', u'platbase': u'~/.pyenv/versions/2.7.15', u'PYTHONFRAMEWORK': u'', u'py_version_short': u'2.7'}, u'path': [u'~/.pyenv/versions/2.7.15/envs/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/discovery', u'~/.pyenv/versions/2.7.15/lib/python27.zip', u'~/.pyenv/versions/2.7.15/lib/python2.7', u'~/.pyenv/versions/2.7.15/lib/python2.7/plat-linux2', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-tk', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-old', u'~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload', u'~/.pyenv/versions/2.7.15/lib/python2.7/site-packages'], u'max_size': 9223372036854775807, u'real_prefix': None, u'distutils_install': {u'purelib': u'lib/python2.7/site-packages', u'headers': u'include/python2.7/UNKNOWN', u'platlib': u'lib/python2.7/site-packages', u'data': u'', u'scripts': u'bin'}, u'architecture': 64, u'original_executable': u'~/.pyenv/versions/2.7.15/bin/python2.7', u'os': u'posix', u'system_executable': u'~/.pyenv/versions/2.7.15/bin/python2.7'}) [DEBUG builtin:52]
107 create virtual environment via CPython2Posix(dest=~/src/github/ansible/ansible-lint/test-venv-py2, clear=False, global=False) [INFO session:52]
107 create folder ~/src/github/ansible/ansible-lint/test-venv-py2/bin [DEBUG _sync:21]
108 create folder ~/src/github/ansible/ansible-lint/test-venv-py2/include [DEBUG _sync:21]
108 create folder ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages [DEBUG _sync:21]
108 write ~/src/github/ansible/ansible-lint/test-venv-py2/pyvenv.cfg [DEBUG pyenv_cfg:34]
108 	home = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
108 	implementation = CPython [DEBUG pyenv_cfg:38]
108 	version_info = 2.7.15.final.0 [DEBUG pyenv_cfg:38]
108 	virtualenv = 20.0.7 [DEBUG pyenv_cfg:38]
108 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
108 	base-prefix = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
108 	base-exec-prefix = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
108 	base-executable = ~/.pyenv/versions/2.7.15/bin/python2.7 [DEBUG pyenv_cfg:38]
108 copy ~/.pyenv/versions/2.7.15/bin/python2.7 to ~/src/github/ansible/ansible-lint/test-venv-py2/bin/python [DEBUG _sync:48]
114 symlink ~/.pyenv/versions/2.7.15/lib/python2.7/os.py to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/os.py [DEBUG _sync:40]
115 symlink ~/.pyenv/versions/2.7.15/lib/python2.7/os.pyc to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/os.pyc [DEBUG _sync:40]
115 symlink directory ~/.pyenv/versions/2.7.15/include/python2.7 to ~/src/github/ansible/ansible-lint/test-venv-py2/include/python2.7 [DEBUG _sync:40]
115 symlink directory ~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/lib-dynload [DEBUG _sync:40]
115 add distutils patch file ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/_distutils_patch_virtualenv.py [DEBUG api:63]
116 add distutils patch file ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/_distutils_patch_virtualenv.pth [DEBUG api:67]
116 ============================== target debug ============================== [DEBUG session:54]
117 debug via ~/src/github/ansible/ansible-lint/test-venv-py2/bin/python ~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/create/debug.py [DEBUG creator:182]
116 {
  "site": "<module 'site' from '~/.pyenv/versions/2.7.15/lib/python2.7/site.pyc'>", 
  "datetime": "<module 'datetime' from '~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload/datetime.so'>", 
  "sys": {
    "executable": "~/src/github/ansible/ansible-lint/test-venv-py2/bin/python", 
    "real_prefix": "~/.pyenv/versions/2.7.15", 
    "base_exec_prefix": "~/.pyenv/versions/2.7.15", 
    "exec_prefix": "~/src/github/ansible/ansible-lint/test-venv-py2", 
    "io_encoding": null, 
    "meta_path": [], 
    "fs_encoding": "UTF-8", 
    "prefix": "~/src/github/ansible/ansible-lint/test-venv-py2", 
    "_base_executable": null, 
    "path": [
      "~/.pyenv/versions/2.7.15/lib/python27.zip", 
      "~/.pyenv/versions/2.7.15/lib/python2.7", 
      "~/.pyenv/versions/2.7.15/lib/python2.7/plat-linux2", 
      "~/.pyenv/versions/2.7.15/lib/python2.7/lib-tk", 
      "~/.pyenv/versions/2.7.15/lib/python2.7/lib-old", 
      "~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload", 
      "~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages"
    ], 
    "base_prefix": "~/.pyenv/versions/2.7.15"
  }, 
  "json": "<module 'json' from '~/.pyenv/versions/2.7.15/lib/python2.7/json/__init__.pyc'>", 
  "version": "2.7.15 (default, Sep 25 2018, 19:19:39) \n[GCC 7.3.0]", 
  "os": "<module 'os' from '~/.pyenv/versions/2.7.15/lib/python2.7/os.pyc'>", 
  "math": "<module 'math' from '~/.pyenv/versions/2.7.15/lib/python2.7/lib-dynload/math.so'>"
} [DEBUG session:55]
146 add seed packages via FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=~/.local/share/virtualenv/seed-app-data/v1) [INFO session:59]
146 Attempting to acquire lock 139774343684496 on ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels.lock [DEBUG filelock:270]
146 Lock 139774343684496 acquired on ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels.lock [INFO filelock:274]
147 get bundled wheel ~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/seed/embed/wheels/pip-20.0.2-py2.py3-none-any.whl [DEBUG acquire:51]
148 get bundled wheel ~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/seed/embed/wheels/wheel-0.34.2-py2.py3-none-any.whl [DEBUG acquire:51]
148 get bundled wheel ~/.pyenv/versions/ansible-lint-py2.7.15-pyenv-venv/lib/python2.7/site-packages/virtualenv/seed/embed/wheels/setuptools-44.0.0-py2.py3-none-any.whl [DEBUG acquire:51]
150 install wheel from wheel ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels/wheel-0.34.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
150 install pip from wheel ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels/pip-20.0.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
151 install setuptools from wheel ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels/setuptools-44.0.0-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
151 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/wheel [DEBUG _sync:48]
151 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/pip [DEBUG _sync:48]
152 copy ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/easy_install.py to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/easy_install.py [DEBUG _sync:48]
152 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/pkg_resources to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/pkg_resources [DEBUG _sync:48]
156 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.dist-info to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/wheel-0.34.2.dist-info [DEBUG _sync:48]
158 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/setuptools to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/setuptools [DEBUG _sync:48]
159 copy ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.virtualenv to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/wheel-0.34.2.virtualenv [DEBUG _sync:48]
160 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/wheel to 755 [INFO util:566]
160 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/wheel-2.7 to 755 [INFO util:566]
161 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/wheel2 to 755 [INFO util:566]
161 generated console scripts wheel wheel2 wheel-2.7 [DEBUG base:53]
175 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/setuptools-44.0.0.dist-info to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/setuptools-44.0.0.dist-info [DEBUG _sync:48]
177 copy ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/setuptools-44.0.0-py2.py3-none-any/setuptools-44.0.0.virtualenv to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/setuptools-44.0.0.virtualenv [DEBUG _sync:48]
178 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/easy_install to 755 [INFO util:566]
179 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/easy_install2 to 755 [INFO util:566]
179 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/easy_install-2.7 to 755 [INFO util:566]
180 generated console scripts easy_install easy_install2 easy_install-2.7 [DEBUG base:53]
219 copy directory ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip-20.0.2.dist-info to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/pip-20.0.2.dist-info [DEBUG _sync:48]
221 copy ~/.local/share/virtualenv/seed-app-data/v1/2.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip-20.0.2.virtualenv to ~/src/github/ansible/ansible-lint/test-venv-py2/lib/python2.7/site-packages/pip-20.0.2.virtualenv [DEBUG _sync:48]
222 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/pip to 755 [INFO util:566]
222 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/pip-2.7 to 755 [INFO util:566]
222 changing mode of ~/src/github/ansible/ansible-lint/test-venv-py2/bin/pip2 to 755 [INFO util:566]
222 generated console scripts pip pip-2.7 pip2 [DEBUG base:53]
223 Attempting to release lock 139774343684496 on ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels.lock [DEBUG filelock:315]
223 Lock 139774343684496 released on ~/.local/share/virtualenv/seed-app-data/v1/2.7/wheels.lock [INFO filelock:318]
223 add activators for Python, CShell, Fish, PowerShell, Bash [INFO session:65]
226 write ~/src/github/ansible/ansible-lint/test-venv-py2/pyvenv.cfg [DEBUG pyenv_cfg:34]
226 	home = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
226 	implementation = CPython [DEBUG pyenv_cfg:38]
226 	version_info = 2.7.15.final.0 [DEBUG pyenv_cfg:38]
226 	virtualenv = 20.0.7 [DEBUG pyenv_cfg:38]
226 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
226 	base-prefix = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
227 	base-exec-prefix = ~/.pyenv/versions/2.7.15 [DEBUG pyenv_cfg:38]
227 	base-executable = ~/.pyenv/versions/2.7.15/bin/python2.7 [DEBUG pyenv_cfg:38]
227 created virtual environment CPython2.7.15.final.0-64 in 170ms
  creator CPython2Posix(dest=~/src/github/ansible/ansible-lint/test-venv-py2, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=~/.local/share/virtualenv/seed-app-data/v1)
  activators PythonActivator,CShellActivator,FishActivator,PowerShellActivator,BashActivator [WARNING __main__:21]

Ref: ansible/ansible-lint#683

@gaborbernat
Copy link
Contributor

Observe an ImportError because it loads the config from CWD which in turn tries to import boom.versiontools.get_self_version

Isn't that what it should do? What should happen here in your expectation?

@webknjaz
Copy link
Member Author

webknjaz commented Mar 4, 2020

It doesn't try to import things under Python 3 / Python 2 + virtualenv 16. But under Python 2 + virtualenv 20 it explodes.

@webknjaz
Copy link
Member Author

webknjaz commented Mar 4, 2020

And no, it shouldn't explode when you're installing other packages just because you have something in CWD.

@gaborbernat
Copy link
Contributor

@webknjaz are you 100% that it does not import on old virtualenv? (maybe it just fails on 20+) - it's a setuptools internal implementation detail

@webknjaz
Copy link
Member Author

webknjaz commented Mar 4, 2020

Positive. It fails on virtualenv 20+ but only combined with Python 2, that's what I'm saying.

@gaborbernat
Copy link
Contributor

#1688 will likely fix it, can you check?

@webknjaz
Copy link
Member Author

webknjaz commented Mar 4, 2020

Okay, I'll check.

@webknjaz
Copy link
Member Author

webknjaz commented Mar 4, 2020

Regression demo:
asciicast

(haven't checked that PR yet)

@webknjaz
Copy link
Member Author

webknjaz commented Mar 4, 2020

Confirmed. PR #1688 fixes it:
asciicast

@gaborbernat
Copy link
Contributor

Thanks, will merge that today, and cut a release.

@gaborbernat
Copy link
Contributor

Hello, a fix for this issue has been released via virtualenv 20.0.8; see https://pypi.org/project/virtualenv/20.0.8/ (https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-8-2020-03-04). Please give a try and report back if your issue has not been addressed; if not, please comment here, and we'll reopen the ticket. We want to apologize for the inconvenience this has caused you and say thanks for having patience while we resolve the unexpected bugs with this new major release.
thanks

@webknjaz
Copy link
Member Author

webknjaz commented Mar 4, 2020

Thank you @gaborbernat for the responsive fix and stealth release! Your work is much appreciated!

@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.

2 participants