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

ImportError: No module named 'pip._vendor.requests.adapters' for any pip command #6719

Closed
Gabrielvon opened this issue Oct 18, 2017 · 16 comments

Comments

@Gabrielvon
Copy link

  • Pip version: 9.0.1
  • Python version: 3.5.4
  • Operating system: windows 7

Description:

pip install --upgrade tensorflow == 1.3.0

What I've run:

image

(root) C:\Users\trader>pip install --upgrader tensorflow==1.3.0
Traceback (most recent call last):
  File "C:\Users\trader\Anaconda3\Scripts\pip-script.py", line 6, in <module>
    from pip import main
  File "C:\Users\trader\Anaconda3\lib\site-packages\pip\__init__.py", line 28, i
n <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "C:\Users\trader\Anaconda3\lib\site-packages\pip\vcs\mercurial.py", line
9, in <module>
    from pip.download import path_to_url
  File "C:\Users\trader\Anaconda3\lib\site-packages\pip\download.py", line 41, i
n <module>
    from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
ImportError: No module named 'pip._vendor.requests.adapters'

(root) C:\Users\trader>pip -v
Traceback (most recent call last):
  File "C:\Users\trader\Anaconda3\Scripts\pip-script.py", line 6, in <module>
    from pip import main
  File "C:\Users\trader\Anaconda3\lib\site-packages\pip\__init__.py", line 28, i
n <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "C:\Users\trader\Anaconda3\lib\site-packages\pip\vcs\mercurial.py", line
9, in <module>
    from pip.download import path_to_url
  File "C:\Users\trader\Anaconda3\lib\site-packages\pip\download.py", line 41, i
n <module>
    from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
ImportError: No module named 'pip._vendor.requests.adapters'
@akapocsi
Copy link

This is crippling my workflow. Happy I exported and cloned my root env before upgrading to the latest "stable" version of anaconda.

@msarahan
Copy link
Contributor

Please see #6456 for more info and possible resolution.

This change was made because pip nested their vendoring more deeply in recent releases. In testing, we saw path length issues that broke things much worse than the issue you're seeing, and acted to remedy them by un-vendoring pip. This works for clean installs, but highlights a buggy legacy package. We can't fix the buggy legacy package - removing it always leaves the files that are causing issues.

@akapocsi
Copy link

Deleting "C:\Anaconda3\Lib\site-packages\pip" and subsequently forcing a re-installation with "conda install pip -f" fixed the issue for me.

@Gabrielvon
Copy link
Author

@akapocsi Thanks a lot! It works like a charm!

@Gabrielvon
Copy link
Author

@msarahan I am hardly understanding the #6456 professionally but your comment explained the problems to me. I got the direct solution from @akapocsi . Thanks for answering though.

@msarahan
Copy link
Contributor

Sure, no problem. Sorry for not posting a more direct answer. Thanks @akapocsi for posting better instructions.

@Mereep
Copy link

Mereep commented Oct 21, 2017

I have the same issue as the Threadstarter with the exception I am using Windows 10.

I also followed the instruction stated by @akapocsi . It did not succeed. I stumble from one mess to another trying to install tensorflow-gpu.

The whole workflow seems broken from a to z.

problems

@akapocsi
Copy link

@Mereep Why did you delete pip.exe?

The instructions I posted above indicate that you need to delete a folder, not a file.

@akapocsi
Copy link

@Mereep Try deleting "C:\Users\richard\Anaconda3\Lib\site-packages\pip" and subsequently forcing a re-installation with "conda install pip -f"

@dualvim
Copy link

dualvim commented Oct 22, 2017

@akapocsi you're a genius! I was facing the same problem of @Gabrielvon and reading the issue #6456 didn't help me (I'm a Python newbie). These instructions solved my problems in less than 1 minute! Thank you!

@Mereep
Copy link

Mereep commented Oct 23, 2017

@akapocsi Yes, correct, I didn't notice that this is the site-package folder. And since the exe was recreated after that, I assumed it was the correct way. Thanks for that hint. Deleting the site-package node will actually work (partially).

While pip seems to at least start again, Installing packages (on my system) doesn't work still.

pip_install_prob

I also cannot upgrade pip itself using pip, since the error occurs then also. Should I open a ticket for that or does that look like a totally local problem?

[EDIT]
I digged a bit into that problem. If you change "transport_encoding" to just "encoding" at line 730 of the mentioned file, it seems to fix the problem. Transport encoding came into the repository with version "0.99999999/1.0b9" while the installed version in my anaconda (I upgraded all packages recently) is version "0.9999999"

[EDIT2]
Digged deeper. The html5lib-version missmatch comes from installing tensorflow via conda. This will downgrade html5lib and therefore will render pip unable to work since it depends on the API Change of the parse method. Ultimately, installing tensorflow on Windows 10 using conda will break pip.

Still no working environment. Really frustrating situation.

@Gabrielvon
Copy link
Author

close issue.

@malhotravasu
Copy link

Easy fix for windows users:

easy_install requests

@lafftar
Copy link

lafftar commented Mar 9, 2018

thank you @malhotravasu

@Honghe
Copy link

Honghe commented Aug 7, 2018

FYI,

  • the Anaconda global Python site-package location is C:\ProgramData\Anaconda3\Lib\site-packages
  • but the individual environment site-package location is C:\Users\<user>\AppData\Roaming\Python\Python36\site-packages

So after you deleted pip directory but something is still wrong, maybe you have deleted the wrong directory.

@Souhaib-fkr
Copy link

How do I fix the error? ::

C:\Users\SouhaibFkr_Nitro5>pip
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Scripts\pip.exe_main
.py", line 4, in
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\cli\main.py", line 9, in
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\cli\autocompletion.py", line 10, in
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\cli\main_parser.py", line 9, in
from pip._internal.build_env import get_runnable_pip
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\build_env.py", line 20, in
from pip._internal.cli.spinners import open_spinner
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\cli\spinners.py", line 9, in
from pip._internal.utils.logging import get_indentation
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\utils\logging.py", line 29, in
from pip._internal.utils.misc import ensure_dir
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_internal\utils\misc.py", line 37, in
from pip.vendor.pep517 import Pep517HookCaller
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pep517_init
.py", line 6, in
from .wrappers import * # noqa: F401, F403
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\SouhaibFkr_Nitro5\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pep517\wrappers.py", line 11, in
from .in_process import _in_proc_script_path
ImportError: cannot import name '_in_proc_script_path' from 'pip._vendor.pep517.in_process' (unknown location)

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

9 participants