EPEL Python 3.6 with pip on CentOS 7

Installing python3 has always been a bit of a pain on CentOS, particularly if you want a functioning pip3 alongside it.

I have experimented with RPMs from SCL and EPEL as well as installing from source, and had settled on installing the Python 3.4 RPM from EPEL as a good compromise of a reasonably recent version, and semi-regular patch updates.

In December 2017 EPEL released Python 3.6 (epel-announce link) but it isn’t obvious how to get it fully set up. Even Stack Overflow let me down. So I’m documenting it here.

For now I am using the following commands – use sudo before each one if you are running as a non-root user.

# Enable EPEL if required
yum install epel-release

# Install Python 3.6
yum install python36

# Install Pip from the RPM's internal "ensurepip" module
python3.6 -m ensurepip

# Create a symlink so it can be called using python3
ln -s /usr/bin/python3.6 /usr/bin/python3

# Symlink pip3 into /usr/bin for consistency and ease of use with sudo
ln -s /usr/local/bin/pip3 /usr/bin/pip3

You should now have functioning python3 and pip3:

$ pip3 install boto3
Collecting boto3
[...]
Successfully installed boto3-1.8.3

$ python3
Python 3.6.5 (default, Jul 25 2018, 21:22:33) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.

The announcement implied that at some point python36 will become the main Python 3 RPM in EPEL. I will try to update this post if/when that happens.

Recording a full DVB/MPEG transport stream on Linux with dvbsnoop

Most cheap USB DVB dongles (both terrestrial DVB-T and satellite DVB-S) pass the whole transport stream to the host computer for pid filtering in software.

This means we can record a whole transport stream to disc for analysis, manipulation and (with a suitable hardware modulator) play it back over an RF feed to a TV or STB.

Googling how to record a whole transport stream on Linux gave a few different options, none of which worked for me. But in the end I discovered that my favourite “DVB swiss army knife” – dvbsnoop – can actually do the job itself.

Prerequisites

You will need to have already tuned with dvbv5-zap (or similar), and that in turn requires you to have run a channel scan with dvbv5-scan. The following commands work for me for tuning to the DVB-T PSB1 mux in the North-West of England.

dvbv5-scan /usr/local/share/dvbv5/dvb-t/uk-WinterHill -o scan_WinterHill.txt
dvbv5-zap -c scan_WinterHill.txt -I DVBV5 "BBC ONE N West" -r

Recording

Once tuned, making a recording is a simple as this:

dvbsnoop -s ts -tsraw -b > psb1.ts

Playing back

The standard hardware and software for playing back transport stream files is produced by Dektec. An example command for playing back PSB1 North-West on Linux is:

DtPlay psb1.ts -r 24100000 -mt DVBT -mf 706 -mc 2/3 -mG 1/32

For DVB-T the parameters are straightforward and generally follow directly from those in the scan file.

For DVB-S the frequency has to be calculated since the LNB down-shifts frequencies for the RF cable as well as selecting the appropriate polarisation. For example, ARD Das Erste SD is currently broadcast from Astra 19.2 at 11836Mhz, however on the RF cable it has been down-shifted by 10600 so needs playing back at 1236Mhz:

DtPlay 11836.ts -r 38000000 -mt DVBS -mf 1236 -mc 3/4

In future post(s) I will hopefully look at analysing and manipulating transport stream files recorded in this way.

Blog now self hosted – same URL

[time passes, it is now 2017…]

I have moved this blog from WordPress.com to self-hosted WordPress running on AWS EC2. This gives me back my own domain for free, removes adverts, and has been a nice opportunity to learn more about AWS and Let’s Encrypt, as well as refreshing my Apache/MySQL knowledge.

The URLs should have stayed the same so old links should still work.

I now post most short comments on Twitter. However some limited blogging may resume on tech/Raspberry Pi, Brompton bikes, trains and politics. Time will tell.

England come from 1-0 down to win 2-1 and stay in the World Cup

