Yesterday I started on a new raspberry pi project, and as usual, I burned a fresh version of the latest Raspbian Jessie to my SD card. I usually do this so that when I write up some instructions I know absolutely everything I’ve installed from the start. However, I couldn’t seem to install anything using apt-get (getting all 404 errors), and then having tried to install something thru python-pip I got this error:

Downloading/unpacking PACKAGE NAME
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement PACKAGE NAME
No distributions at all found for git-review Storing complete log in /home/USERNAME/.pip/pip.log

Very irritating, since I knew the package existed in PyPi. I googled the error message and tried looking at all the dependencies, spent hours trying to find a work around, but I’d never come across this issue on a brand new installation before.

Finally, I found a solution, mostly due to my own stupidity… for whatever reason, I had not set the timezone and the time had not automatically updated (not sure – possibly a problem connecting to the ntp time server which it should do automatically). This caused errors when updating software, I think because when downloading packages from pypi and Raspbian sources (apt-get) it does it over HTTPS, and security certificates somehow require the time to be checked to make sure they are upto date, and this is what was causing the errors.

So – whenever you start a new project with Raspbian it’s best to make sure you locale / timezone is set and the time and date are correct!

sudo raspi-config # opens the graphical config menu, then; Select Internationalisation Options; Select I2 Change Timezone; elect your Geographical Area; Select your nearest City; Select Finish; Select Yes to reboot now
date # view the current date/time
sudo date -s "2016-09-18 08:58:00" # set the current date time