0

I am trying to install software that has a component that claims it can be installed using the latest python3-pip. I tried apt-get remove python3-pip followed by apt-get install python3-pip and it reported success, but didn't actually work:

% pip2 --version
ppip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
% pip3 --version
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    sys.exit(main())
  File "/home/xxx/.local/lib/python3.5/site-packages/pip/__init__.py", line 11, in main
    from pip._internal.utils.entrypoints import _wrapper
  File "/home/xxx/.local/lib/python3.5/site-packages/pip/_internal/utils/entrypoints.py", line 12
    f"pip{sys.version_info.major}",
                                 ^
SyntaxError: invalid syntax

What is the simplest way to install python3 components in Ubuntu 16?

(For what it's worth, I noticed some people have had somewhat similar issues with pip2, maybe because they accidently "upgraded" pip3 to an unstable version. It's possible that this could have happened on my system, but I'm not sure why apt-get wouldn't fix it).

personal_cloud
  • 3,943
  • 3
  • 28
  • 38
  • Ubuntu 16.04 is out of standard support, so you should [upgrade](https://askubuntu.com/q/91815/301745), unless you're on a legacy system with ESM. – wjandrea Aug 30 '23 at 04:03
  • 1
    You somehow have a `pip` version installed that requires a newer Python version than you have - the f-string feature that's generating the syntax error was added in Python 3.6, I think. – jasonharper Aug 30 '23 at 04:05
  • @jasonharper I have both Python 3.5.2 and Python 3.6.13 installed. Why is `pip3` using the wrong one? Actually pip3 starts with `#!/usr/bin/python3` so then what is it doing using Python3.6 syntax? – personal_cloud Aug 30 '23 at 04:43

1 Answers1

0

pip3 --version is the wrong syntax.

python3.6 -m pip --version is the right syntax

personal_cloud
  • 3,943
  • 3
  • 28
  • 38