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 6.0.8 AttributeError when upgrading to 6.1.1 in virtualenv #2669

Closed
ratiotile opened this issue Apr 9, 2015 · 37 comments
Closed

pip 6.0.8 AttributeError when upgrading to 6.1.1 in virtualenv #2669

ratiotile opened this issue Apr 9, 2015 · 37 comments
Labels
auto-locked Outdated issues that have been locked by automation OS: windows Windows specific type: bug A confirmed bug or unintended behavior

Comments

@ratiotile
Copy link

Windows 7, Python 3.4.3, updated pip in base. Created virtualenv, saw that it was still on pip 6.0.8

Activated venv, ran python -m pip install pip -U

log:

Installing collected packages: pip
  Found existing installation: pip 6.0.8
    Uninstalling pip-6.0.8:
      Successfully uninstalled pip-6.0.8

  Rolling back uninstall of pip
...
     result = finder(distlib_package).find(name).bytes
 AttributeError: 'NoneType' object has no attribute 'bytes'

However, next time I run pip -V, it reports pip 6.1.1, so what is the effect of the error?

@rbtcollins
Copy link

So, this indicates that the finder didn't find the requested package. There's a reference to a closed issue 31 there in the code, but at a minimum we should be more defensive and report the parameters that failed ere.

@ratiotile
Copy link
Author

Thanks that's good to know. So it uninstalled/installed correctly, but then it goes back and tries to find the old version again which fails?

@rbtcollins
Copy link

That failure is in ScriptMaker, so I suspect it was at the point of making the pip.exe that it failed, and further that the uninstall rollback didn't really do much, so you've got a new pip.exe entrypoint which is importing the newly installed pip version, explaining the error you're seeing.

To see if the bug is fixed, try doing a pip install -U --reinstall pip

@ratiotile
Copy link
Author

I get no such option: --reinstall

@rbtcollins
Copy link

sorry, --force-reinstall

@ratiotile
Copy link
Author

yes, no errors this time.

@rbtcollins
Copy link

Another report of the same: http://paste.ubuntu.com/10787243/ followed by http://paste.ubuntu.com/10787273/

@rbtcollins
Copy link

So both pip 6.0.8 and 1.5.6 fail to install 6.1.1 on Windows

@rbtcollins
Copy link

#2673 has another occurence of this.

@seanvikoren
Copy link

pip install --upgrade pip
I am having the same problem: 6.0.8 to 6.1.1 (Python 2.7.8)
"pip install -U --force-reinstall pip" does not solve the issue for me.

C:\Python27
λ pip install --upgrade pip
You are using pip version 6.0.8, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.1.1-py2.py3-none-any.whl#md5=172eb5abab25a5e0f7a7b63c7a49378d
  Using cached pip-6.1.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.8
    Uninstalling pip-6.0.8:
      Successfully uninstalled pip-6.0.8

  Rolling back uninstall of pip
  Exception:
  Traceback (most recent call last):
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\basecommand.py", line 232, in main
      status = self.run(options, args)
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\commands\install.py", line 347, in run
      root=options.root_path,
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\req\req_set.py", line 549, in install
      **kwargs
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\req\req_install.py", line 754, in install
      self.move_wheel_files(self.source_dir, root=root)
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\req\req_install.py", line 963, in move_wheel_files
      isolated=self.isolated,
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\wheel.py", line 344, in move_wheel_files
      generated.extend(maker.make(spec))
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\distlib\scripts.py", line 323, in make
      self._make_script(entry, filenames, options=options)
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\distlib\scripts.py", line 227, in _make_script
      self._write_script(scriptnames, shebang, script, filenames, ext)
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\distlib\scripts.py", line 163, in _write_script
      launcher = self._get_launcher('t')
    File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\distlib\scripts.py", line 302, in _get_launcher
      result = finder(distlib_package).find(name).bytes
  AttributeError: 'NoneType' object has no attribute 'bytes'

@thedewster74
Copy link

I also experience this on Python 2.7.9 x64, on Windows 8.1

e:\>pip install -U  --force-reinstall pip
You are using pip version 6.0.8, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
  Using cached pip-6.1.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.8
    Uninstalling pip-6.0.8:
      Successfully uninstalled pip-6.0.8

  Rolling back uninstall of pip
  Exception:
  Traceback (most recent call last):
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\basecommand.py", line 232, in main
      status = self.run(options, args)
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\commands\install.py", line 347, in run
      root=options.root_path,
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\req\req_set.py", line 549, in install
      **kwargs
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\req\req_install.py", line 754, in install
      self.move_wheel_files(self.source_dir, root=root)
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\req\req_install.py", line 963, in move_wheel_files
      isolated=self.isolated,
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\wheel.py", line 344, in move_wheel_files
      generated.extend(maker.make(spec))
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\distlib\scripts.py", line 323, in make
      self._make_script(entry, filenames, options=options)
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\distlib\scripts.py", line 227, in _make_script
      self._write_script(scriptnames, shebang, script, filenames, ext)
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\distlib\scripts.py", line 163, in _write_script
      launcher = self._get_launcher('t')
    File "c:\python27x64\lib\site-packages\pip-6.0.8-py2.7.egg\pip\_vendor\distlib\scripts.py", line 302, in _get_launcher
      result = finder(distlib_package).find(name).bytes
  AttributeError: 'NoneType' object has no attribute 'bytes'