What a game… New Zealand got the first goal in, and for a nail-biting 40 minutes it looked like England were on their way home. But at 63 minutes Scott equalised, and 20 minutes later Clarke put us ahead and in the end sent New Zealand home instead. I had to dig out my Lightning Seeds CD to put on Three Lions after the match.

Of course, this isn’t the men’s world cup – it’s the women’s.

But the quality of football is still superb. In Germany it’s big news; the tournament is being held here, and Germany are the world champions.

Unfortunately all the England matches are too far away but we went to the Australia-Brazil match on Wednesday – see picture. It was a great game too and the 1-0 score could easily have been 3-2. We were cheering for Australia but unfortunately Brazil managed to edge ahead.

Good luck to England next week. They’ll need it against Japan, who have played well and won both their games convincingly. A draw would guarantee us a place in the quarter finals against France or Germany. Now that could be quite a game.

Thursday was bad, but could have been worse

Like my Yes to AV balloon, the Lib Dems are in a sorry state. Thursday’s results were extremely poor for the party across the UK, but they could have been worse.

For a start, Dave Hodgson won his re-election as mayor of Bedford for the Lib Dems, and our vote in the Leicester South by-election held up reasonably well.

Nationally, although our 15% vote share was a disappointment, our opinion poll ratings have been a fair bit lower in the last six months.

Locally, although we lost Luddendenfoot ward to the Tories and Calder ward to Labour, we have the same number of Town Councillors as were elected four years ago (8 out of 18).

As various Lib Dems, notably Simon Hughes, have popped up in the media over the last couple of days bemoaning the lack of recognition for our policy successes within the coalition, I am reminded of a speech that Tavish Scott gave to conference a couple of years ago. He thoroughly berated the SNP for being a triumph of spin over substance – I can’t help thinking that our party’s communication skills have been so poor recently that some decent PR people wouldn’t go amiss. After all, look where the SNP have got.

The elections are coming – and here we have 5 votes

A busy day campaigning today, after two days away camping with the Scouts. We have 5 votes here on 5 May (5/5!) – one for Calderdale MBC, three for Hebden Royd TC, and of course the AV referendum.

I was out at 8am delivering the main election address for my local colleague Hywel Morgan, standing for the first time (I think) as a serious candidate after many years experience as a campaigner, most recently in Oldham and Burnley. He also writes regularly for Lib Dem Voice. I was delivering mostly Labour-leaning areas so had a few negative reactions but plenty of people happy to take the leaflets. One chap told me he would never vote for a pro-European party which was a bit of a blast from the past – most people have other reasons for not supporting us these days.

This afternoon I was helping James Baker and Rory Laing run a Yes to AV stall in the centre of Hebden Bridge. Town was full for the duck race so we fielded plenty of queries about the system, and heard from a few people who had already (postally) voted yes. But the novel idea that James had was to get people to have a go by voting for their favourite food using AV. We collected the votes in a mock ballot box and counted them afterwards in the pub. The results were quite interesting – head over to his blog for the breakdown. Political geeks that we are, I think we enjoyed doing the count almost as much as drinking the beer. Oh, and we completely debunked yet another of the No campaign’s myths – that AV is complicated. Several children took part very enthusiastically, and none of them had any difficulties at all in numbering their foods in order of preference.

Late afternoon I did a bit more leafleting in the area which I currently represent on Hebden Royd Town Council. I am stepping down at the election for various reasons (more in a future blog post when I am no longer a councillor) but want to get some colleagues elected to continue the good work that we’ve done in control of the council for the last few years.

Walking home afterwards I was cheered up by some handwritten stickers that someone had stuck on every parking machine that I could see, pointing out that you don’t have to pay on bank holidays, which I thought was rather sweet.

Northern Rail Recycling Revisited

I travelled on Northern Rail trains on several occasions this week, and spotted their latest recycling poster about newspapers, with the quote: “It’s rubbish when you leave it” – meaning you should take your newspaper home and recycle it, rather than leaving it on the train for someone else to read.

