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

Uninstallation fails with WindowsError: [Error 206] The filename or extension is too long #5155

Closed
BoboTiG opened this issue Apr 3, 2018 · 4 comments
Labels
auto-locked Outdated issues that have been locked by automation resolution: duplicate Duplicate of an existing issue/PR

Comments

@BoboTiG
Copy link
Contributor

BoboTiG commented Apr 3, 2018

  • Pip version: 9.0.1
  • Python version: 2.7.14
  • Operating system: Windows 7 (32 and 64 bits)

Description:

pip install --upgrade MODULE fails to uninstall the old version if its full path is too long.
To reduce the path length, I set the envar TMPDIR to the shortest possible, eg C:\temp by still.

What I've run:

2 demonstrations, the 1st when ugrading pip from 9.0.1 to 9.0.3:

09:24:45 [INFO]      [exec] >>> Defining %TMPDIR% to 'C:\temp' for modules installation
09:24:45 [INFO]      [exec] Collecting pip
09:24:45 [INFO]      [exec]   Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
09:24:45 [INFO]      [exec] Installing collected packages: pip
09:24:45 [INFO]      [exec]   Found existing installation: pip 9.0.1
09:24:45 [INFO]      [exec]     Uninstalling pip-9.0.1:
09:24:45 [INFO]      [exec] Exception:
09:24:45 [INFO]      [exec] Traceback (most recent call last):
09:24:45 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\basecommand.py", line 215, in main
09:24:45 [INFO]      [exec]     status = self.run(options, args)
09:24:45 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\commands\install.py", line 342, in run
09:24:45 [INFO]      [exec]     prefix=options.prefix_path,
09:24:45 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\req\req_set.py", line 778, in install
09:24:45 [INFO]      [exec]     requirement.uninstall(auto_confirm=True)
09:24:45 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
09:24:45 [INFO]      [exec]     paths_to_remove.remove(auto_confirm)
09:24:45 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
09:24:45 [INFO]      [exec]     renames(path, new_path)
09:24:45 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\utils\__init__.py", line 265, in renames
09:24:45 [INFO]      [exec]     os.makedirs(head)
09:24:45 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\os.py", line 157, in makedirs
09:24:45 [INFO]      [exec]     mkdir(name, mode)
09:24:45 [INFO]      [exec] WindowsError: [Error 206] The filename or extension is too long: 'c:\\temp\\pip-xdpawn-uninstall\\jenkins\\0ebd1d51\\workspace\\p-installation-fail-windows-efkqhoiz4nsa5siwhjhwbqglgtldiwfyj4urtdpolqrh6txww5wa\\deploy-dir\\drive-2.7.14-python\\lib\\site-packages\\pip\\_vendor\\requests\\packages\\urllib3\\packages\\ssl_match_hostname'

And when upgrading another module:

09:41:41 [INFO]      [exec] >>> Defining %TMPDIR% to 'C:\temp' for modules installation
09:41:41 [INFO]      [exec] Collecting pycryptodomex==3.4.12 (from -r requirements.txt (line 8))
09:41:41 [INFO]      [exec]   Downloading pycryptodomex-3.4.12-cp27-cp27m-win32.whl (7.3MB)
09:41:42 [INFO]      [exec] Installing collected packages: pycryptodomex
09:41:42 [INFO]      [exec]   Found existing installation: pycryptodomex 3.5.1
09:41:42 [INFO]      [exec]     Uninstalling pycryptodomex-3.5.1:
09:41:42 [INFO]      [exec] Exception:
09:41:42 [INFO]      [exec] Traceback (most recent call last):
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\basecommand.py", line 215, in main
09:41:42 [INFO]      [exec]     status = self.run(options, args)
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\commands\install.py", line 342, in run
09:41:42 [INFO]      [exec]     prefix=options.prefix_path,
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\req\req_set.py", line 778, in install
09:41:42 [INFO]      [exec]     requirement.uninstall(auto_confirm=True)
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
09:41:42 [INFO]      [exec]     paths_to_remove.remove(auto_confirm)
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
09:41:42 [INFO]      [exec]     renames(path, new_path)
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\site-packages\pip\utils\__init__.py", line 267, in renames
09:41:42 [INFO]      [exec]     shutil.move(old, new)
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\shutil.py", line 316, in move
09:41:42 [INFO]      [exec]     copy2(src, real_dst)
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\shutil.py", line 144, in copy2
09:41:42 [INFO]      [exec]     copyfile(src, dst)
09:41:42 [INFO]      [exec]   File "C:\Jenkins\0ebd1d51\workspace\p-installation-fail-windows-EFKQHOIZ4NSA5SIWHJHWBQGLGTLDIWFYJ4URTDPOLQRH6TXWW5WA\deploy-dir\drive-2.7.14-python\lib\shutil.py", line 97, in copyfile
09:41:42 [INFO]      [exec]     with open(dst, 'wb') as fdst:
09:41:42 [INFO]      [exec] IOError: [Errno 2] No such file or directory: 'c:\\temp\\pip-0eyhyh-uninstall\\jenkins\\0ebd1d51\\workspace\\p-installation-fail-windows-efkqhoiz4nsa5siwhjhwbqglgtldiwfyj4urtdpolqrh6txww5wa\\deploy-dir\\drive-2.7.14-python\\lib\\site-packages\\cryptodome\\selftest\\publickey\\test_vectors\\ecc\\ecc_p256_private_enc_aes128.pem'

Possible solution:

I know Windows has a "long path prefix" \?\\ but I do not know if it is a viable option and if eventual Windows API implied there will still work with such a patch.

Perhaps there already is a workaround I did miss?

@BoboTiG BoboTiG changed the title Unistallation fails with WindowsError: [Error 206] The filename or extension is too long Uninstallation fails with WindowsError: [Error 206] The filename or extension is too long Apr 3, 2018
@pradyunsg pradyunsg added type: bug A confirmed bug or unintended behavior resolution: duplicate Duplicate of an existing issue/PR and removed type: bug A confirmed bug or unintended behavior resolution: duplicate Duplicate of an existing issue/PR labels Apr 3, 2018
@pradyunsg
Copy link
Member

Duplicate of #3055?

@BoboTiG
Copy link
Contributor Author

BoboTiG commented Apr 3, 2018

Ah yes, it seems the same. I did not find it because I was looking for the specific WindowsError. Should I close this one?

@pradyunsg
Copy link
Member

Sure. Feel free to. :)

@pradyunsg pradyunsg added the resolution: duplicate Duplicate of an existing issue/PR label Apr 3, 2018
@BoboTiG BoboTiG closed this as completed Apr 3, 2018
@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation resolution: duplicate Duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

2 participants