@21hook
Copy link

21hook commented May 24, 2015

pip 1.5.6 failed to upgrade to 7.0.1 on python 3.4.3 on Windows

Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.1-py2
.py3-none-any.whl#md5=9b403ba9b82d4a1e5fda5b6cc8952b57
  Using cached pip-7.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.8
    Exception:
    Traceback (most recent call last):
      File "E:\本地下载\python\lib\site-packages\pip\basecommand.py", line 232,
in main
        status = self.run(options, args)
      File "E:\本地下载\python\lib\site-packages\pip\commands\install.py", line
347, in run
        root=options.root_path,
      File "E:\本地下载\python\lib\site-packages\pip\req\req_set.py", line 543,
in install
        requirement.uninstall(auto_confirm=True)
      File "E:\本地下载\python\lib\site-packages\pip\req\req_install.py", line 6
25, in uninstall
        for path in pip.wheel.uninstallation_paths(dist):
      File "E:\本地下载\python\lib\site-packages\pip\wheel.py", line 407, in uni
que
        for item in fn(*args, **kw):
      File "E:\本地下载\python\lib\site-packages\pip\wheel.py", line 426, in uni
nstallation_paths
        r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
      File "E:\本地下载\python\lib\site-packages\pip\_vendor\pkg_resources\__ini
t__.py", line 1540, in get_metadata_lines
        return yield_lines(self.get_metadata(name))
      File "E:\本地下载\python\lib\site-packages\pip\_vendor\pkg_resources\__ini
t__.py", line 1537, in get_metadata
        return self._get(self._fn(self.egg_info, name)).decode("utf-8")
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 22942:
invalid start byte

@Tset-Noitamotua
Copy link

Same sh** with pip 7.1.0 with Python 2.7 on Window 7 64bit - see below.

BUT HAPPILY easy_install -U pip did it for me and upgraded to 7.1.2 :)

H:\>pip install -U pip
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Collecting pip
  Using cached pip-7.1.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 7.1.0
    Uninstalling pip-7.1.0:
      Successfully uninstalled pip-7.1.0
  Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\basecommand.py", line 223, in main
    status = self.run(options, args)
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\commands\install.py", line 299, in run
    root=options.root_path,
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\req\req_set.py", line 646, in install
    **kwargs
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\req\req_install.py", line 813, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\req\req_install.py", line 1008, in move_wheel_files
    isolated=self.isolated,
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\wheel.py", line 449, in move_wheel_files
    generated.extend(maker.make(spec))
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\_vendor\distlib\scripts.py", line 323, in make
    self._make_script(entry, filenames, options=options)
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\_vendor\distlib\scripts.py", line 227, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\_vendor\distlib\scripts.py", line 163, in _write_script
    launcher = self._get_launcher('t')
  File "c:\python27\lib\site-packages\pip-7.1.0-py2.7.egg\pip\_vendor\distlib\scripts.py", line 302, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

@michalfita
Copy link

Same problem on Windows 7 x64, pip 7.1.2, pypy 2.4.0 on initial installation using the get-pip script:

Installing collected packages: pip, setuptools, wheel
Exception:
Traceback (most recent call last):
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/basecommand.py
", line 211, in main
    status = self.run(options, args)
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/commands/insta
ll.py", line 311, in run
    root=options.root_path,
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/req/req_set.py
", line 646, in install
    **kwargs
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/req/req_instal
l.py", line 803, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/req/req_instal
l.py", line 998, in move_wheel_files
    isolated=self.isolated,
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/wheel.py", lin
e 449, in move_wheel_files
    generated.extend(maker.make(spec))
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/_vendor/distli
b/scripts.py", line 353, in make
    self._make_script(entry, filenames, options=options)
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/_vendor/distli
b/scripts.py", line 257, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/_vendor/distli
b/scripts.py", line 193, in _write_script
    launcher = self._get_launcher('t')
  File "c:\users\manveru\appdata\local\temp\tmpz6jby3\pip.zip\pip/_vendor/distli
b/scripts.py", line 332, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

The trick with:

pypy -m pip install -U --force-reinstall pip

worked.

