# Pip not working after downgrading

**URL:** <https://discuss.python.org/t/pip-not-working-after-downgrading/43697>\
**Category:** Python Help\
**Tags:** packaging-help\
**Created:** [January 20, 2024, 5:19pm UTC](https://discuss.python.org/t/pip-not-working-after-downgrading/43697 "2024-01-20T17:19:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandun21](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sandun21/32/17326_2.png) [@sandun21](https://discuss.python.org/u/sandun21)\
**Post date:** [January 20, 2024, 5:19pm UTC](https://discuss.python.org/t/pip-not-working-after-downgrading/43697/1 "2024-01-20T17:19:34Z")

</div>

I downgraded pip to install some packages. but now pip is not working saying. my python version is 3.11.5 and used this command “sudo python -m pip install pip==18.0 --upgrade”

 ![image](https://us1.discourse-cdn.com/flex002/uploads/python1/original/3X/2/4/2483ee2605ff815db67aa8feac2cf32669c55196.png)

Error code:  
Traceback (most recent call last):  
File “/home/hasitha/.local/bin/pip”, line 5, in   
from pip.\_internal import main  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_internal/ **init**.py”, line 42, in   
from pip.\_internal import cmdoptions  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_internal/cmdoptions.py”, line 16, in   
from pip.\_internal.index import (  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_internal/index.py”, line 14, in   
from pip.\_vendor import html5lib, requests, six  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_vendor/html5lib/ **init**.py”, line 25, in   
from .html5parser import HTMLParser, parse, parseFragment  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_vendor/html5lib/html5parser.py”, line 8, in   
from . import \_tokenizer  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_tokenizer.py”, line 16, in   
from .\_trie import Trie  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/ **init**.py”, line 3, in   
from .py import Trie as PyTrie  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/py.py”, line 6, in   
from .\_base import Trie as ABCTrie  
File “/home/hasitha/.local/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/\_base.py”, line 3, in   
from collections import Mapping  
ImportError: cannot import name ‘Mapping’ from ‘collections’ (/usr/lib/python3.10/collections/ **init**.py)

---

<div class="post-metadata">

**Author:** ![zware](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/zware/32/58_2.png) [@zware](https://discuss.python.org/u/zware)\
**Post date:** [January 20, 2024, 5:59pm UTC](https://discuss.python.org/t/pip-not-working-after-downgrading/43697/2 "2024-01-20T17:59:42Z")

</div>

Welcome to the forum 🙂

A few points:

1. Please, never use `sudo python -m pip` unless you’re absolutely sure of what you’re doing. It’s a quick way to seriously wreck your environment, possibly beyond repair if you overwrite system packages.
2. Code and error messages are best shared as text rather than screenshots, so that anyone can read them. I had to squint pretty hard to make out what that image says 🙂
3. You aren’t using Python 3.11 there; you’re using the system Python 3.10 (`/usr/bin/python3.10`). You appear to have a virtual environment (`base`) activated, but the `pip` you called came from your Python 3.10 user `site-packages` (`/home/hasitha/.local/bin/pip`).
4. As you found, `pip==18.0` is not compatible with a Python that new. According to the classifiers at on the [PyPI page for `pip` 18.0](https://pypi.org/project/pip/18.0/), the newest version it supported was Python 3.6. Fortunately, since it does appear to be installed to your user `site-packages`, you should be able to clean things up by removing `/home/hasitha/.local/lib/python3.10/site-packages/pip*`, and the system-wide `pip` installation should still work.
5. I’m not sure how downgrading `pip` would help you install a package 🙂 . What was the original issue you were facing; perhaps we can help with that?

---

<div class="post-metadata">

**Author:** ![sandun21](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sandun21/32/17326_2.png) [@sandun21](https://discuss.python.org/u/sandun21)\
**Post date:** [January 20, 2024, 6:11pm UTC](https://discuss.python.org/t/pip-not-working-after-downgrading/43697/3 "2024-01-20T18:11:58Z")

</div>

Big thank you .I updated the error message with code. It fixed my pip error. I am very sorry about uploading image. Firstly, I was trying to running a model in a virtual machine. For that ‘ctcdecode’ module installation failed. I am not pretty sure but I thought of downgrading pip version may work. That is the cause for the error.

---

<div class="post-metadata">

**Author:** ![zware](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/zware/32/58_2.png) [@zware](https://discuss.python.org/u/zware)\
**Post date:** [January 20, 2024, 6:46pm UTC](https://discuss.python.org/t/pip-not-working-after-downgrading/43697/4 "2024-01-20T18:46:21Z")

</div>

What trouble did you have with installing `ctcdecoder`? I’m not at all familiar with it, but I found each of [`ctcdecode`](https://pypi.org/project/ctcdecode/), [`pyctcdecode`](https://pypi.org/project/pyctcdecode/), and [`ctcdecoder`](https://pypi.org/project/ctcdecoder/) on PyPI. The latter appears to be a broken and possibly abandoned package (or malware, hard to tell 🙂 ), the former requires PyTorch to be pre-installed (which is its own can of worms), and the middle installed quickly and easily in a Python 3.11 venv. If you share the error you had with that installation, we can try to help.

---

<div class="post-metadata">

**Author:** ![sandun21](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sandun21/32/17326_2.png) [@sandun21](https://discuss.python.org/u/sandun21)\
**Post date:** [January 20, 2024, 6:51pm UTC](https://discuss.python.org/t/pip-not-working-after-downgrading/43697/5 "2024-01-20T18:51:57Z")

</div>

Sure, Thank you in advance. I have pytorch preinstalled and It gives a loong error message. I’ll attach it. When i typed “pip install ctcdecode” it gives me error message lastly saying,

/home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/c10/util/C++17.h:27:2: error: #error You need C++17 to compile PyTorch  
27 | #error You need C++17 to compile PyTorch  
| ^ ~~~~  
third\_party/kenlm/util/integer\_to\_string.cc:47:10: fatal error: util/integer\_to\_string.hh: No such file or directory  
47 | #include “util/integer\_to\_string.hh”  
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~  
compilation terminated.  
In file included from /home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,  
from /home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader\_options.h:4,  
from /home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,  
from /home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:4,  
from /home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,  
from /home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,  
`Preformatted text` from /home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/all.h:9,from/home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:3,from ctcdecode/src/binding.cpp:5:  
/home/hasitha/miniconda3/lib/python3.11/site-packages/torch/include/ATen/ATen.h:4:2: error: #error C++17 or later compatible compiler is required to use ATen.  
4 | #error C++17 or later compatible compiler is required to use ATen.  
| ^ ~~~~  
ctcdecode/src/binding.cpp:7:10: fatal error: scorer.h: No such file or directory  
7 | #include “scorer.h”  
| ^ ~~~~~~~~~  
compilation terminated.  
error: command ‘/usr/bin/gcc’ failed with exit code 1  
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.  
ERROR: Failed building wheel for ctcdecode  
Running setup.py clean for ctcdecode  
Failed to build ctcdecode  
ERROR: Could not build wheels for ctcdecode, which is required to install pyproject.toml-based projects

---

<div class="post-metadata">

**Author:** ![sandun21](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sandun21/32/17326_2.png) [@sandun21](https://discuss.python.org/u/sandun21)\
**Post date:** [January 20, 2024, 6:55pm UTC](https://discuss.python.org/t/pip-not-working-after-downgrading/43697/6 "2024-01-20T18:55:43Z")

</div>

Ah now I saw the error may be issue with g++ version I think.
