Cannot install Speaker pHAT because it needs HTTPS


#1

While trying to run curl -sS https://get.pimoroni.com/speakerphat | bash as per https://github.com/pimoroni/speaker-phat I get errors and I’ve pasted the log file below.

What do I need to do to get this script or perhaps pip to use HTTPS?

I can’t update pip for probably the same reason, and I can’t find its config file.


pi@zero ~ $ pip --version
pip 1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Downloading/unpacking sn3218

  Getting page http://pypi.python.org/simple/sn3218
  Could not fetch URL http://pypi.python.org/simple/sn3218: HTTP Error 403: SSL is required
  Will skip URL http://pypi.python.org/simple/sn3218 when looking for download links for sn3218
  Getting page http://pypi.python.org/simple/
  Could not fetch URL http://pypi.python.org/simple/: HTTP Error 403: SSL is required
  Will skip URL http://pypi.python.org/simple/ when looking for download links for sn3218
  Cannot fetch index base URL http://pypi.python.org/simple/

  URLs to search for versions for sn3218:
  * http://pypi.python.org/simple/sn3218/
  Getting page http://pypi.python.org/simple/sn3218/
  Could not fetch URL http://pypi.python.org/simple/sn3218/: HTTP Error 403: SSL is required
  Will skip URL http://pypi.python.org/simple/sn3218/ when looking for download links for sn3218
  Could not find any downloads that satisfy the requirement sn3218

No distributions at all found for sn3218

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 245, 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 978, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 157, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for sn3218

I


#2

I am confused - according to the log you posted you ran the ‘pip’ command and not the curl command that was the suggested action.


#3

The first command fetches and runs a script which contain pip calls.


#4

Presumably your pip install is broken or reconfigured, or something else is undermining the SSL connections. What version of Raspbian are you running?


#5

It appears that it’s not trying to use https, and so the redirect response from the server is causing it to fail.


#6

See: https://github.com/pypa/pip/issues/4817


#7

Thanks.
I ended up with the following, which probably shouldn’t be trusted as I don’t know what I’m talking about.

sudo pip install --upgrade -v pip -i https://pypi.python.org/simple/ followed by a reboot.

I’ve made no progress.

Can the script be updated to specify the index as per the config suggestion?
Or can someone explain why it continues to use the non-https url?


#8

The script isn’t specifying a particular URL at all, you’re running a version of pip that, perhaps, is not aware of the existence of a secure alternative for that server. I don’t know the exact reason it’s doing what it does, but since it’s incredibly out of date I’d encourage you to solve that problem rather than work around it. For the record, pip 1.1 was released on 16 Feb 2012.

At this point, I’d recommend rolling a new SD card with Raspbian Jessie on it, ideally, since running a distribution that out of date carries with it more risks than just flaky pip installs. I understand you might have installed/configured software that you don’t want to lose though (which is why I recommend a new SD card, so things can be ported over), so…

If you want to proceed without updating you could probably just install the required libraries manually with something like: pip install -v sn3218 -i https://pypi.python.org/simple/

It might also be possible to: pip install --upgrade pip to just upgrade pip itself.


#9

I’ve already successfully updated pip, but it then fails when installing speakerphat for python3.


#10

Python2 and Python3 versions of pip are completely separate, so you may also have to: pip3 install --upgrade pip


#11

hmm, how odd, pip3: command not found apparently!

trying the same for pip2 gets me

/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: 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/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: 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/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages

#12

I think I will have to go the clean install route, but I had such trouble with the new networking config setup, I’m not looking forward to it.