Skip to content

ResourceWarning on env's setup #2472

@stanislavlevin

Description

@stanislavlevin

Issue
There are ResourceWarnings on virtual env creation.

Environment

  • pip list of the host python where virtualenv is installed:
(integration) [builder@localhost pyproject_installer]$ pip list
Package        Version
-------------- -------
attrs          22.2.0
distlib        0.3.6
exceptiongroup 1.1.0
filelock       3.8.2
iniconfig      1.1.1
packaging      22.0
pip            22.3.1
platformdirs   2.6.0
pluggy         1.0.0
pytest         7.2.0
setuptools     65.6.3
tomli          2.0.1
virtualenv     20.17.1
wheel          0.38.4

Output of the virtual environment creation

(integration) [builder@localhost pyproject_installer]$ python -W error::ResourceWarning -m virtualenv --no-setuptools --no-wheel -vvv --with-traceback test
280 setup logging to NOTSET [DEBUG report:35]
280 created app data folder /usr/src/.local/share/virtualenv [DEBUG __init__:40]
284 find interpreter for spec PythonSpec(path=/usr/src/RPM/BUILD/pyproject_installer/.tox/integration/bin/python) [INFO builtin:56]
284 discover exe for PythonInfo(spec=CPython3.10.8.final.0-64, exe=/usr/src/RPM/BUILD/pyproject_installer/.tox/integration/bin/python, platform=linux, version='3.10.8 (main, Dec 17 2022, 11:34:59) [GCC 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt2)]', encoding_fs_io=utf-8-utf-8) in /usr [DEBUG py_info:437]
284 filesystem is case-sensitive [DEBUG info:24]
285 Attempting to acquire lock 140183178084464 on /usr/src/.local/share/virtualenv/py_info/1/8a94588eda9d64d9e9a351ab8144e55b1fabf5113b54e67dd26a8c27df0381b3.lock [DEBUG _api:172]
285 Lock 140183178084464 acquired on /usr/src/.local/share/virtualenv/py_info/1/8a94588eda9d64d9e9a351ab8144e55b1fabf5113b54e67dd26a8c27df0381b3.lock [DEBUG _api:176]
286 get interpreter info via cmd: /usr/bin/python3.10 /usr/src/RPM/BUILD/pyproject_installer/.tox/integration/lib/python3/site-packages/virtualenv/discovery/py_info.py XjXJ3A7syvkfleqZinswfzCYUKpcUjxL deGvXS8ZsucZgjoK64iWvsew6As8FDQp [DEBUG cached_py_info:108]
390 wrote python info of /usr/bin/python3.10 at /usr/src/.local/share/virtualenv/py_info/1/8a94588eda9d64d9e9a351ab8144e55b1fabf5113b54e67dd26a8c27df0381b3.json [DEBUG via_disk_folder:155]
390 Attempting to release lock 140183178084464 on /usr/src/.local/share/virtualenv/py_info/1/8a94588eda9d64d9e9a351ab8144e55b1fabf5113b54e67dd26a8c27df0381b3.lock [DEBUG _api:209]
391 Lock 140183178084464 released on /usr/src/.local/share/virtualenv/py_info/1/8a94588eda9d64d9e9a351ab8144e55b1fabf5113b54e67dd26a8c27df0381b3.lock [DEBUG _api:212]
391 proposed PythonInfo(spec=CPython3.10.8.final.0-64, system=/usr/bin/python3.10, exe=/usr/src/RPM/BUILD/pyproject_installer/.tox/integration/bin/python, platform=linux, version='3.10.8 (main, Dec 17 2022, 11:34:59) [GCC 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt2)]', encoding_fs_io=utf-8-utf-8) [INFO builtin:63]
391 accepted PythonInfo(spec=CPython3.10.8.final.0-64, system=/usr/bin/python3.10, exe=/usr/src/RPM/BUILD/pyproject_installer/.tox/integration/bin/python, platform=linux, version='3.10.8 (main, Dec 17 2022, 11:34:59) [GCC 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt2)]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:65]
428 create virtual environment via CPython3Posix(dest=/usr/src/RPM/BUILD/pyproject_installer/test, clear=False, no_vcs_ignore=False, global=False) [INFO session:48]
429 write /usr/src/RPM/BUILD/pyproject_installer/test/pyvenv.cfg [DEBUG pyenv_cfg:30]
429     home = /usr/bin [DEBUG pyenv_cfg:34]
429     implementation = CPython [DEBUG pyenv_cfg:34]
429     version_info = 3.10.8.final.0 [DEBUG pyenv_cfg:34]
429     virtualenv = 20.17.1 [DEBUG pyenv_cfg:34]
429     include-system-site-packages = false [DEBUG pyenv_cfg:34]
429     base-prefix = /usr [DEBUG pyenv_cfg:34]
429     base-exec-prefix = /usr [DEBUG pyenv_cfg:34]
429     base-executable = /usr/bin/python3.10 [DEBUG pyenv_cfg:34]
429 remove file /usr/src/RPM/BUILD/pyproject_installer/test/bin/python [DEBUG _sync:22]
429 symlink /usr/bin/python3.10 to /usr/src/RPM/BUILD/pyproject_installer/test/bin/python [DEBUG _sync:28]
430 create virtualenv import hook file /usr/src/RPM/BUILD/pyproject_installer/test/lib/python3/site-packages/_virtualenv.pth [DEBUG api:89]
430 create /usr/src/RPM/BUILD/pyproject_installer/test/lib/python3/site-packages/_virtualenv.py [DEBUG api:92]
430 ============================== target debug ============================== [DEBUG session:50]
430 debug via /usr/src/RPM/BUILD/pyproject_installer/test/bin/python /usr/src/RPM/BUILD/pyproject_installer/.tox/integration/lib/python3/site-packages/virtualenv/create/debug.py [DEBUG creator:197]
430 {
  "sys": {
    "executable": "/usr/src/RPM/BUILD/pyproject_installer/test/bin/python",
    "_base_executable": "/usr/src/RPM/BUILD/pyproject_installer/test/bin/python",
    "prefix": "/usr/src/RPM/BUILD/pyproject_installer/test",
    "base_prefix": "/usr",
    "real_prefix": null,
    "exec_prefix": "/usr/src/RPM/BUILD/pyproject_installer/test",
    "base_exec_prefix": "/usr",
    "path": [
      "/usr/lib64/python310.zip",
      "/usr/lib64/python3.10",
      "/usr/lib64/python3.10/lib-dynload",
      "/usr/src/RPM/BUILD/pyproject_installer/test/lib64/python3/site-packages",
      "/usr/src/RPM/BUILD/pyproject_installer/test/lib/python3/site-packages"
    ],
    "meta_path": [
      "<class '_distutils_hack.DistutilsMetaFinder'>",
      "<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.10.8 (main, Dec 17 2022, 11:34:59) [GCC 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt2)]",
  "makefile_filename": "/usr/lib64/python3.10/config-3.10-x86_64-linux-gnu/Makefile",
  "os": "<module 'os' from '/usr/lib64/python3.10/os.py'>",
  "site": "<module 'site' from '/usr/lib64/python3.10/site.py'>",
  "datetime": "<module 'datetime' from '/usr/lib64/python3.10/datetime.py'>",
  "math": "<module 'math' from '/usr/lib64/python3.10/lib-dynload/math.cpython-310.so'>",
  "json": "<module 'json' from '/usr/lib64/python3.10/json/__init__.py'>"
} [DEBUG session:51]
512 add seed packages via FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/usr/src/.local/share/virtualenv) [INFO session:55]
515 wrote embed update of distribution pip at /usr/src/.local/share/virtualenv/wheel/3.10/embed/3/pip.json [DEBUG via_disk_folder:155]
517 triggered periodic upgrade of pip==22.3.1 (for python 3.10) via background process having PID 3708911 [INFO periodic_update:218]
Exception ignored in: <function Popen.__del__ at 0x7f7ef1a500d0>
Traceback (most recent call last):
  File "/usr/lib64/python3.10/subprocess.py", line 1072, in __del__
    _warn("subprocess %s is still running" % self.pid,
ResourceWarning: subprocess 3708911 is still running
Exception ignored in: <_io.FileIO name=3 mode='rb' closefd=True>
Traceback (most recent call last):
  File "/usr/src/RPM/BUILD/pyproject_installer/.tox/integration/lib/python3/site-packages/virtualenv/seed/wheels/periodic_update.py", line 70, in handle_auto_update
    trigger_update(distribution, for_py_version, wheel, search_dirs, app_data, periodic=True, env=env)
ResourceWarning: unclosed file <_io.BufferedReader name=3>
Exception ignored in: <_io.FileIO name=5 mode='rb' closefd=True>
Traceback (most recent call last):
  File "/usr/src/RPM/BUILD/pyproject_installer/.tox/integration/lib/python3/site-packages/virtualenv/seed/wheels/periodic_update.py", line 70, in handle_auto_update
    trigger_update(distribution, for_py_version, wheel, search_dirs, app_data, periodic=True, env=env)
ResourceWarning: unclosed file <_io.BufferedReader name=5>
...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions