# Problem with pip : it thinks it's a different version

**URL:** <https://discuss.python.org/t/problem-with-pip-it-thinks-its-a-different-version/20421>\
**Category:** Python Help\
**Created:** [October 27, 2022, 7:35am UTC](https://discuss.python.org/t/problem-with-pip-it-thinks-its-a-different-version/20421 "2022-10-27T07:35:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave\_007](https://avatars.discourse-cdn.com/v4/letter/d/f14d63/32.png) [@dave\_007](https://discuss.python.org/u/dave_007)\
**Post date:** [October 27, 2022, 7:35am UTC](https://discuss.python.org/t/problem-with-pip-it-thinks-its-a-different-version/20421/1 "2022-10-27T07:35:48Z")

</div>

hello,

i’m trying to install some packages on a CentOS 7 system using pip3. both pip and pip3 are installed on the system. pip3 won’t install the packages because for some reason it doesn’t seem to recognise that its version of python is correct.

an example (edited for clarity) :

```auto
    $ python3 --version
    Python 3.6.8
    
    $ pip3 --version
    pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
    
    $ pip3 -v install package
    Collecting package
      1 location(s) to search for versions of package:
      * https://pypi.python.org/simple/package/
      Getting page https://pypi.python.org/simple/package/
      Looking up "https://pypi.python.org/simple/package/" in the cache
      Returning cached "301 Moved Permanently" response (ignoring date and etag information)
      Looking up "https://pypi.org/simple/package/" in the cache
      Current age based on date: 429
      Freshness lifetime from max-age: 600
      Freshness lifetime from request max-age: 600
      The response is "fresh", returning cached response
      600 > 429
      Analyzing links from page https://pypi.org/simple/package/
        Skipping link https://files.pythonhosted.org/packages/{very-long-path-here} (from https://pypi.org/simple/package/) (requires-python:>=3.5); it is not compatible with this Python
  ...

```

so even though pip3 recognises that it’s from python 3.6, it won’t install packages requiring python 3.5 or greater, saying “it is not compatible withi this Python”.

i have also tried `python3 -m pip install package` , this gives me the same error.  
i have also tried `python3 -m pip install package -t {path}`, where {path} is one of the elements in `sys.path`, for each element of the path except `/usr/local/bin` and the zip file.

printing `sys.path` gives me the following :

```auto
['/usr/local/bin', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/usr/local/lib64/python3.6/site-packages', '/usr/local/lib/python3.6/site-packages', '/usr/lib64/python3.6/site-packages', '/usr/lib/python3.6/site-packages']

```

any ideas on how i can resolve this issue ?

failing that, is there a safe way to re-install python 3.6 (and only 3.6) on the system without breaking something else ?

---

<div class="post-metadata">

**Author:** ![cameron](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/cameron/32/2658_2.png) [@cameron](https://discuss.python.org/u/cameron)\
**Post date:** [October 27, 2022, 9:14pm UTC](https://discuss.python.org/t/problem-with-pip-it-thinks-its-a-different-version/20421/2 "2022-10-27T21:14:51Z")

</div>

> i’m trying to install some packages on a CentOS 7 system using pip3.  
> both pip and pip3 are installed on the system. pip3 won’t install the  
> packages because for some reason it doesn’t seem to recognise that its  
> version of python is correct.
> 
> an example (edited for clarity) :
> 
> ```auto
> $ python3 --version
> Python 3.6.8
> 
> $ pip3 --version
> pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
> 
> ```

That is a pretty old pip. Contrast to the Python I’m running here:

```
 pip 22.3 from /Users/cameron/var/venv/3.10.6_1-homebrew/lib/python3.10/site-packages/pip (python 3.10)

```

I’m presuming this is the system supplied python? The `sys.path` below  
suggests so anyway.

> ```auto
> $ pip3 -v install package
> [...]
> Analyzing links from page https://pypi.org/simple/package/
> Skipping link https://files.pythonhosted.org/packages/{very-long-path-here} (from https://pypi.org/simple/package/) (requires-python:>=3.5); it is not compatible with this Python
> 
> ```
> 
> so even though pip3 recognises that it’s from python 3.6, it won’t install packages requiring python 3.5 or greater, saying “it is not compatible withi this Python”.

There were recent fixes in pip around requirements. May be relevant.

> i have also tried `python3 -m pip install package`

This is the better approach. It’ll be doing the same thing right now,  
but at least it ensures that the `pip` is the one for that `python3`  
install.

> any ideas on how i can resolve this issue ?
> 
> failing that, is there a safe way to re-install python 3.6 (and only 3.6) on the system without breaking something else ?

I wouldn’t reinstall. See if there are `rpm`/`dnf` updates for `python3`  
(and/or the `python3` `pip` package, if that is distinct) with `dnf check-update`.

You could also make a virtualenv and then upgrade `pip` _inside_ the  
virtualenv:

```
 $ python3 -m venv ~/venv
 $ ~/venv/bin/python3 -m pip install -U pip
 $ ~/venv/bin/python3 -m pip install package

```

and see how it goes. When you exec the `python3` from inside the  
`venv/bin` it runs with a configuration which uses the venv as the  
install area. You can then try updating `pip`, and then try installing  
your problematic package using the updated `pip` to see if it behaves  
better.

If not, the next step would be a _distinct_ separate install of Python  
3.6 (or better still, a more recent Python - 3.11 came out the other  
day) elsewhere. Nothing prevents you having several installs; just don’t  
trash the system vendor suppplied install. Eg install in  
`/usr/local/python-some-version` or `/opt/python-some-version` or, of  
course, `~/python-some-version` (install as yourself, avoiding any risk  
of putting things in any system controlled area).

_Then_ make a venv from the new version, and _then_ update its pip and  
your target package.

Cheers,  
Cameron Simpson [cs@cskk.id.au](mailto:cs@cskk.id.au)