@MatijaxD
Copy link

@AbdullahRaza
Copy link

easy_install -U pip worked for me . Thanks 👍

@laolai
Copy link

laolai commented Feb 17, 2016

easy_install -U pip worked for me too . Thanks for all

@PaluMacil
Copy link

Win 10 and Python 3.4.4, same error, the pip force reinstall thing didn't work but the easy_install -U pip did.

@Zitrax
Copy link

Zitrax commented Jul 20, 2016

Same here, using easy_install helped.

@summerela
Copy link

Yep, same. Windows 10. Python 2.7.10.

easy_install -U pip

The above command worked.

@driftluo
Copy link

driftluo commented Dec 7, 2016

Yes, the same error. Windows 10. Python 3.5.1.
easy_install -U pip
But the above command worked

@marlboro3420
Copy link

Windows 10. Python 2.7.12.

easy_install -U pip

可以更新,不过如果Python安装在C盘可能没有权限操作文件会报错,用管理员权限启动cmd可以解决。

@weistart
Copy link

weistart commented Mar 3, 2017

easy_install -U pip worked for me . Thanks 👍

@RonnyPfannschmidt
Copy link
Contributor

please note that easy_install -U pip has some dire consequences as it does an egg based install instead of a sane install

@dstufft
Copy link
Member

dstufft commented Mar 31, 2017

Closing this, if it continues to happen please reopen this issue or open a new one with reproduction steps.

@dstufft dstufft closed this as completed Mar 31, 2017
@CaterWang
Copy link

I was run 'python -m pip install -U --force-reinstall pip' , python 3.6
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 742, in install
**kwargs
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\wheel.py", line 463, in move_wheel_files
generated.extend(maker.make(spec))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip_vendor\distlib\scripts.py", line 372, in make
self._make_script(entry, filenames, options=options)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip_vendor\distlib\scripts.py", line 276, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip_vendor\distlib\scripts.py", line 212, in _write_script
launcher = self._get_launcher('t')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip_vendor\distlib\scripts.py", line 351, in _get_launcher
result = finder(distlib_package).find(name).bytes
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip_vendor\distlib\resources.py", line 324, in finder
raise DistlibException('Unable to locate finder for %r' % package)
pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

@OrangeDog
Copy link

OrangeDog commented Mar 29, 2018

Getting the error on a Windows 10 virtualenv.

> python --version
Python 3.6.3
> pip --version
pip 9.0.1 from c:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg (python 3.6)
> python -m pip install --upgrade pip
Collecting pip
  Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 729kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
  Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\req\req_set.py", line 784, in install
    **kwargs
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\wheel.py", line 462, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 372, in make
    self._make_script(entry, filenames, options=options)
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 276, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 212, in _write_script
    launcher = self._get_launcher('t')
  File "C:\...\venv\lib\site-packages\pip-9.0.1-py3.6.egg\pip\_vendor\distlib\scripts.py", line 351, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

@pradyunsg
Copy link
Member

@OrangeDog I'm curious how you have pip 9.0.1 installed as an egg. That shouldn't happen usually.

@OrangeDog
Copy link

@pradyunsg interesting.
The system Python was installed with the official Windows installer.
The virtualenv was created by IntelliJ IDEA (with the Python plugin).

@pfmoore
Copy link
Member

pfmoore commented Mar 29, 2018

Older versions of IntelliJ IDEA installed pip as an egg. I reported that some time ago (over a year, I think) and I thought they'd fixed it. Are you using an old version of IDEA?

@pfmoore
Copy link
Member

pfmoore commented Mar 29, 2018

@OrangeDog
Copy link

That was only one version ago, and the ticket is still open, so I guess that's why.
Is there an easy way to re-install it as not an egg?

@timjklein36
Copy link

timjklein36 commented Apr 5, 2018

I also faced this issue, when using Intellij IDEA to set up the virtualenv.
Python: 3.6.3
Pip: 9.0.1
Intellij: 2018.1 (Ultimate Edition) 181.4203.550
Windows 7: 6.1

Running easy_install -U pip seemed to work for me. Not sure if @RonnyPfannschmidt's warning is relevant as I don't know what an "egg based install" is. It installed pip 10.0.0b2 and seems to be working fine.

@OrangeDog
Copy link

Is there an easy way to re-install it as not an egg?

virtualenv --clear will do it, but also wipes all the other packages

@ned2
Copy link

ned2 commented Apr 26, 2018

I'm seeing this same problem trying to upgrade pip within a virtualenv that was created with pip 9.0.1 by PyCharm.

@pradyunsg
Copy link
Member

This seems to be occurring again, with pip 9 -> pip 10 upgrades. Issue for that is #5343.

@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 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 OS: windows Windows specific type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests