5

when using pip I get the following warning:

$ pip install pip
Requirement already satisfied (use --upgrade to upgrade): pip in /usr/lib/python2.7/site-packages
You are using pip version 8.1.2, however version 22.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

So I follow the suggestion, but I get a SyntaxError:

$ pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/99/bb/696e256f4f445809f25efd4e4ce42ff99664dc089cafa1e097d5fec7fc33/pip-22.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-k03IN1/pip/setup.py", line 7
        def read(rel_path: str) -> str:
                         ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-k03IN1/pip/
You are using pip version 8.1.2, however version 22.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

My default pip is not the one I want to be:

$ ~/anaconda3/bin/pip --version
pip 22.1 from /home/mdi0316/.local/lib/python3.8/site-packages/pip (python 3.8)
$ ~/anaconda3/bin/pip3 --version
pip 22.1 from /home/mdi0316/.local/lib/python3.8/site-packages/pip (python 3.8)

$ which pip
/usr/bin/pip
$ pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

$ echo $PATH
/home/mdi0316/bin:/home/mdi0316/anaconda3/envs/nagare_env/bin:/home/mdi0316/anaconda3/condabin:/home/mdi0316/anaconda3/envs/nagare_env/bin:/cm/shared/apps/TURBOMOLE/bin/em64t-unknown-linux-gnu_smp:/cm/shared/apps/TURBOMOLE/scripts:/cm/local/apps/cuda/libs/current/bin:/cm/shared/apps/cuda11.1/sdk/11.1.1/bin/x86_64/linux/release:/cm/shared/apps/cuda11.1/toolkit/11.1.1/bin:/cm/shared/apps/python3.8.7/bin:/cm/shared/apps/openmpi/gcc/64/4.0.5/bin:/cm/local/apps/gcc/8.2.0/bin:/cm/shared/apps/slurm/18.08.9/sbin:/cm/shared/apps/slurm/18.08.9/bin:/cm/local/apps/environment-modules/4.2.1/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin:/sbin:/usr/sbin:/cm/local/apps/environment-modules/4.2.1/bin

I am within a personally created anaconda environment (nagare_env). Yet, the default pip in in ~/usr

I also tried to install pip through pip3, but I could solve this neither way.

$ pip3 install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.8/site-packages (22.1)

$ pip3 install --upgrade --trusted-host pypi.org --trusted-host files.pythonhosted.org  pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.8/site-packages (22.1)

any hint? Thanks Marco

Marco Di Gennaro
  • 395
  • 1
  • 3
  • 15

2 Answers2

6

I faced the same issue on my centos. Guess my pip file was corrupted. I installed it again and was working fine.

1

"pip 21.0, in January 2021, removed Python 2 support, per pip’s Python 2 support policy.

you should change your pip version

from: https://pypi.org/project/pip/

tonghe wu
  • 11
  • 1