0

I have earlier used pip to install cryptography and pygame. I am using VSCODE. I have no idea what has happened, because when I tried to install pyinstaller (pip install pyinstaller) I get a whole lot of file errors (posted under). When I just write pip these also return. What could be wrong and what could be the solution to get pip working again?

Thanks in advance!

PS C:\Users\Kristian Golin\Documents\GitHub\100-Days-of-Code> pip
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\__main__.py", line 16, in <module>
    from pip._internal import main as _main  # isort:skip # noqa
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\cli\autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\cli\main_parser.py", line 12, in <module>
    from pip._internal.commands import (
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\commands\__init__.py", line 6, in <module>
    from pip._internal.commands.completion import CompletionCommand
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\commands\completion.py", line 6, in <module>
    from pip._internal.cli.base_command import Command
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\cli\base_command.py", line 23, in <module>
    from pip._internal.index import PackageFinder
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\index.py", line 14, in <module>
    from pip._vendor import html5lib, requests, six
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\html5lib\__init__.py", line 25, in <module>
    from .html5parser import HTMLParser, parse, parseFragment
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\html5lib\html5parser.py", line 8, in <module>
    from . import _tokenizer
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\html5lib\_tokenizer.py", line 16, in <module>
    from ._trie import Trie
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\html5lib\_trie\__init__.py", line 3, in <module>
    from .py import Trie as PyTrie
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\html5lib\_trie\py.py", line 6, in <module>
    from ._base import Trie as ABCTrie
  File "C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\html5lib\_trie\_base.py", line 3, in <module>
    from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\collections\__init__.py)

I have struggled to find any answers online on people having the same problem. Tried running programs as administrator, restarting computer

Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
  • `cannot import name 'Mapping' from 'collections'` suggests that this code you're attempting to use is meant for Python 2, not 3, but you're attempting to use it with a Python 3 interpreter. – Carcigenicate Jan 08 '23 at 15:21
  • @Carcigenicate The only thing I am trying to do is use the pip install in the terminal, not using any specific project/code. And pip has worked earlier. – KristianGolin Jan 08 '23 at 15:23
  • If its any consolation, that's just one import error with a large stack trace. You may have luck getting rid of the cache `pip cache purge`. Or seeing if `pip3` works. – tdelaney Jan 08 '23 at 15:52
  • https://stackoverflow.com/search?q=%5Bpip%5D+ImportError%3A+%22cannot+import+name+Mapping+from+collections%22 – phd Jan 08 '23 at 16:05
  • Patch the file `C:\Users\Kristian Golin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\html5lib\_trie\_base.py` – phd Jan 08 '23 at 16:06

0 Answers0