[SOLVED] PyCharm: pip upgrade exception

This is a solution for a problem with upgrading pip directly from PyCharm IDE.

Problem
You got an exception like below when you try to upgrade pip in PyCharm
Collecting pip==18.1
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
  Rolling back uninstall of pip

Exception:
Traceback (most recent call last):
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\basecommand.py", line 228, in main
    status = self.run(options, args)
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\commands\install.py", line 335, in run
    use_user_site=options.use_user_site,
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\req\__init__.py", line 49, in install_given_reqs
    **kwargs
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\req\req_install.py", line 748, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\req\req_install.py", line 961, in move_wheel_files
    warn_script_location=warn_script_location,
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\wheel.py", line 431, in move_wheel_files
    generated.extend(maker.make(spec))
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_vendor\distlib\scripts.py", line 403, in make
    self._make_script(entry, filenames, options=options)
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_vendor\distlib\scripts.py", line 307, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_vendor\distlib\scripts.py", line 243, in _write_script
    launcher = self._get_launcher('t')
  File "...\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_vendor\distlib\scripts.py", line 382, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

 

Solution
Install pip using command line.

Go to the
project_path\venv\Scripts\
and run
python -m pip install -U –force-reinstall pip.

Leave a Reply

avatar
  Subscribe  
Notify of
Close Menu