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

pip uninstall cannot create file in default TEMP path #6019

Closed
dogod621 opened this issue Nov 20, 2018 · 2 comments
Closed

pip uninstall cannot create file in default TEMP path #6019

dogod621 opened this issue Nov 20, 2018 · 2 comments
Labels
auto-locked Outdated issues that have been locked by automation resolution: duplicate Duplicate of an existing issue/PR type: bug A confirmed bug or unintended behavior

Comments

@dogod621
Copy link

dogod621 commented Nov 20, 2018

Environment

  • pip version: pip3.6 18.1
  • Python version: python 3.6
  • OS: WIN10

When I am uninstalling tensorflow-gpu package,
pip report errors and cannot finish the uninstall command.

Exception:
Traceback (most recent call last):
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\shutil.py", line 544, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 3] 系統找不到指定的路徑。: 'd:\\program files (x86)\\microsoft visual studio\\shared\\python36_64\\lib\\site-packages\\tensorflow\\include\\tensorflow\\include\\external\\eigen_archive\\eigen\\src\\iterativelinearsolvers\\leastsquareconjugategradient.h' -> 'C:\\Users\\ITRI\\AppData\\Local\\Temp\\pip-uninstall-prs9c6zj\\program files (x86)\\microsoft visual studio\\shared\\python36_64\\lib\\site-packages\\tensorflow\\include\\tensorflow\\include\\external\\eigen_archive\\eigen\\src\\iterativelinearsolvers\\leastsquareconjugategradient.h'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main
    status = self.run(options, args)
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\commands\uninstall.py", line 75, in run
    auto_confirm=options.yes, verbose=self.verbosity > 0,
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\req\req_install.py", line 683, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\req\req_uninstall.py", line 224, in remove
    renames(path, new_path)
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\utils\misc.py", line 280, in renames
    shutil.move(old, new)
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\shutil.py", line 558, in move
    copy_function(src, real_dst)
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "d:\program files (x86)\microsoft visual studio\shared\python36_64\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\ITRI\\AppData\\Local\\Temp\\pip-uninstall-prs9c6zj\\program files (x86)\\microsoft visual studio\\shared\\python36_64\\lib\\site-packages\\tensorflow\\include\\tensorflow\\include\\external\\eigen_archive\\eigen\\src\\iterativelinearsolvers\\leastsquareconjugategradient.h'

My default TEMP path is C:\Users\ITRI\AppData\Local\Temp\,
I found it cannot create file in default TEMP path,
so pip cannot copy the files to TEMP Dir ( In my example it cannot copy leastsquareconjugategradient.h in tensorflow install Dir to TEMP Dir),
and cause errors....
(PS 1. No matter how hard I am trying...),
(PS 2. But it can create folders in default TEMP path)
The problem may related to the slash issue in path string, but python automatically changes the string's slash to two inverse slash, so I cannot pass the string with the slash type which is I want, so I cannot try it.

So I change the TEMP path in Python36_64/Lib/site-packages/pip/_internal/utils/temp_dir.py
via adding tempfile.tempdir = 'D:/PythonTemp'

from __future__ import absolute_import

import logging
import os.path
import tempfile

from pip._internal.utils.misc import rmtree

logger = logging.getLogger(__name__)

tempfile.tempdir = 'D:/PythonTemp'

And then everything is fine~

@dogod621 dogod621 changed the title pip uninstall cant create file in default TEMP path pip uninstall cannot create file in default TEMP path Nov 20, 2018
@zooba
Copy link
Contributor

zooba commented Nov 21, 2018

This is almost certainly due to #3055.

@pradyunsg pradyunsg added the S: needs triage Issues/PRs that need to be triaged label Dec 14, 2018
@chrahunt chrahunt added resolution: duplicate Duplicate of an existing issue/PR type: bug A confirmed bug or unintended behavior labels Aug 31, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Aug 31, 2019
@chrahunt
Copy link
Member

Yup, the not-found path is length 261, just over the max of 260. Since this looks like a clear duplicate I will close it eagerly, but please let us know if the fix does not work.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Sep 30, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 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 type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants