1

I was trying to download a module using pip3, and I wasn't able to because of some simple error. Now, I'm not sure what I did, but I can't downaload any module in my computer. I've tried everything: sudo pip3 install urllib3 pip3 install urllib3 pip3 install selenium and a lot more. I don't know what to do. Maybe I erased a python file and now I can't download any module. Here is the end of the error I get in the terminal when I try to run sudo pip3 install selenium, after I put my password: No module named 'pip._vendor.urllib3.

Can someone please help me? Thank you!

Nicolas F
  • 452
  • 4
  • 11
  • Have you tried reinstalling pip? Have a look at [this](https://github.com/pypa/pip/issues/6261) – pecey Jul 04 '20 at 16:32
  • Yes, but I get this: error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-42592.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /Library/Python/2.7/site-packages/ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in – Nicolas F Jul 04 '20 at 16:34
  • (continuing): as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.readthedocs.io/en/latest/easy_install.html Please make the appropriate changes for your system and try again. – Nicolas F Jul 04 '20 at 16:34
  • @pecey I took a look at that, but I don't know what I'm supposed to do. Could you please help me? For that who helps me I promise, I'll improve your reputation by a LOT – Nicolas F Jul 04 '20 at 16:37
  • Are you trying to use pip3 with python2.7? If you don't have root access, one way out might be to create a local environment, so the packages are installed locally. Does `pip3 install --user selenium` work for you? – pecey Jul 04 '20 at 16:38
  • I'm not sure, I already downloaded Python3, but I seem to be using python2.7 to download. I tried what you told me, but I get this: ` No module named 'pip._vendor.urllib3` – Nicolas F Jul 04 '20 at 16:40
  • ``` Nicolas-MBP:python nicolasfuchs$ python --version Python 2.7.16 Nicolas-MBP:python nicolasfuchs$ python3 --version Python 3.8.3 ``` – Nicolas F Jul 04 '20 at 16:41
  • Here is my version, but when I try downloading it uses python 2.7, is there a way to override this? – Nicolas F Jul 04 '20 at 16:42
  • Can you try `sudo python3 -m pip install selenium`, if successful, then test with `python3 -m selenium` – Philippe Jul 04 '20 at 16:43
  • Ok, I'm trying! – Nicolas F Jul 04 '20 at 16:43
  • I tried it, but I got this: No module named 'pip._vendor.urllib3' @Philippe – Nicolas F Jul 04 '20 at 16:44
  • Can you type `type python3`, to see where you python3 is ? – Philippe Jul 04 '20 at 16:45
  • I think `python3` is pointing correctly, since the version was 3.8 as posted in a previous comment. But weird that `python3 -m pip` failed too. Can you type `type pip3` and then `cat `? It should ideally be using the shebang for python3 – pecey Jul 04 '20 at 16:50
  • @Philippe: python3 is /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 – Nicolas F Jul 04 '20 at 16:55
  • @pecey I did what you told me, now what? – Nicolas F Jul 04 '20 at 16:56
  • @pecey and philippe I think the problem is with this: ModuleNotFoundError: No module named 'pip._vendor.urllib3' – Nicolas F Jul 04 '20 at 16:57
  • Can you try to delete `/Library/Frameworks/Python.framework/Versions/3.8/site-packages/pip` and then try reinstalling pip using `python3 -m ensurepip`, followed by `pip3 install --upgrade pip`? – pecey Jul 04 '20 at 17:11
  • Everything I try I get this: ModuleNotFoundError: No module named 'pip._vendor.urllib3' – Nicolas F Jul 04 '20 at 17:20
  • How can I download module pip._vendor.urllib3. Or I get this: ImportError: cannot import name urllib3 (**Please @pecey can you help me**) – Nicolas F Jul 04 '20 at 17:21
  • 1
    Maybe try this : https://stackoverflow.com/a/20340173/2125671 – Philippe Jul 04 '20 at 17:27

0 Answers0