Forums

pip3 throws syntax error in bash console

Calling pip3 from a bash console, it throws the following error:

11:36 ~ $ pip3 show tensorflow

Traceback (most recent call last):
  File "/home/Giabanga/.local/bin/pip3", line 7, in <module>
    from pip import main
  File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 16, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/local/lib/python3.5/dist-packages/pip/vcs/subversion.py", line 9, in <module>
    from pip.index import Link
  File "/usr/local/lib/python3.5/dist-packages/pip/index.py", line 30, in <module>
    from pip.wheel import Wheel, wheel_ext
  File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 6, in <module>
    import compileall
  File "/usr/lib/python3.5/compileall.py", line 20, in <module>
    from concurrent.futures import ProcessPoolExecutor
  File "/home/Giabanga/.local/lib/python3.5/site-packages/concurrent/futures/__init__.py", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,
  File "/home/Giabanga/.local/lib/python3.5/site-packages/concurrent/futures/_base.py", line 414
    raise exception_type, self._exception, self._traceback
                        ^
SyntaxError: invalid syntax

This happens with other commands like install, too. Pip (for Python 2) works fine, tho. I did empty the cache folder previous to this because I ran into disk quota problems while updating tensorflow. Furthermore, I have installed Keras. Could this have caused the issue? How to fix it?

Thank you!

How interesting! It looks like you've somehow managed to get a Python 2.7-syntax install of a module installed into your Python 3.5 package directory. I don't know how that could have happened -- while running out of disk quota can cause odd problems, this seems like an unlikely one.

As concurrent.futures is built in to Python 3, I'd suggest just removing it. From a bash console:

rm -rf /home/Giabanga/.local/lib/python3.5/site-packages/concurrent/

...and then see if that fixes things.

Thank you for your fast reply, that has solved the issue!

Excellent -- thanks for confirming!