Trying to upgrade Django using pip on CentOS results in segmentation fault

82 views
Skip to first unread message

Tanuka Dutta

unread,
Feb 17, 2016, 6:50:36 AM2/17/16
to Django users

Hello,

I have a Linux CentOS 6.7 installation on a VM. A few months ago, I had - compiled and installed Python 2.7.8 on it - installed virtualenv-13.1.2 in /usr/lib/python2.7/site-packages - installed Django 1.7 inside the virtualenv. - compiled and installed mod_wsgi 4.4.21 and used it to deploy Django on Apache

I have been using this over the last few months with no issues.

I am now trying to upgrade to Django 1.8.8. I activated the virtualenv and then executed the following command, but it encounters a segmentation fault each time.

$pip2.7 install --upgrade django==1.8.8

Collecting django==1.8.8

/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/sitepackages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading Django-1.8.8-py2.py3-none-any.whl (6.2MB)
99% |############################### | 6.2MB 9.1MB/s eta 0:00:01Segmentation fault

If I preface the command with sudo, there is no segmentation fault, but it does not proceed to install the new version of Django at all.

Output of verbose option given below 

pip2.7 install --upgrade django==1.8.8 -v

Collecting django==1.8.8
Getting page https://pypi.python.org/simple/django/
Starting new HTTPS connection (1): pypi.python.org
/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-    packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
"GET /simple/django/ HTTP/1.1" 200 3985
1 location(s) to search for versions of django:
* https://pypi.python.org/simple/django/
Getting page https://pypi.python.org/simple/django/
"GET /simple/django/ HTTP/1.1" 200 3985
Analyzing links from page https://pypi.python.org/simple/django/
Found link https://pypi.python.org/packages/any/D/Django/Django-1.5.2-py2.py3-none-any.whl#md5=07f0d2d42162945d0ad031fc9737847d (from https://pypi.python.org/simple/django/), version: 1.5.2
Found link https://pypi.python.org/packages/any/D/Django/Django-1.5.8-py2.py3-none-any.whl#md5=1e3418bd1d6f9725a3d1264c9352f2a1 (from https://pypi.python.org/simple/django/), version: 1.5.8
Found link https://pypi.python.org/packages/any/D/Django/Django-1.6.1-py2.py3-none-any.whl#md5=c7b7a4437b36400f1c23953e9700fd29 (from https://pypi.python.org/simple/django/), version: 1.6.1
Found link https://pypi.python.org/packages/any/D/Django/Django-1.6.2-py2.py3-none-any.whl#md5=3bd014923e85df771b34d12c0ab3c9e1 (from https://pypi.python.org/simple/django/), version: 1.6.2
Found link https://pypi.python.org/packages/any/D/Django/Django-1.6.5-py2.py3-none-any.whl#md5=2bcdb4729f9f358b0925b532eef0a8ff (from https://pypi.python.org/simple/django/), version: 1.6.5
..................................
Found link https://pypi.python.org/packages/source/D/Django/Django-1.8.8.tar.gz#md5=08ecf83b7e9d064ed7e3981ddc3a8a15 (from https://pypi.python.org/simple/django/), version: 1.8.8
Found link https://pypi.python.org/packages/source/D/Django/Django-1.8.9.tar.gz#md5=49f6863b1c83825fb2f473c141c28e15 (from https://pypi.python.org/simple/django/), version: 1.8.9
Found link https://pypi.python.org/packages/source/D/Django/Django-1.8.tar.gz#md5=9a811faf67ca0f3e0d43e670a1cc503d (from https://pypi.python.org/simple/django/), version: 1.8
Found link https://pypi.python.org/packages/source/D/Django/Django-1.9.1.tar.gz#md5=02754aa2d5c9c171dfc3f9422b20e12c (from https://pypi.python.org/simple/django/), version: 1.9.1
Found link https://pypi.python.org/packages/source/D/Django/Django-1.9.2.tar.gz#md5=ee90280973d435a1a6aa01b453b50cd1 (from https://pypi.python.org/simple/django/), version: 1.9.2
Found link https://pypi.python.org/packages/source/D/Django/Django-1.9.tar.gz#md5=110389cf89196334182295165852e082 (from https://pypi.python.org/simple/django/), version: 1.9
Found link https://pypi.python.org/packages/source/D/Django/Django-1.9rc1.tar.gz#md5=b971686521ea09b4bf82aec3e794fcbc (from https://pypi.python.org/simple/django/), version: 1.9rc1
Using version 1.8.8 (newest of versions: 1.8.8, 1.8.8)
"GET /packages/py2.py3/D/Django/Django-1.8.8-py2.py3-none-any.whl HTTP/1.1" 200 6170205
Downloading Django-1.8.8-py2.py3-none-any.whl (6.2MB)
Downloading from URL https://pypi.python.org/packages/py2.py3/D/Django/Django-1.8.8-py2.py3-none-any.whl#md5=97334c82efbac0f93f8b6dd4ee4b516f (from https://pypi.python.org/simple/django/)
99% |############################### | 6.2MB 4.8MB/s eta 0:00:01Segmentation fault

