Scratch on Raspberry Pi (and other Linuxes)

Drop in for a chat and a cup of tea

13 posts
by hilltop » Thu Dec 22, 2011 6:44 pm
I've written an install shell script for the Scratch environment based on the source download tarball available from http://info.scratch.mit.edu

It's available to download from http://pastebin.com/KdsKQFmm - note that the multi-coloured version with line numbers isn't suitable for cut'n'pasting so scroll down to the grey box below.

EDIT: Paste the box contents into an editor, and save as 'scratch-install.sh'. Alternatively, to grab this script directly from within Linux, use


I've tried to make it distro-independent so it will hopefully work on any Pi/Emulator or even other (non-)ARM Linux distribution. Different distros will have different dependencies, check for libglib, libpango, libcairo and libv4l development headers.

Instructions for clean installation (repeated as comments to the script) are as follows for Debian/Ubuntu:
sudo apt-get install build-essential pkg-config squeak-vm
sudo apt-get install libglib2.0-dev libpango1.0-dev libcairo2-dev libv4l-dev
wget http://info.scratch.mit.edu/si.....0.1.tar.gz
tar -zxvf scratch-1.4.0.1.tar.gz # (decompresses to directory 'scratch')
make -C scratch/
sudo bash scratch_install.sh scratch/


Once installed the program appears in the 'Development' menu of your desktop and can be invoked by 'scratch [filename.sb]'

If you've never used Scratch before and are wondering what the fuss is about, or if you're trying to decide whether Python or BASIC would make the best first language to learn, then I strongly recommend installing it as per the instructions above and experimenting. You will have your mind expanded, I guarantee.
Posts: 25
Joined: Sat Dec 17, 2011 5:00 pm
by obarthelemy » Thu Dec 22, 2011 11:16 pm
Thanks ! Worked fine for me.
As a noob, I stumbled on:
1- the final line implies that you copy-pasted the stuff linked in the pastebin to the file scratch_install.sh in your home dir. I thought the stuff in pastebin was to commands in the frame.
2- debian is using alsa, normally.
Posts: 1399
Joined: Tue Aug 09, 2011 10:53 pm
by hilltop » Fri Dec 23, 2011 6:40 pm
Quote from obarthelemy on December 22, 2011, 23:16
1- the final line implies that you copy-pasted the stuff linked in the pastebin to the file scratch_install.sh in your home dir. I thought the stuff in pastebin was to commands in the frame.


Thanks for your feedback, I've altered the script comments and post above to hopefully make this clear.

2- debian is using alsa, normally.


This is probably also true of most 2.6/3.x based distros. Since the example usage is for Debian, I've now gone with ALSA by default. FWIW PulseAudio may be the preferred method if you have installed the prerequisites.

I notice that Debian testing and newer have the binary package squeak-plugins-scratch, but this is of limited usefulness without a (architecture independent) squeak image file/data package. I'll look into altering the script to not require the build part at some point, if the user has already installed squeak-plugins-scratch.
Posts: 25
Joined: Sat Dec 17, 2011 5:00 pm
by Canuck » Sat Dec 24, 2011 7:13 am
I think Scratch is more harmful to learning how programming and computers work then it is beneficial. On paper it seems nice but it actually teaches you absolutely nothing. I think Python is the best way to teach programming to minors, Python is also well supported within the linux community.
Posts: 38
Joined: Sat Dec 24, 2011 7:03 am
by Jessie » Sat Dec 24, 2011 7:28 am
Quote from Canuck on December 24, 2011, 07:13
I think Scratch is more harmful to learning how programming and computers work then it is beneficial. On paper it seems nice but it actually teaches you absolutely nothing. I think Python is the best way to teach programming to minors, Python is also well supported within the linux community.

And if you ask around here there are people that think that everyone should start with assembly.

There is no such thing as a harmful programming language. None, you can't convince me that anyone learns Scratch will be dumber than when they start. The more you pack into your brain the easier it is to remember things due to its relational nature. I have heard this argument so far on the forums about BASIC, Scratch, Python, and even C++, and I don't buy it. This may be an easy sell to a group of super nerds but for the rest of us mortals it dosn't make any sense.

The reason being is that a person either has the type of mind that meshes well with programming, lands somewhere in the middle, or is not capable. You can't tell me that if you sat some grade A programmer out there in front of Scratch for a month that he would become less capable at what he previously knew. Or for that matter a top notch math student wouldn't be harmed by learning a lesser programming language first before moving to something full strength. Different people require different levels of abstraction from the hardware, and some require none. Just like some muscians are better than others, there are different grades of code artisans.
Click my website link under my avitar for the RetroPie 2.3 guide in progress.
User avatar
Forum Moderator
Forum Moderator
Posts: 1604
Joined: Fri Nov 04, 2011 7:40 pm
Location: C/S CO USA
by SeanD » Sat Dec 24, 2011 8:15 am
Quote from Canuck on December 24, 2011, 07:13
I think Scratch is more harmful to learning how programming and computers work then it is beneficial. On paper it seems nice but it actually teaches you absolutely nothing. I think Python is the best way to teach programming to minors, Python is also well supported within the linux community.


