Hello,
First of all we're sorry for bringing 12.04 to the table.
When installing python-pip by apt-get we get pip 1.0. So the first move is to upgrade pip and setuptools ASAP.
The problem seems to be pip 1.0 installing the version 10.0.0b2 which is a beta version we think, and this leads to setuptools failing with this:
pip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)
Removing intermediate container 31c51d6b2183
---> cfdd9c752b0e
Step 4/6 : RUN pip install --upgrade pip -i https://pypi.python.org/simple/
---> Running in a435987c0e6b
Downloading/unpacking pip
Running setup.py egg_info for package pip
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching '.landscape.yml'
warning: no previously-included files found matching 'src/pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching '*-requirements.txt'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching 'src/pip/_vendor/six'
warning: no previously-included files matching '*.pyi' found under directory 'src/pip/_vendor'
no previously-included directories found matching '.github'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/build'
no previously-included directories found matching 'news'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
Installing collected packages: pip
Found existing installation: pip 1.0
Uninstalling pip:
Successfully uninstalled pip
Running setup.py install for pip
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching '.landscape.yml'
warning: no previously-included files found matching 'src/pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching '*-requirements.txt'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching 'src/pip/_vendor/six'
warning: no previously-included files matching '*.pyi' found under directory 'src/pip/_vendor'
no previously-included directories found matching '.github'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/build'
no previously-included directories found matching 'news'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin
Successfully installed pip
Cleaning up...
Removing intermediate container a435987c0e6b
---> d115c20b1ad7
Step 5/6 : RUN pip --version
---> Running in 96df697fa919
pip 10.0.0b2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
Removing intermediate container 96df697fa919
---> 1bf199e16f73
Step 6/6 : RUN pip install -U setuptools
---> Running in de2c32bb7554
/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Collecting setuptools
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/commands/install.py", line 291, in run
resolver.resolve(requirement_set)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/resolve.py", line 103, in resolve
self._resolve_one(requirement_set, req)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/resolve.py", line 257, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
self.require_hashes
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/operations/prepare.py", line 237, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/req/req_install.py", line 307, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 484, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 442, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 587, in _get_pages
page = self._get_page(location)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 705, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 814, in get_page
"Cache-Control": "max-age=600",
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/download.py", line 397, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/adapter.py", line 42, in send
cached_response = self.controller.cached_request(request)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/controller.py", line 137, in cached_request
resp = self.serializer.loads(request, cache_data)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/serialize.py", line 98, in loads
return getattr(self, "_loads_v{0}".format(ver))(request, data)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/serialize.py", line 190, in _loads_v4
cached = msgpack.loads(data, encoding='utf-8')
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/msgpack/fallback.py", line 121, in unpackb
ret = unpacker._unpack()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/msgpack/fallback.py", line 600, in _unpack
ret[key] = self._unpack(EX_CONSTRUCT)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/msgpack/fallback.py", line 600, in _unpack
ret[key] = self._unpack(EX_CONSTRUCT)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/msgpack/fallback.py", line 560, in _unpack
typ, n, obj = self._read_header(execute)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/msgpack/fallback.py", line 391, in _read_header
n = struct.unpack_from(">H", self._buffer, self._buff_i)[0]
TypeError: unpack_from() argument 1 must be string or read-only buffer, not bytearray
/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
The command '/bin/sh -c pip install -U setuptools' returned a non-zero code: 2
This is a docker file to reproduce the problem:
FROM ubuntu:12.04
RUN apt-get update && apt-get install -y python-pip
RUN pip --version
RUN pip install --upgrade pip -i https://pypi.python.org/simple/
RUN pip --version
RUN pip install -U setuptools聽
We can workaround this by capping pip to 9.0.3 but we were wondering if there's a better solution...
Maybe the debian package could install a better version? (Debian might be mad bro)
Maybe pip should not install 10.0.0b2? (but i understand that you don't support pip 1.0)
Maybe 10.0.0b2 should not fail at updating setuptools?
Thank you very much for your hard work.
Wow, pip 1.0 is a very old version!
As far as I know, recent versions of pip should not install the beta unless you pass an explicit --pre
flag in the install. If you can reproduce this behaviour in pip 9.0.3, then we should look into it. But I suspect it's just because pip 1.0 is so old.
Yeah, I did some digging into the git history, and the --pre
option wasn't in pip 1.0. Looks like it was introduced in 1.4: https://github.com/pypa/pip/blob/master/NEWS.rst#14-2013-07-23
Yes we agree this is an old version, but it's still python 2.7 and the new pip 10.0.0b2 can't install setuptools...
So is it not retro-compatible or just a problem of this version?
Should we open an issue specifically for 10.0.0b2 not installing setuptools on python 2.7?
That InsecurePlatformWarning
suggests to me that your ssl might be out of date as well. What version of Python 2.7 do you have? You need at least 2.7.9 I believe.
I suspect the problem is that CPython changed something between the version of 2.7 in Ubuntu 12.04 and the latest version of 2.7 that the msgpack library isn't setup to handle and it causes an error there.
We tested on trusty with a 2.7.6 python and it worked with pip 10.0.0b2... that means you are probably right our python 2.7.3 is probably the cause, and it is the version packaged version for 12.04 (precise pangolin).
So i think having 3 too old version (pip, python and ubuntu) is a bit too much. Let's call this a day and pip install to a <=9.0.3 before doing an open pip upgrade will be the solution.
Thanks all!
Kind of sad to see this get closed as a "that was weird" resolution...
Running in a Debian 9 Container (openjdk:jdk-8) fully updated installing Napalm was succeeding last week and this week is not... After a day of digging the throw down rat is running easyinstall -U pip
which now is getting 10.0.0b2 where previously it was updating from 9.0.1 to 9.0.3.
After removing the offending upgraded pip and using the packaged pip (9.0.1) on openjdk:jdk-8 everything is magically working.
I won't disagree that 2.7 is ancient, but unfortunately the breaking changes in python3 and the lack of community (and closed source vendors) motivation to update and their code to be compatible with python3 really leaves most of us in a really crappy situation, those who have updated their code fling mud at those who have not, leaving the users stuck in the middle of "it sucks, I suck for needing resonable backwards compatibility, and you suck for acting that way".
Surely there has to be a way to make this not suck so exceptionally.
Upgrading pip 1.0 directly will always be a problem because that version didn't have a "don't install prereleases" flag. The fix for that is to do it in 2 phases - 1.0 to 1.4+ then 1.4+ to latest (non-prerelease).
Python 2.7 needs to be upgraded to later versions to keep up with current security vulnerabilities. There's no real way round that. I assume that your OS vendor provides updates to the current version of 2.7, but if not, then I guess that's a manual job.
Not sure what else we can offer here?
In general pip works fine on 2.7, it's only sufficiently old versions of 2.7 that have the specific problem in this issue. Debian 9 is using 2.7.13 so that's pretty recent, are you getting the same error message, the one that looks like:
TypeError: unpack_from() argument 1 must be string or read-only buffer, not bytearray
Or are you getting a different one? If it's a different one then that is a different issue and would need to be raised individually.
I am receiving pip.req missing
Collecting napalm-ansible==0.8.0 (from -r /tmp/requirements.txt (line 33))
Downloading napalm-ansible-0.8.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-3ZtSwW/napalm-ansible/setup.py", line 5, in <module>
from pip.req import parse_requirements
ImportError: No module named req
Regardless of the error getting a beta release without flag is the cause (directly or indirectly) Here is replication steps:
root@e6fb3d0ba1f0:/# pip -V
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
root@e6fb3d0ba1f0:/# pip list | grep napalm-ansible
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
napalm-ansible (0.9.0)
root@e6fb3d0ba1f0:/# pip uninstall napalm-ansible
Uninstalling napalm-ansible-0.9.0:
root@e6fb3d0ba1f0:/# easy_install -U pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Downloading https://pypi.python.org/packages/32/67/572f642e6e42c580d3154964cfbab7d9322c23b0f417c6c01fdd206a2777/pip-10.0.0b2.tar.gz#md5=cbfc1208d00bb72aba19431a7bb4afd5
Best match: pip 10.0.0b2
Processing pip-10.0.0b2.tar.gz
Writing /tmp/easy_install-1FQbS8/pip-10.0.0b2/setup.cfg
Running pip-10.0.0b2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-1FQbS8/pip-10.0.0b2/egg-dist-tmp-6e6W6a
root@e6fb3d0ba1f0:/# easy_install napalm-ansible
Searching for napalm-ansible
Reading https://pypi.python.org/simple/napalm-ansible/
Downloading https://pypi.python.org/packages/61/34/a0d481866c4b494452ec45650bdc7ac0720af676b567d5aaafefd5723d22/napalm-ansible-0.9.0.tar.gz#md5=f02eb977e24080ffe2f5391305759396
Best match: napalm-ansible 0.9.0
Processing napalm-ansible-0.9.0.tar.gz
Writing /tmp/easy_install-GRdxWz/napalm-ansible-0.9.0/setup.cfg
Running napalm-ansible-0.9.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-GRdxWz/napalm-ansible-0.9.0/egg-dist-tmp-YNQNQV
Traceback (most recent call last):
File "/usr/bin/easy_install", line 11, in <module>
load_entry_point('setuptools==33.1.1', 'console_scripts', 'easy_install')()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2325, in main
**kw
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 436, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 699, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 725, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 906, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1145, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1131, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 258, in run_setup
raise
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 169, in save_modules
saved_exc.resume()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 144, in resume
six.reraise(type, exc, self._tb)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 157, in save_modules
yield saved
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 255, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 285, in run
return func()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 253, in runner
_execfile(setup_script, ns)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 47, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-GRdxWz/napalm-ansible-0.9.0/setup.py", line 5, in <module>
ImportError: No module named req
root@e6fb3d0ba1f0:/# pip install napalm-ansible
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
This is in a openjdk:8-jdk container which is debian 9. Clearly something is suspect with the 10.0.0b2 release.
And let me be VERY clear on this... we are not talking V1.X.X we are talking V10 which was just released 3 days ago at 10.0.0b1 and yesterday at 10.0.0b2
So that sounds entirely different? You're using easy_install to install pip, so if there is a bug here, it's in easy_install, not pip. And using easy_install to install has been deprecated for ages, as far as I know.
Also, you're doing from pip.req import parse_requirements
. That will break in pip 10, a fact which was announced back in October. If you want your code to work with pip 10, you'll need to modify it (to not import pip's internal APIs).
But all of this is different issues from the OP's problem.
pfmoore fair enough... I am happy to live on 9.x, but my argument was more to the effect of the OP's complaint being valid... a Beta release is going out via main stream distribution method, to further demonstrate that effect, seeing the beta release is now absent from https://pypi.python.org/simple/ suggests that this is known and resolved... I am happy to call it a day on this front but, easy_install still is distributing where as the means of the OP's complaint no longer is passing the beta release out.
It's not absent, it's still there and available for install.
Also, you're doing from pip.req import parse_requirements. That will break in pip 10, a fact which was announced back in October. If you want your code to work with pip 10, you'll need to modify it (to not import pip's internal APIs).
Would you mind posting a link to that announcement and indicating what is the proposed alternative?
https://mail.python.org/pipermail/distutils-sig/2017-October/031642.html and https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program
Short answer: If you're using pip.main
(which was never supported, but is used by a number or people/projects), you should switch to
subprocess.call([sys.executable, '-m', 'pip', ...])
which does the same but in a supported manner.
If you're using any other pip internal APIs, they have never been supported, are likely to have been broken by the internal processing changes in pip 10 anyway, and you should look for other 3rd party packages (or the relevant standards which will allow you to code your own alternatives) that offer the functionality you need.
I see two problems:
subprocess.call
: I find interesting that's the recommended way of using pip
from my python code. Almost like having someone recommend me to scrape their website to get the data I need instead of providing an API.from pip.req import parse_requirements
, which is used by lots of packages, is going to cause lots of issues to a lot of people for a very arbitrary reason.Not saying I disagree with your decision, it's yours to take after all, just that it's going to cause havoc and break a lot of things for no real reason other than "to give people the incentive to find a supported approach". And all that without even raising a DeprecationWarning
notice ahead of time.
Sorry but this is off topic for this issue (which is about pip 1.0!). To clarify (although this has been discussed repeatedly on many other issues where people have asked "does pip have a programming API?") pip is a command line tool, and doesn't have a programming API - it never has. Expecting users to call pip as a subprocess is no more unusual than expecting users to call git that way - you wouldn't expect to be able to import git
in your Python program, would you?
from pip.req import parse_requirements
and similar imports of pip internals have never been supported, and have only ever worked to the extent that people have dug into the sources and copied how pip works internally (often missing subtleties that later cause them issues) - we've never documented that it's OK to do this, and we've consistently told people who have tried to do this and had problems that it's not allowed. I'm not clear why there should be any need to deprecate something that's not supported.
I agree it's off topic so let's leave it be. Thanks for the info and the pointers btw.
we've consistently told people who have tried to do this and had problems that it's not allowed
Just to add to this, about _why_ we did this.
Users regularly complained about how their script/tool (that reached into pip's internals for something) doesn't work now because pip made an internal change and it was a constant drain on the volunteered development resources we have.
(if you search "not supported" in closed issues on this repo, you'll get a _long_ list of closed issues where it has been stated. Open one and you'll likely to get an idea of how those discussions go.)
I personally feel this move makes it easier for all parties involved in the longer term.
pip install -U setuptools -I
Traceback (most recent call last):
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 291, in run
resolver.resolve(requirement_set)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 103, in resolve
self._resolve_one(requirement_set, req)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 257, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
self.require_hashes
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 243, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/req/req_install.py", line 307, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/index.py", line 484, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/index.py", line 442, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/index.py", line 587, in _get_pages
page = self._get_page(location)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/index.py", line 705, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/index.py", line 814, in get_page
"Cache-Control": "max-age=600",
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_internal/download.py", line 397, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 640, in send
history = [resp for resp in gen] if allow_redirects else []
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 218, in resolve_redirects
**adapter_kwargs
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 42, in send
cached_response = self.controller.cached_request(request)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py", line 137, in cached_request
resp = self.serializer.loads(request, cache_data)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 98, in loads
return getattr(self, "_loads_v{0}".format(ver))(request, data)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 190, in _loads_v4
cached = msgpack.loads(data, encoding='utf-8')
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/msgpack/fallback.py", line 121, in unpackb
ret = unpacker._unpack()
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/msgpack/fallback.py", line 600, in _unpack
ret[key] = self._unpack(EX_CONSTRUCT)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/msgpack/fallback.py", line 600, in _unpack
ret[key] = self._unpack(EX_CONSTRUCT)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/msgpack/fallback.py", line 560, in _unpack
typ, n, obj = self._read_header(execute)
File "/home/lipkin/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/msgpack/fallback.py", line 391, in _read_header
n = struct.unpack_from(">H", self._buffer, self._buff_i)[0]
TypeError: unpack_from() argument 1 must be string or read-only buffer, not bytearray
More than that, $ pip install pip==9.0.3 -I
also fails with same error.
pip appears to throw this TypeError while loading a cached dependency from its cache directory.
Adding "--no-cache-dir" to the pip command line options avoided the bug for me.
@ajdavis Thanks, pip install --no-cache-dir pip==9.0.3
worked for me on Ubuntu 12.04.
Using --no-cache-dir is just a work around to it , just clean ~/.cache/pip/ things should work
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.
Most helpful comment
@ajdavis Thanks,
pip install --no-cache-dir pip==9.0.3
worked for me on Ubuntu 12.04.