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

ResourceWarning: unclosed file #6151

Open
hibuna opened this issue May 10, 2024 · 2 comments
Open

ResourceWarning: unclosed file #6151

hibuna opened this issue May 10, 2024 · 2 comments

Comments

@hibuna
Copy link

hibuna commented May 10, 2024

diagnose documentation

I run into the following warning when I run pipenv install -r requirements.txt:

/home/hibuna/test/test-env/lib/python3.11/site-packages/pipenv/patched/pip/_vendor/urllib3/_collections.py:189: ResourceWarning: unclosed file <_io.FileIO name='/tmp/tmplaglsvs4' mode='rb+' closefd=True>
along with a few others....

The above happened when I:
pipenv install flask
pipenv requirements > requirements.txt
pipenv install -r requirements.txt.
This also applies when making the requirements.txt with pipenv run pip freeze > requirements.txt.

I get similar error(s) when trying it with a different packages, the file where the error appears is always some /home/hibuna/test/test-env/lib/python3.11/site-packages/pipenv/...

My setup is a WSL debian 12 (bookworm).

cat /etc/wsl.conf >>

[interop]
appendWindowsPath=false

When logged in as regular user with sudo:
sudo apt update
sudo apt upgrade
sudo apt install python3 python3-pip
mkdir test && cd test
python3 -m venv test-env
source test-env/bin/activate
pip install pipenv
then the above commands.

It doesn't seem to break anything so far.

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).


$ pipenv --support

Pipenv version: '2023.12.1'

Pipenv location: '/home/hibuna/test/testttt/test-env/lib/python3.11/site-packages/pipenv'

Python location: '/home/hibuna/test/testttt/test-env/bin/python3'

OS Name: 'posix'

User pip version: '23.3.2'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.11.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.15.146.1-microsoft-standard-WSL2',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Thu Jan 11 04:09:03 UTC 2024',
 'python_full_version': '3.11.2',
 'python_version': '3.11',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • WSL2_GUI_APPS_ENABLED
  • WSL_DISTRO_NAME
  • LANGUAGE
  • NAME
  • PWD
  • LOGNAME
  • HOME
  • LANG
  • WSL_INTEROP
  • LS_COLORS
  • VIRTUAL_ENV
  • WAYLAND_DISPLAY
  • TERM
  • USER
  • DISPLAY
  • SHLVL
  • VIRTUAL_ENV_PROMPT
  • XDG_RUNTIME_DIR
  • PS1
  • WSLENV
  • LC_ALL
  • PATH
  • MAIL
  • HOSTTYPE
  • PULSE_SERVER
  • OLDPWD
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/hibuna/test/testttt/test-env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/hibuna/test/testttt
  • VIRTUAL_ENV: /home/hibuna/test/testttt/test-env

Contents of Pipfile ('/home/hibuna/test/testttt/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
numpy = "==1.26.4"

[dev-packages]

[requires]
python_version = "3.11"

Contents of Pipfile.lock ('/home/hibuna/test/testttt/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "6485f6e2bbb7269b9a7dbd7bc2ff02f24be3f939492027385955a4cf62adff07"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.11"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "numpy": {
            "hashes": [
                "sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b",
                "sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818",
                "sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20",
                "sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0",
                "sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010",
                "sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a",
                "sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea",
                "sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c",
                "sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71",
                "sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110",
                "sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be",
                "sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a",
                "sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a",
                "sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5",
                "sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed",
                "sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd",
                "sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c",
                "sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e",
                "sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0",
                "sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c",
                "sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a",
                "sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b",
                "sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0",
                "sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6",
                "sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2",
                "sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a",
                "sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30",
                "sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218",
                "sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5",
                "sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07",
                "sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2",
                "sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4",
                "sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764",
                "sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef",
                "sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3",
                "sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f"
            ],
            "index": "pypi",
            "markers": "python_version >= '3.9'",
            "version": "==1.26.4"
        }
    },
    "develop": {}
}
```
@juan190199
Copy link

Could you solve the problem?

@WangHansch
Copy link

second to this

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

No branches or pull requests

3 participants