1

I tried this:

$ pip install tensorflow
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 272, in run
    with self._build_session(options) as session:
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 72, in _build_session
    insecure_hosts=options.trusted_hosts,
  File "/usr/lib/python2.7/site-packages/pip/download.py", line 336, in __init__
    retries = urllib3.Retry(
AttributeError: 'module' object has no attribute 'Retry'
Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 233, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 251, in main
    timeout=min(5, options.timeout)) as session:
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 72, in _build_session
    insecure_hosts=options.trusted_hosts,
  File "/usr/lib/python2.7/site-packages/pip/download.py", line 336, in __init__
    retries = urllib3.Retry(
AttributeError: 'module' object has no attribute 'Retry'

and that:

$ pip3 install tensorflow
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 272, in run
    with self._build_session(options) as session:
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 72, in _build_session
    insecure_hosts=options.trusted_hosts,
  File "/usr/lib/python3.6/site-packages/pip/download.py", line 336, in __init__
    retries = urllib3.Retry(
AttributeError: module 'pip' has no attribute 'Retry'
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/pip/__init__.py", line 233, in main
    return command.main(cmd_args)
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 251, in main
    timeout=min(5, options.timeout)) as session:
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 72, in _build_session
    insecure_hosts=options.trusted_hosts,
  File "/usr/lib/python3.6/site-packages/pip/download.py", line 336, in __init__
    retries = urllib3.Retry(
AttributeError: module 'pip' has no attribute 'Retry'

but to no avail. I've reinstalled python[23]-pip* and python[23]-urllib3, but with no change.

I don't know if this is related to TensorFlow or some pip/urllib3 stuff. Can anyone help? I'd like to install TF, but maybe there's something else broken, that needs to be fixed first? Looks like some dependency problem...

Cromax
  • 1,822
  • 1
  • 23
  • 35
  • I might be wrong but it seems your `pip` doesn't work at all. Are you able to install other packages with `pip`, like `numpy`? – Y. Luo Apr 10 '18 at 21:34
  • I was able to install stuff some time ago (including numpy). For some unknown reason now it gives these "no attribute" errors, so that's why I suspect, that something is broken and you might be actually right. And that's why I tried to reinstall pip and urllib3 (it reinstalled with no complaints), but I am out of ideas as for now—I'm not frequent Python user, hence I ask for help. – Cromax Apr 10 '18 at 21:38
  • The first thing I'm trying to figure out here is whether this is a tensorflow problem or pip problem (not related to or specific for tensorflow). So as for now, are you able to install any new packages with pip? I think reinstall pip is a smart move, though [it might be tricky](https://stackoverflow.com/questions/29038889/pip-fails-with-attributeerror-module-object-has-no-attribute-wraps#answer-29040109). – Y. Luo Apr 10 '18 at 21:47
  • Well, it looks like it's pip's problem. `pip3 install blahblah` gives the same error as previously (AttributeError: module 'pip' has no attribute 'Retry') — any clues, as simply reinstalling of python*-pip* didn't resolved the problem? – Cromax Apr 10 '18 at 22:02
  • I'm not really sure. It might be some other packages (failed to install correctly?) jammed pip. Or there are some [conflicts](https://github.com/rholder/retrying/issues/34#issuecomment-268013088) in your packages? Just a suggestion, check out the list of installed packages for potential problems, like multiple versions? If you remember you installed something unsuccessfully recently, try remove and clean up? – Y. Luo Apr 10 '18 at 22:22
  • Thanks for suggestions, @Y.Luo, I guess I'll have to get rid of Python at all and maybe to try to start it from scratch. I don't remember time, when it python stuff actually worked out of box, it always had its humors... Maybe that's why I never had enough patience to deal with it. – Cromax Apr 10 '18 at 22:37
  • OK, I removed packages (as "root"): `apt-cyg remove python2-pip python3-pip python2-urllib3 python3-urllib3` and additionally deleted some directories in /**/python*/site-packages/{pip|urllib*}, then reinstalled these packages with `apt-cyg install python2-pip python3-pip python2-urllib3 python3-urllib3`, upgraded pip (again as "root') with: `python -m pip install --upgrade pip` and then alos `python3 -m pip install --upgrade pip` (both to version 9.0.3) and now it seems pip works. – Cromax Apr 10 '18 at 23:14
  • But trying to install tensorflow gives: "Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow" for both pip and pip3. What should I do? Do I need to update somehow python's package list? How to do that? – Cromax Apr 10 '18 at 23:15
  • What is your python version and the tensorflow version you've tried to install? – Y. Luo Apr 11 '18 at 00:05
  • Python2 is 2.7.14 and python3 is 3.6.4. Actually I'd like to have TF for P3, but if that's not possible, then I'll take what you got. ;-) As to TF's version I believe it is 1.7, however I didn't provide version number. I tried also `# pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl`, but I got "tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform." – Cromax Apr 11 '18 at 10:25
  • I guess I need to build it from sources, as described here https://www.tensorflow.org/install/install_sources — I'll be back in the evening with the update. Thanks for support! – Cromax Apr 11 '18 at 10:35
  • Well, it seems like it needs bazel, which isn't available on Cygwin. I tried to compile bazel on Cygwin, but I get this strange error, that Visual Studio is not available, thou one calls `./compile.sh` from bash... I give up. 8( – Cromax Apr 11 '18 at 13:12
  • The only thing I can say now is to try WSL or [install Windows version](https://www.tensorflow.org/install/install_windows) if you don't have to use Cygwin. – Y. Luo Apr 11 '18 at 15:13
  • By WSL you mean "Windows Subsystem for Linux"? Like to run WSL on Cygwin? That's pretty vicious. ;-) Actually I prefer Cygwin far more over cmd.exe and that's why I wanted to make TF run on Cygwin, but finally I switched for TF to Windows' version of Python. Anyway thanks for you time and help, have a nice day! – Cromax Apr 11 '18 at 16:31
  • WSL is independent of Cygwin. Google like "tensorflow wsl" and you will find some [instructions](https://jamesmccaffrey.wordpress.com/2017/02/14/running-tensorflow-in-bash-on-windows/). The problem with WSL is that you can only use CPU only tensorflow. [GPU accessibility is not available in WSL.](https://github.com/Microsoft/WSL/issues/1788) That's why I tried it myself and decided to install the Windows version. If you don't like CMD, you can switch to other alternatives. I'd rather not giving up tensorflow features/functions for that reason. – Y. Luo Apr 11 '18 at 16:40
  • Currently I only have this Intel GFX chip built-in into CPU, and I doubt it supports CUDA (does it?), so I stick with CPU version anyway. I know about cmd alternatives, but I like Cygwin because of its "linux" flavor, toolchain and stuff. So, as to TF, I have no choice, until I buy some decent NVIDA card, but then maybe I should generally upgrade my whole hardware. ;-) – Cromax Apr 11 '18 at 17:11
  • If CPU only is what you want for now, I think WSL could be a viable option for you since it should have the "linux flavor". If you don't like WSL, please forget it. I'm glad that you seem to find your solution anyway. I'm sorry I'm not very helpful here. I'll delete my comments in a hour so that it won't confuse others coming to this question. Have a nice day! – Y. Luo Apr 11 '18 at 17:25

0 Answers0