Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pip 19.0.3 -> 19.2.3 fails with AttributeError: 'NoneType' object has no attribute 'bytes' #7069

Closed
DobroAlex opened this issue Sep 23, 2019 · 8 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@DobroAlex
Copy link

DobroAlex commented Sep 23, 2019

Environment

  • pip version: 19.0.3
  • Python version: 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
  • OS: Win10 (1809, 17763.737)

Description
Error occurs during upgrade.

Expected behavior
pip installs without error.

How to Reproduce

  1. Download Python 3.7.4 from https://www.python.org/downloads/release/python-374/ (web-based installer)
  2. Install for all users
  3. Open cmd / PowerShell as admin
  4. C:\WINDOWS\system32>python -m pip install --upgrade pip

Output

Collecting pip
  Using cached https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
  Rolling back uninstall of pip
  Moving to c:\users\user\appdata\roaming\python\python37\scripts\pip.exe
   from C:\Users\User\AppData\Local\Temp\pip-uninstall-akvm93y4\pip.exe
  Moving to c:\users\user\appdata\roaming\python\python37\scripts\pip3.7.exe
   from C:\Users\User\AppData\Local\Temp\pip-uninstall-akvm93y4\pip3.7.exe
  Moving to c:\users\user\appdata\roaming\python\python37\scripts\pip3.exe
   from C:\Users\User\AppData\Local\Temp\pip-uninstall-akvm93y4\pip3.exe
  Moving to c:\users\user\appdata\roaming\python\python37\site-packages\pip-19.0.3.dist-info\
   from c:\users\user\appdata\roaming\python\python37\site-packages\~ip-19.0.3.dist-info
  Moving to c:\users\user\appdata\roaming\python\python37\site-packages\pip\
   from c:\users\user\appdata\roaming\python\python37\site-packages\~ip
Exception:
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\cli\base_command.py", line 179, in main
    status = self.run(options, args)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\commands\install.py", line 393, in run
    use_user_site=options.use_user_site,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\__init__.py", line 57, in install_given_reqs
    **kwargs
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\req_install.py", line 913, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\req_install.py", line 445, in move_wheel_files
    warn_script_location=warn_script_location,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\wheel.py", line 544, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 405, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 309, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 245, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 384, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

I also tried using solution from #5820 (comment)

C:\WINDOWS\system32>python -m pip install -U --force-reinstall pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
  Rolling back uninstall of pip
  Moving to c:\users\user\appdata\roaming\python\python37\scripts\pip.exe
   from C:\Users\User\AppData\Local\Temp\pip-uninstall-1kl45zbn\pip.exe
  Moving to c:\users\user\appdata\roaming\python\python37\scripts\pip3.7.exe
   from C:\Users\User\AppData\Local\Temp\pip-uninstall-1kl45zbn\pip3.7.exe
  Moving to c:\users\user\appdata\roaming\python\python37\scripts\pip3.exe
   from C:\Users\User\AppData\Local\Temp\pip-uninstall-1kl45zbn\pip3.exe
  Moving to c:\users\user\appdata\roaming\python\python37\site-packages\pip-19.0.3.dist-info\
   from c:\users\user\appdata\roaming\python\python37\site-packages\~ip-19.0.3.dist-info
  Moving to c:\users\user\appdata\roaming\python\python37\site-packages\pip\
   from c:\users\user\appdata\roaming\python\python37\site-packages\~ip
Exception:
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\cli\base_command.py", line 179, in main
    status = self.run(options, args)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\commands\install.py", line 393, in run
    use_user_site=options.use_user_site,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\__init__.py", line 57, in install_given_reqs
    **kwargs
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\req_install.py", line 913, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\req\req_install.py", line 445, in move_wheel_files
    warn_script_location=warn_script_location,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_internal\wheel.py", line 544, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 405, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 309, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 245, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pip\_vendor\distlib\scripts.py", line 384, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

ы

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Sep 23, 2019
@tirkarthi
Copy link
Contributor

See also #6546 which seems to have a similar traceback.

@vipul02
Copy link

vipul02 commented Oct 8, 2019

You can have different pip version already installed, on cmd type pip -V to check version and path.
Your pip location should be "python\python37-32\lib\site-packages\pip (python 3.7)" i.e. inside python folder, try removing other version of pip. If situation persists update pip using easy_install.

@gagibran
Copy link

easy_install -U pip worked for me.

@DobroAlex
Copy link
Author

DobroAlex commented Oct 19, 2019

easy_install -U pip worked for me.
@gagibran, might actually work but I wanted to notify devs about problem with native installer. In the end, PiP should be able to update itself, am I right?

@vipul02
Copy link

vipul02 commented Oct 19, 2019

@DobroAlex, actually easy_install was hack and pip is working perfectly fine, it's just that you need to do it right way, the problem above according to me is that you are updating different pip from pip, it's kind of confusing, but it is the case. When I checked what is path of the pip I was using, it was different from the correct, actually in my case there were two pips, one was original and other was created at the location where all the cache files for pip were found and the "pip" command I was using had path which was in cache and which cannot be updated, I don't know how it was created but it was and then I changed the path of pip and run the command for upgrading pip, it's works smoothly.

@DobroAlex
Copy link
Author

Solved. The problem was that there was old pip installed in Roam Data (don't know how exactly did it get there) and it was causing issues because it was not properly installed. The solution is to find there your pip is (thanks to @vipul02 #7069 (comment)) and erase everything pip-related there. Next step is to download pip properly (I used curl and my python 3.7 location in C:\Program Files\Python37) and then install it. That's pretty much it

@mrsmirzaee
Copy link

I uesd ithis command " easy_install -U pip "
and work for me

@tonystevenj
Copy link

"easy_install -U pip" works!

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Nov 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 28, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Nov 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

6 participants