I get the same result if I try to upgrade to version 1.7.11 (tried that to see if there is any incompatibility between Python 2.7.8 and Django 1.8.x)

Other packages that are currently installed on the VM are:

django-crispy-forms==1.4.0
djangorestframework==3.1.3
mysql-python==1.2.5
six==1.9.0
Pillow==2.6.1
django-simple-captcha==0.5.1

Any ideas what might be going wrong?

Regards,

Tanuka

Mike Dewhirst

unread,
Feb 17, 2016, 6:59:02 AM2/17/16
to django...@googlegroups.com
  • Try sto

Connected by Motorola
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/df018aaa-aaaa-4275-a06c-1717d8c1d619%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Dewhirst

unread,
Feb 17, 2016, 7:00:49 AM2/17/16
to django...@googlegroups.com
Try stopping Apache during the upgrade. I need to do that on Ubuntu.

Good luck

Connected by Motorola

Bill Freeman

unread,
Feb 17, 2016, 11:39:03 AM2/17/16
to django-users
Or clone into a new virtualenv (you are using virtualenv, aren't you, and you are using requires.txt and pip, and your code is in revision control, right?), then change the Apache configuration to use the new VE and restart.

Tanuka Dutta

unread,
Feb 17, 2016, 10:20:14 PM2/17/16
to Django users
Thanks for the suggestions. I had stopped Apache, and I also tried a fresh install in a new virtualenv. 

That actually helped me discover the root cause of the problem because I got a different traceback during a fresh install. Pasting it here in case others run into the same problem someday:

(syt_env)[syt_admin@VM1 vishwaas]$pip2.7 install -r requirements/production.txt

Collecting Django==1.8.8 (from -r requirements/base.txt (line 1))
Exception:
Traceback (most recent call last):
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
    status = self.run(options, args)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/commands/install.py", line 305, in run
    wb.build(autobuilding=True)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/wheel.py", line 705, in build
    self.requirement_set.prepare_files(self.finder)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/req/req_set.py", line 334, in prepare_files
    functools.partial(self._prepare_file, finder))
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/req/req_set.py", line 321, in _walk_req_to_install
    more_reqs = handler(req_to_install)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/req/req_set.py", line 461, in _prepare_file
    req_to_install.populate_link(finder, self.upgrade)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/req/req_install.py", line 250, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py", line 486, in find_requirement
    all_versions = self._find_all_versions(req.name)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py", line 404, in _find_all_versions
    index_locations = self._get_index_urls_locations(project_name)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py", line 378, in _get_index_urls_locations
    page = self._get_page(main_index_url)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py", line 818, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/index.py", line 928, in get_page
    "Cache-Control": "max-age=600",
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 477, in get
    return self.request('GET', url, **kwargs)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/download.py", line 373, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 36, in send
    cached_response = self.controller.cached_request(request)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py", line 102, in cached_request
    resp = self.serializer.loads(request, self.cache.get(cache_url))
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 108, in loads
    return getattr(self, "_loads_v{0}".format(ver))(request, data)
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 170, in _loads_v2
    cached["response"]["body"]
  File "/home/syt_admin/.virtualenvs/vishwaas_env/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 20, in _b64_decode_bytes
    return base64.b64decode(b.encode("ascii"))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2662: ordinal not in range(128)



It turned out to be a known issue with pip version 7.1.2. I need to upgrade to the latest pip version 8.0.2


Meanwhile, the workaround is to use the option --no-cache-dir

(syt_env)[syt_admin@VM1 vishwaas]$ pip2.7 install -r requirements/production.txt  --no-cache-dir

This worked fine, and I was able to upgrade the packages in my old virtualenv as well as do a fresh install in the new one.

Whew!!

Regards,
Tanuka

...
Reply all
Reply to author
Forward
0 new messages