• Re: Pip upgrade causing issues in 3.10

    From Mike Dewhirst@21:1/5 to David Raymond on Wed Jul 20 16:01:00 2022
    To: python-list@python.org (python-list@python.org)

    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------3g9uj4Ps9VNPdCdsxLSY2Ype
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64

    T24gMjAvMDcvMjAyMiA0OjQzIGFtLCBEYXZpZCBSYXltb25kIHdyb3RlOg0KPiBDOlxQcm9n cmFtIEZpbGVzXFB5dGhvbjMxMFxTY3JpcHRzPi4uXHB5dGhvbi5leGUgLW0gcGlwIGluc3Rh bGwgLS11cGdyYWRlIHBpcA0KPiBFUlJPUjogQ291bGQgbm90IGluc3RhbGwgcGFja2FnZXMg ZHVlIHRvIGFuIE9TRXJyb3I6IFtXaW5FcnJvciAzMl0gVGhlIHByb2Nlc3MgY2Fubm90IGFj Y2VzcyB0aGUgZmlsZSBiZWNhdXNlIGl0IGlzIGJlaW5nIHVzZWQgYnkgYW5vdGhlciBwcm9j ZXNzOiAnYzpcXHByb2dyYW0gZmlsZXNcXHB5dGhvbjMxMFxcc2NyaXB0c1xcJw0KVGhlcmUn cyB5b3VyIHByb2JsZW0uIFRoZSAnb3RoZXInIHByb2Nlc3MgaXMgeW91ciBjbWQuZXhlIHdp dGhpbiB3aGljaCANCnlvdSBhcmUgdHlwaW5nIGV0Yy4NCg0KUHl0aG9uIHNjcmlwdHMgZGly IHNob3VsZCBiZSBvbiB0aGUgcGF0aCBzbyB5b3UgZG9uJ3QgaGF2ZSB0byBleGVjdXRlIA0K YW55dGhpbmcgZnJvbSB3aXRoaW4gaXQuIFdpbmRvd3MgaXMgb2J2aW91c2x5IHRyaXBwaW5n IG92ZXIgaXRzIG93biB0b2VzIA0KdHJ5aW5nIHRvIGRlbGV0ZSBhbmQgaW5zdGFsbCBzb21l dGhpbmcgaW4gdGhlIHNhbWUgZGlyIHdoaWxlIHlvdSBhbHNvIA0KaGF2ZSB5b3VyIGZvb3Qg aW4gaXQuDQoNCk0NCg0KLS0gDQpTaWduZWQgZW1haWwgaXMgYW4gYWJzb2x1dGUgZGVmZW5j ZSBhZ2FpbnN0IHBoaXNoaW5nLiBUaGlzIGVtYWlsIGhhcw0KYmVlbiBzaWduZWQgd2l0aCBt eSBwcml2YXRlIGtleS4gSWYgeW91IGltcG9ydCBteSBwdWJsaWMga2V5IHlvdSBjYW4NCmF1 dG9tYXRpY2FsbHkgZGVjcnlwdCBteSBzaWduYXR1cmUgYW5kIGJlIHN1cmUgaXQgY2FtZSBm cm9tIG1lLiBKdXN0DQphc2sgYW5kIEknbGwgc2VuZCBpdCB0byB5b3UuIFlvdXIgZW1haWwg c29mdHdhcmUgY2FuIGhhbmRsZSBzaWduaW5nLg0KDQo= --------------3g9uj4Ps9VNPdCdsxLSY2Ype--

    -----BEGIN PGP SIGNATURE-----

    wsB5BAABCAAjFiEE/NCg7Xf1UydoVFgpGvW31BqCOLMFAmLXmhwFAwAAAAAACgkQGvW31BqCOLNq KQf/eorTPo/XY26ZwSJ7xujSH25qoPss1H/qjuj7MJq9EJMsqJ6VEhTnNsK5lA5mEUT0te4PLj1g DltllqjW/fah8zMPsCEcQWhp6WfdHQH7oRE6FDqrX0nfUYnPpAoQKzdf3ayAov0dQ4fd6m5C6H/H KpNh2ZX4VTtI7oC2BN9cp3UifKzgzhc1N2EKjc7iVvr8rEbqOCMhXL8eYfU/pZdxnuKKUJOHzJxl qocldqy8DVmQM+YO6eOS+jHKa0xXvbcUw5A2eJZmiC4ks87hOa232HRbHux2/N3iKOPvnTZwGypT Gjh18LZaQabGYipODilg/Chh6DnXP7uQYgSB2rIF0w==
    =88ci
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Mike Dewhirst on Wed Jul 20 05:36:50 2022
    On 7/20/22, Mike Dewhirst <miked@dewhirst.com.au> wrote:
    On 20/07/2022 4:43 am, David Raymond wrote:
    C:\Program Files\Python310\Scripts>..\python.exe -m pip install --upgrade
    pip
    ERROR: Could not install packages due to an OSError: [WinError 32] The
    process cannot access the file because it is being used by another
    process: 'c:\\program files\\python310\\scripts\\'
    There's your problem. The 'other' process is your cmd.exe within which
    you are typing etc.

    Python scripts dir should be on the path so you don't have to execute anything from within it. Windows is obviously tripping over its own toes trying to delete and install something in the same dir while you also
    have your foot in it.

    This should only occur if uninstalling pip deletes all of the files in
    the "Scripts" directory. In this case, pip will 'compress' the
    individual delete operations to remove the entire directory. It begins
    by trying to 'stash' the "Scripts" directory, i.e. by renaming it to a temporary adjacent name. It uses shutil.move() for this, which tries os.rename() and falls back on shutil.copytree() and shutil.rmtree().

    Of course this fails with a sharing violation if the directory is open
    as the working directory in any process, including the current Python
    process, because an open for a working directory doesn't share
    delete/rename access. pip fails to handle this error. It crashes and
    leaves a mess. The empty "Scripts" directory and the copytree() copy
    aren't rolled back properly, and neither are the stashed (renamed)
    "pip" and "pip*dist-info" directories in site packages.

    This is not user error. It is a bug in pip. It should be able to
    recover gracefully from failing to delete the directory. Moreover, it
    shouldn't even have to roll back the operations if it deleted the
    directory due to compression of explicit removals from the install
    "RECORD". In particular there is no reason to delete the "Scripts"
    directory, even if it's left empty.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)