Pip source code string can't contain null bytes - python

I'm trying to list pip packages, but when I run pip list, I get this error message
Traceback (most recent call last):
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Ben\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe\__main__.py", line 7, in <module>
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\commands\__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\commands\list.py", line 9, in <module>
from pip._internal.cli.req_command import IndexGroupCommand
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\req_command.py", line 16, in <module>
from pip._internal.index.collector import LinkCollector
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\index\collector.py", line 14, in <module>
from pip._vendor import html5lib, requests
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\html5lib\__init__.py", line 25, in <module>
from .html5parser import HTMLParser, parse, parseFragment
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\html5lib\html5parser.py", line 6, in <module>
from . import _inputstream
File "c:\users\ben\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\html5lib\_inputstream.py", line 10, in <module>
from pip._vendor import webencodings
ValueError: source code string cannot contain null bytes
I thought it was just a problem with the list command and forgot about it, so I installed a pip package. However, when I put the command in, I still got the same error message. Pip was working fine before so I don't know if there's a problem with a piece of code I need to fix or something.

Related

python3 pip upgrade NameError: name 'unicode' is not defined

If I want to install a package with pip3 I receive following output:
Traceback (most recent call last):
File "/opt/habapp/bin/pip3", line 8, in <module>
sys.exit(main())
File "/opt/habapp/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/opt/habapp/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/habapp/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/opt/habapp/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 21, in <module>
from pip._internal.req.constructors import (
File "/opt/habapp/lib/python3.8/site-packages/pip/_internal/req/__init__.py", line 11, in <module>
from .req_file import parse_requirements
File "/opt/habapp/lib/python3.8/site-packages/pip/_internal/req/req_file.py", line 25, in <module>
from pip._internal.req.constructors import (
File "/opt/habapp/lib/python3.8/site-packages/pip/_internal/req/constructors.py", line 28, in <module>
from pip._internal.req.req_install import InstallRequirement
File "/opt/habapp/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 17, in <module>
from pip._vendor.pep517.wrappers import Pep517HookCaller
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl/pep517/wrappers.py", line 14, in <module>
File "/usr/lib/python3.8/importlib/resources.py", line 11, in <module>
from typing import Iterable, Iterator, Optional, Set, Union # noqa: F401
File "/home/openhabvm/.local/lib/python2.7/site-packages/typing.py", line 782, in <module>
AnyStr = TypeVar('AnyStr', bytes, unicode)
NameError: name 'unicode' is not defined
(habapp) openhabvm#OpenHABVM:/opt/habapp$ ^C
(habapp) openhabvm#OpenHABVM:/opt/habapp$ deactivate
openhabvm#OpenHABVM:/opt/habapp$ python3 -m pip install --upgrade pip
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 19, in <module>
sys.exit(_main())
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 21, in <module>
from pip._internal.req.constructors import (
File "/usr/lib/python3/dist-packages/pip/_internal/req/__init__.py", line 11, in <module>
from .req_file import parse_requirements
File "/usr/lib/python3/dist-packages/pip/_internal/req/req_file.py", line 25, in <module>
from pip._internal.req.constructors import (
File "/usr/lib/python3/dist-packages/pip/_internal/req/constructors.py", line 28, in <module>
from pip._internal.req.req_install import InstallRequirement
File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 17, in <module>
from pip._vendor.pep517.wrappers import Pep517HookCaller
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl/pep517/wrappers.py", line 14, in <module>
File "/usr/lib/python3.8/importlib/resources.py", line 11, in <module>
from typing import Iterable, Iterator, Optional, Set, Union # noqa: F401
File "/home/openhabvm/.local/lib/python2.7/site-packages/typing.py", line 782, in <module>
AnyStr = TypeVar('AnyStr', bytes, unicode)
NameError: name 'unicode' is not defined
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 32, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 26, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 26, in <module>
from apt.package import Package as Package, Version as Version
File "/usr/lib/python3/dist-packages/apt/package.py", line 42, in <module>
from typing import (Any, Iterable, Iterator, List, Optional, Set,
File "/home/openhabvm/.local/lib/python2.7/site-packages/typing.py", line 782, in <module>
AnyStr = TypeVar('AnyStr', bytes, unicode)
NameError: name 'unicode' is not defined
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 19, in <module>
sys.exit(_main())
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 21, in <module>
from pip._internal.req.constructors import (
File "/usr/lib/python3/dist-packages/pip/_internal/req/__init__.py", line 11, in <module>
from .req_file import parse_requirements
File "/usr/lib/python3/dist-packages/pip/_internal/req/req_file.py", line 25, in <module>
from pip._internal.req.constructors import (
File "/usr/lib/python3/dist-packages/pip/_internal/req/constructors.py", line 28, in <module>
from pip._internal.req.req_install import InstallRequirement
File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 17, in <module>
from pip._vendor.pep517.wrappers import Pep517HookCaller
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl/pep517/wrappers.py", line 14, in <module>
File "/usr/lib/python3.8/importlib/resources.py", line 11, in <module>
from typing import Iterable, Iterator, Optional, Set, Union # noqa: F401
File "/home/openhabvm/.local/lib/python2.7/site-packages/typing.py", line 782, in <module>
AnyStr = TypeVar('AnyStr', bytes, unicode)
NameError: name 'unicode' is not defined
This also occurs if I want to upgrade pip:
python3 -m pip install --upgrade pip
I upgraded Ubuntu 16.04 to 20.04. I am sure that I have deleted Python 2.
sudo update-alternatives --config python3
update-alternatives: error: no alternatives for python3
And i used sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 without errors
update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode
I hope you can help me. Thanks in advance.

How solve this Import error when pip list at venv?

I am using python3.8.8 in windows10. I just typed pip list in
venv(CMD) which showed a big error. I was using this venv for pip
installing tensorflow which also showed this similar error
## Heading ## (venv) C:\Users\HP>pip list Traceback (most recent
call last): File
"c:\users\hp\appdata\local\programs\python\python38\lib\runpy.py",
line 194, in _run_module_as_main
return _run_code(code, main_globals, None, File "c:\users\hp\appdata\local\programs\python\python38\lib\runpy.py",
line 87, in _run_code
exec(code, run_globals) File "C:\Users\HP\venv\Scripts\pip.exe\__main__.py", line 7, in <module>
File "c:\users\hp\venv\lib\site-packages\pip\_internal\cli\main.py",
line 71, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args)) File
"c:\users\hp\venv\lib\site-packages\pip\_internal\commands\__init__.py",
line 96, in create_command
module = importlib.import_module(module_path) File "c:\users\hp\appdata\local\programs\python\python38\lib\importlib\__init__.py",
line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in
_find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen
importlib._bootstrap_external>", line 783, in exec_module File
"<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed File "c:\users\hp\venv\lib\site-packages\pip\_internal\commands\list.py",
line 5, in <module>
from pip._internal.cli.req_command import IndexGroupCommand File
"c:\users\hp\venv\lib\site-packages\pip\_internal\cli\req_command.py",
line 16, in <module>
from pip._internal.index.collector import LinkCollector File "c:\users\hp\venv\lib\site-packages\pip\_internal\index\collector.py",
line 16, in <module>
from pip._vendor import html5lib, requests File "c:\users\hp\venv\lib\site-packages\pip\_vendor\html5lib\__init__.py",
line 25, in <module>
from .html5parser import HTMLParser, parse, parseFragment File "c:\users\hp\venv\lib\site-packages\pip\_vendor\html5lib\html5parser.py",
line 6, in <module>
from . import _inputstream File "c:\users\hp\venv\lib\site-packages\pip\_vendor\html5lib\_inputstream.py",
line 10, in <module>
from pip._vendor import webencodings ImportError: cannot import name 'webencodings' from 'pip._vendor'
(c:\users\hp\venv\lib\site-packages\pip\_vendor\__init__.py)

I'm facing some issues with pip version 20.1.1. Down below is the exact error I'm getting from pip

Here is the stacktrace I get from pip. I'm running Windows 10.
What to do here?
I can see the pip version and other options with main but can't download / install any packages.
D:\Python>python.exe -m pip install --upgrade pip
Traceback (most recent call last):
File "D:\Python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Python\lib\site-packages\pip\__main__.py", line 26, in <module>
sys.exit(_main())
File "D:\Python\lib\site-packages\pip\_internal\cli\main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "D:\Python\lib\site-packages\pip\_internal\commands\__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "D:\Python\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\Python\lib\site-packages\pip\_internal\commands\install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
File "D:\Python\lib\site-packages\pip\_internal\cli\req_command.py", line 16, in <module>
from pip._internal.index.package_finder import PackageFinder
File "D:\Python\lib\site-packages\pip\_internal\index\package_finder.py", line 21, in <module>
from pip._internal.index.collector import parse_links
File "D:\Python\lib\site-packages\pip\_internal\index\collector.py", line 14, in <module>
from pip._vendor import html5lib, requests
File "D:\Python\lib\site-packages\pip\_vendor\html5lib\__init__.py", line 25, in <module>
from .html5parser import HTMLParser, parse, parseFragment
File "D:\Python\lib\site-packages\pip\_vendor\html5lib\html5parser.py", line 7, in <module>
from . import _inputstream
File "D:\Python\lib\site-packages\pip\_vendor\html5lib\_inputstream.py", line 9, in <module>
from pip._vendor import webencodings
ImportError: cannot import name 'webencodings' from 'pip._vendor' (D:\Python\lib\site-packages\pip\_vendor\__init__.py)
This is due to broken build process just revert the pip version.
Try this:
$ pip install -U "pip<20" setuptools

ImportError: cannot import name 'ensure_str' from 'six'

when i tried to install netfilterqueue this error came up.
even i can't uninstall/check/install using pip.
And i searched over the stackoverflow and one of those said use :
sudo pip install -U setuptools
And again this error came up.
Traceback (most recent call last):
File "/usr/bin/pip", line 33, in <module>
sys.exit(load_entry_point('pip==20.1.1', 'console_scripts', 'pip')())
File "/usr/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
File "/usr/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 20, in <module>
from pip._internal.operations.prepare import RequirementPreparer
File "/usr/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 15, in <module>
from pip._internal.distributions import (
File "/usr/lib/python3.8/site-packages/pip/_internal/distributions/__init__.py", line 2, in <module>
from pip._internal.distributions.wheel import WheelDistribution
File "/usr/lib/python3.8/site-packages/pip/_internal/distributions/wheel.py", line 5, in <module>
from pip._internal.utils.wheel import pkg_resources_distribution_for_wheel
File "/usr/lib/python3.8/site-packages/pip/_internal/utils/wheel.py", line 12, in <module>
from pip._vendor.six import PY2, ensure_str
ImportError: cannot import name 'ensure_str' from 'six' (/usr/lib/python3.8/site-packages/six.py)
Thanks in advance.
I was able to make this work by copying six.py from https://github.com/benjaminp/six.git into /usr/lib/python3.8/six.py ... you'll need sudo to create or update this file.

Windows 10-Python Pip Install pyinstaller error

I had this error when i tried to do: pip install pyinstaller.
So please help me with this error i got because i have been searching for ages to fix this error.
The error line when i tried to install pyinstaller using PIP:
C:\Users\Admin\Documents\Code>pip install pyinstaller
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\__main__.py", line 26, in <module>
sys.exit(_main())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\cli\main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\commands\__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\commands\install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\cli\req_command.py", line 16, in <module>
from pip._internal.index.package_finder import PackageFinder
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\index\package_finder.py", line 21, in <module>
from pip._internal.index.collector import parse_links
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\index\collector.py", line 14, in <module>
from pip._vendor import html5lib, requests
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_vendor\requests\__init__.py", line 114, in <module>
from . import utils
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_vendor\requests\utils.py", line 27, in <module>
from ._internal_utils import to_native_string
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_vendor\requests\_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str, str
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_vendor\requests\compat.py", line 65, in <module>
from http.cookies import Morsel
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 779, in exec_module
File "<frozen importlib._bootstrap_external>", line 915, in get_code
File "<frozen importlib._bootstrap_external>", line 973, in get_data
OSError: [Errno 9] Bad file descriptor
If hippozhipos's comment does not work, you could try to install Python from www.python.org instead of the Microsoft Store. Make sure to tick the "add python to PATH" box in the installation process.
It looks like you're using python 3.8
try: py -3.8 -m pip install pyinstaller
This worked for me when I had a similar problem.
if you're installing this in a virtual environment, you can also do:
PathToVirtualEnv\Scripts\Python -m pip install pyinstaller

Categories