This debate an 500 like it have already been had. If it gets a small kid engaged with a computer and makes older ones realize that there is more to them than ICT teaches them then anything including Scratch has a use.
Posts: 121
Joined: Wed Sep 21, 2011 12:25 am
by scep » Sat Dec 24, 2011 9:28 am
Quote from Canuck on December 24, 2011, 07:13
Scratch ... seems nice but it actually teaches you absolutely nothing.
Absolute nonsense.

Scratch was developed specifically for teaching and learning. Computational principles underpin it.

It was created by the MIT Media Lab (yes, the MIT) so I think it's safe to say that they didn't throw it together over the weekend in the hope of making something "nice but crap".

Here are a few papers on the subject.
User avatar
Posts: 1063
Joined: Sun Nov 20, 2011 8:53 am
by hilltop » Thu Dec 29, 2011 6:06 pm
Tip: use the following to grab a working script inside Linux (pastebin seems to give DOS linebreaks), all on one line and omit the space in the URL:

wget -q -O - http://pastebin.com/ download.php?i=KdsKQFmm | tr -d '\15\32' > scratch-install.sh
Posts: 25
Joined: Sat Dec 17, 2011 5:00 pm
by hilltop » Thu Jan 19, 2012 4:56 pm
As noted above the Debian/Ubuntu package squeak-plugins-scratch is available in Wheezy/Precise, and I've updated the script to check for it being installed.  No compilation of the (C) plugins is required if it is present.

Unfortunately I've discovered that the latest squeak-vm package (version 4.4) is not compatible with the Scratch.image program binary (freezes with a blank white screen).  The simplest solution seems to be to downgrade to 4.0 by using the .deb from Squeeze/Natty.  Users of other distros might consider downloading source from squeakvm.org and compiling (g++ and cmake required).

More encouragingly, Scratch appears to work well using the framebuffer outside of X (although if started in less that 1024x768 it again freezes on starting).  If Scratch is going to be included on the default RPi distro (and I would hope that it is) then a framebuffer version can be created with little effort.  The only minor issue to sort out is a rule file in /etc/udev/rules.d/ which gives user permissions on the mouse device (I'd suggest making it group 'video' like the framebuffer /dev/fb0).

Hope that doesn't put people off by being too technical...  Hopefully this outline will save some frustration/wasted time.  Feedback welcome.
Posts: 25
Joined: Sat Dec 17, 2011 5:00 pm
by rbn » Thu Apr 19, 2012 11:48 am
Just installed this OK on RPi runing latest debian package  debian6-13-04-2012

runs OK, but haven't got sound working yet.
Posts: 80
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
by benosteen » Sat Apr 21, 2012 2:23 pm
Working sound is reliant on a working ALSA (or related) driver - there is an alpha-level kernel module for the sound (snd_bcm2835) that you can load, and will work to an extent once you install 'alsa-base'.

However, there are a number of issues with it, and it would be great if people could help out sorting this out:

https://github.com/raspberrypi/linux/tree/rpi-patches/sound/arm
Posts: 28
Joined: Mon Jan 02, 2012 6:10 am
by kdakin » Sat Apr 21, 2012 4:38 pm
Canuck said:


I think Scratch is more harmful to learning how programming and computers work then it is beneficial. On paper it seems nice but it actually teaches you absolutely nothing. I think Python is the best way to teach programming to minors, Python is also well supported within the linux community.


 Kdakin said:


I couldn"t agree LESS with Canuck. I have programmed for more than 40 years and I think SCRATCH is one of the finest things to emerge from IT education for children. It cleverly teaches assignment, iteration and event processing in a very easy to learn way using simple jigsaw like blocks.

I think one of the main hurdles for IT education are OOP languages in general (there are a vast number of terms to comprehend before any sense can be made of OOP and many of them clash with their everyday meanings. Also "hiding things" and making variables less accessible (at least at first) is generally not a sound way to encourage learning and exploration. I learned most about programming by observing how the operating system worked at the assembler level. )

Posts: 54
Joined: Sat Mar 24, 2012 7:20 am
by backsmith » Sun Jun 03, 2012 4:51 pm
Hi

Im trying to instal scratch on my RPi. Its a clean instal of Debian

I ve followed the steps in this post EG

sudo apt-get install build-essential pkg-config squeak-vm
sudo apt-get install libglib2.0-dev libpango1.0-dev libcairo2-dev libv4l-dev
wget http://info.scratch.mit.edu/si.....0.1.tar.gz
tar -zxvf scratch-1.4.0.1.tar.gz # (decompresses to directory 'scratch')
make -C scratch/

This is where it falls over.

I get a whole load of errors starting from
Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing the pangocairo.pc to the PKG_CONFIG_PATH environmet variable.

No package pangocairo found
etc etc etc

Tried installing libpango1 with aptitude, but no help.

I want to try scratch out on the kids. Never used it. I read about it in the MagPi.
Im a novice with linux so any advice apprecited.

Also there are some comments about scratch not working with some other software. Is it possible to get this running?

Thanks

John
Posts: 4
Joined: Sun Jun 03, 2012 3:50 pm