This reminded me about my previous post about their last poster on this theme, which I disagree with. They claim that leaving newspapers on trains is littering, while I claim that it saves paper because people pick up newspapers on the train to read rather than picking up another copy of the Metro from the pile at the station. If there were no newspapers on the train because everyone had taken them home (as Northern Rail want) then Metro would have to print a load more copies. That’s hardly very green.

When I contacted Northern Rail about this previously they defended the policy saying they wanted the trains kept clean, however they did let me know that they prefer to collect rubbish from trains and stations and segregate it “off site”, ie. separate it out afterwards. That sounds like a pretty messy job, but I’m glad they’re doing it. Apparently the 2009 figures reveal that 354 tonnes of general waste was removed from trains at the West Yorkshire depot of which 265 tonnes was recycled.

But what about stations? Last year they had one paper recycling point on the whole network, pictured. It’s at Manchester Victoria station which I visit regularly – but it’s on a platform inaccessible to the general public as it’s behind a ticket check point. My trains usually arrive at a different platform so I can’t use it.

So the verdict. On train recycling – good but invisible. Station recycling – could do better.

Alan Bennett was right on tuition fees

This week I received a letter telling me that “The Student Loans Company can advise you that the outstanding balance on your Income Contingent Loan(s) should now be repaid in full.”

Recently I have been paying over £100 a month back towards my student loan, and it’s great to have it finally paid off, but it’s taken me until the age of 30 to do so. And I’m one of the lucky ones. I earn above the national average salary, don’t have any dependents and, crucially, my loan was for living expenses only (1999-2002), not tuition fees.

So, my loan was approximately £10k.

Current students will have to pay back approximately £20k (£10k tuition fees plus £10k living expenses).

Under the system proposed by the coalition, graduates may have to pay back around £45k (£35k tuition fees plus £10k living expenses).

How long is this likely to take them? Well it all depends how much you earn and what happens to interest rates. But if it took me that long, it’s going to take the majority of graduates thirty plus years. This is at a time when many of them will be raising families, buying houses, etc.

I’m afraid I simply don’t accept that it’s fair to ask new graduates to pay back this huge amount of money while the rest of us, who were lucky enough to graduate under previous systems, get off scot free.

I appreciate that Nick Clegg and Vince Cable have been trying to make the Browne Report proposals fairer than the Tories would have done. However, they have done a huge disservice to the Liberal Democrats by giving the impression that they support the raise in tuition fees, despite having the abstention opt-out secured in the coalition agreement. This has dealt a massive blow to our credibility. Our policy remains that decided many years ago at conference, and confirmed repeatedly, most recently in the 2010 manifesto. We are against tuition fees as a way of funding higher education and want to phase them out.

Alan Bennett’s comment, made after the Labour Government introduced higher tuition fees in 2003, was right then and remains so now.

“A proper education should be free at the point of entry and the point of exit.”
(Preface to The History Boys, 2004)

Tuition fees – I must be missing something

We are being told that we must increase tuition fees because otherwise there won’t be enough money for higher education.

But even if the increased fees are introduced next year, students starting then won’t graduate for three years. So the income from the increased tuition fees won’t start to appear until September 2014 – and that will only be a trickle. The real money will only start rolling in once those graduates have progressed to big-money jobs, probably well into the 2020s.

So how on earth are we going to be funding higher education for the next decade?

The manifesto should have had a disclaimer

With attacks in the media about Lib Dem U-turns and “going back on our promises”, it seems obvious that we should have had some kind of disclaimer in the manifesto, such as the following.

This manifesto contains policies that will be implemented if a majority Liberal Democrat government is elected following the 2010 general election. In the event of a coalition government in which the Liberal Democrats form a part, then compromises with the other coalition party(ies) will have to be reached, and it will not be possible to deliver every policy exactly as outlined in this document.

People just don’t seem to understand that a coalition government is all about compromise and that if the Tories and Lib Dems promised different things in the respective manifestos, then clearly one or both parties will have to go against what they promised prior to the election.