4

I have an install script that I've been using (and I swear it worked before on another Pi), but whatever I've done, it appears I have a broken install of pip, and I'm not sure how to fix it.

I tried several packages (pymodbus, simplejson), and both produce the following errors:

pi@raspberrypi:~ $ sudo pip install pymodbus
Downloading/unpacking pymodbus
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1178, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 194, in find_requirement
    page = self._get_page(main_index_url, req)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_page
    session=self.session,
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 694, in get_page
    req, link, "connection error: %s" % exc, url,
TypeError: __str__ returned non-string (type Error)

I tried reinstalling pip with sudo apt-get install --reinstall python-pip (including purging & autoremove), and tried installing pip using sudo easy_install pip; and tried using pip to upgrade itself (pip install -U pip), but none of these things fixes the problem (and in fact the 3rd one throws the same error).

Does anybody have any ideas for me to try here? I feel like I'm missing something obvious, but can't put my finger on it.

  • Can you ping pypi.python.org? – Ron Beyer Jul 13 '16 at 3:09
  • See also: raspberrypi.stackexchange.com/q/51183/5538 – goldilocks Jul 13 '16 at 12:26
  • @RonBeyer tried pinging pypi, failed: 47 packets transmitted, 0 received, 100%packet loss, time 46003ms (I Ctrl-C closed it). – azazelspeaks Jul 13 '16 at 14:40
  • What Raspbian version are you on, can you do a raspi-config and check what the ssh section says? I have the exact same issue (if pip has to download anything it fails). How do u get connect to the net? Dirty Solution: Installing pkgs from the whl file you download here: pypi.python.org/pypi. Navigate to your download folder and do a $pip install package.whl (or whatever the file is called) You can do this for all your packages in desperation. – azazelspeaks Jul 13 '16 at 14:42
  • I can't ping it, but i can wget it; interestingly, I'm getting: ERROR: The certificate of ‘pypi.python.org’ is not trusted. ERROR: The certificate of ‘pypi.python.org’ is not yet activated. The certificate has not yet been activated So I wonder if the certificate is part of the issue? Also I'm on: Linux raspberrypi 4.1.18-v7+ #846 SMP – jhaagsma Jul 13 '16 at 15:37
2

The problem was that my time was inaccurate. It was in the past a number of months, so none of the SSL certs would verify. The time wasn't updating automatically because I'm behind a firewall which is blocking NTP packets.

Answer is, check to see if your time is set correctly! And if not, set it correctly! (If you're having the same issue as me, try using tlsdate).

  • Just tried. Changing the system time fixed this issue. Thanks.. – Nitesh Glass Aug 23 '16 at 14:49
0

Check your system date and time, if it is not correct to your local current time and date, then change manually by sudo date -s "Mon Aug 12 20:14:11 UTC 2014", please not change with sudo rasp-config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.