Clear Language, Clear Mind

November 28, 2016

Installing the latest version of R on Ubuntu/Mint

Filed under: Programming — Tags: , , , , — Emil O. W. Kirkegaard @ 17:56

I wrote about this before, but since this is a frequent problem and my last post wasn’t brief, here’s a shorter version.

cautionary

The primary way to install software in Linux is to rely on apt-get (apt in Mint) or some other package manager. The way this works is that there is a central server which holds a list of all the software available for that version of Linux you installed. The problem is that your installed version of Linux is based on an older list of this software and thus when you try to update, it says there isn’t any newer version available when there actually is.

To solve this, you have to add more lists of software so Linux knows where to look for the newer versions of the software. For R, there’s a list of mirrors here and all you have to do is edit the /etc/apt/sources.list file to include something like this:

deb http://cloud.r-project.org/bin/linux/ubuntu xenial/

The name at the end corresponds to your Ubuntu version. You can look here to find which name to use. It’s always the first word in the name. The first part is one of the CRAN mirrors of which there is a list.

After this you update the list of software by:

apt-get update

This may work, or it may not (bug fixing in Linux is inherently stochastic). If you get an error like this:

W: GPG error: http://cloud.r-project.org/bin/linux/ubuntu xenial/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
E: The repository 'http://cloud.r-project.org/bin/linux/ubuntu xenial/ InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Then run this:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9

Notice the number as the end. You must copy the one from the error message. When you run the above, you should get something like:

Executing: /tmp/tmp.nyQRPoVeus/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
51716619E084DAB9
gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: public key "Michael Rutter <marutter@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

If so, then you’re good to go. Then you update the list of software and update R:

apt-get update
apt-get install r-base r-base-dev

 

July 7, 2015

Getting free wifi forever in airports on Mint 17.1

Filed under: Computer science — Tags: , , , , , , , — Emil O. W. Kirkegaard @ 13:44

Many airports have free wifi services. The problem with these is that they are time-limited, usually to 1 to 3 hours. This can be very annoying if one is stuck in an airport for an extended period, as I am right now.

Non-technical solution

If you have spent your time on one device, you can simply switch to a new one. If you have brought a smartphone, tablet and a laptop, you can use the time on each of these.

This solution may be sufficient in some situations.

Technical solution

The wifi services rely on your computers MAC address to identity you. They keep track of these and so when you have used all the time on a given MAC, it will be temporarily blocked from using the internet again.

The solution is simple: we kill the batman we switch to a new MAC address every time one has expired. How do we do this? The built in network controller can change the MAC address, but this did not work for me. Instead I downloaded macchanger using:

sudo apt-get install macchanger

This is a small program that lets you easily change MAC addresses. I found a ton of guides, but they did not fully work.

Here’s my current routine.

  1. Disable the wifi using by clicking turn off in the dock-menu.
  2. Delete the previous connection to the network.
  3. Open a terminal as root.
  4. Type:
    macchanger -s wlan0

    to show the current MAC address.

  5. Type:
    macchanger -a wlan0

    to get a new similar MAC address.

  6. Re-do step (4) to see that it worked.
  7. Turn on wifi.
  8. Connect to the network.
  9. Enjoy internet for as long as it lasts, start over from step (1).

I’m not sure if everything here is strictly necessary, but this works for me.

May 12, 2015

Installing an RStudio server on DigitalOcean

Filed under: Programming — Tags: , , , , — Emil O. W. Kirkegaard @ 23:01

Not as easy as claimed, but not that difficult. I used the default values and stuff with Ubuntu like in the guide.

Some difficulties:

Had to learn SSH

Just read this.

No email was sent with password

Apparently, this is not done when using SSH, see above guide.

Don’t skip making a second user

If you do, you can’t log into RStudio server later.

Devtools package won’t install

It has various dependencies in the unix. Run these:

sudo apt-get update
sudo apt-get install libxml2-dev
sudo apt-get install libssl-dev

Then it worked for me. For now.

You installed stuff but the server won’t actually show the Shiny apps

Some stuff needs to be installed more than once. You will need to type these:

sudo su - \ -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
sudo su - \ -c "R -e \"install.packages('rmarkdown', repos='http://cran.rstudio.com/')\""

Which made it work for me. No restarts necessary.

November 21, 2014

Installing scrapy on Mint 17

Filed under: Uncategorized — Tags: , , — Emil O. W. Kirkegaard @ 19:09

One would think that after so many years, things would simply work on linux. Especially on mainstream platforms. Mint 17 is based on the last Ubuntu LTS version (Trustly Tahr).

For the uninitiated linux can seem difficult with all the terminal commands. But actually install guides make things seem a lot easier than they really are. Case in point, the scrapy site simply lists the command:

pip install scrapy

Very easy right? Well, assuming you already managed to install pip in the first place.

In any case, finding the exact error is not easy. One needs some intuition of where to look for it in the huge log files, and then Google the right error message so one can find the relevant information in the hive-mind (typically stackexchange).

libxml2 and libxslt

Buried in the 1000 line log file was an error concerning these:

ERROR: /bin/sh: 1: xslt-config: not found
** make sure the development packages of libxml2 and libxslt are installed **

Seems to be solvable by installing these.

sudo apt-get install libxml2-dev

sudo apt-get install libxslt1-dev

libffi

Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘libffi’ found

This was repeated many times. The command to fix is: sudo apt-get install libffi-dev

/usr/bin/ld: cannot find -lz

Found solution here.

sudo apt-get install -y zlib1g-dev

This error happened when trying to install lxml with pip.

OpenSSL error

One error was:

cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_36a40ff0x2bad1bae.c:194:25: fatal error: openssl/aes.h: No such file or directory

Which is discussed here. Solution: sudo apt-get install libssl-dev

And the rest

The above may not be sufficient. I ran lots of other commands which I have now forgotten. Perhaps some of them made a difference too. Perhaps not.

November 18, 2014

Installing R on Mint 17

Filed under: Uncategorized — Tags: , , — Emil O. W. Kirkegaard @ 18:47

As nearly always, when one wants to do something in Linux, it becomes a test of both intelligence and patience. Mostly the latter.

In this case I had installed the newest Mint on my new laptop, Mint 17. Then I set out to install R. Since this language’s name is but a single letter, it is not so easy to search for solutions. The first question is what the linux program is called. r-base, it turns out. However, to install it, one needs to add the CRAN mirror to the repository list (sources.list file in etc/apt/). But their website is not very helpful because they don’t give any examples, just write “http://<my.favorite.cran.mirror>/bin/linux/ubuntu utopic/”. And if one chooses the CRAN mirror in DK, the URL is “http://mirrors.dotsrc.org/cran/”. However, adding “http://mirrors.dotsrc.org/cran/bin/linux/ubuntu utopic/” does not work. Apparently, one has to know that one must remove the “/cran” part of the URL first. In any case, I ended up using “deb http://cran.at.r-project.org/bin/linux/ubuntu utopic/” which works except that it gives errors about the lack of a public key (apparently not important).

Then it’s a matter of trying sudo apt-get install r-base, but no no. There are various dependencies missing. In particular, libgomp1 was in some 4.8x version, while the required version was 4.9x. So, to Synaptics I go. But according to Synaptics, I already have the latest version!

Ok, so Synaptics itself must be outdated. So I updated the source lists (sudo apt-get update) but that didn’t help either. Then I tried downloading and installing libgomp1 manually, but that just required some more dependencies…

So, next idea was to update the repositories that Linux uses. Apparently, Mint 17 is based on Ubuntu 14.04 (Trusty Tahr). The question was just where one gets the URLs of these. After spending perhaps an hour trying some of the wrong ones, I finally found this page where one can generate sources.list code for Ubuntu that are updated! So I ended up with:

#deb cdrom:[Linux Mint 17 _Qiana_ – Release amd64 20140624]/ trusty contrib main non-free
deb http://cran.at.r-project.org/bin/linux/ubuntu utopic/

###### Ubuntu Main Repos
deb http://dk.archive.ubuntu.com/ubuntu/ utopic main restricted universe
deb-src http://dk.archive.ubuntu.com/ubuntu/ utopic main restricted universe

###### Ubuntu Update Repos
deb http://dk.archive.ubuntu.com/ubuntu/ utopic-security main restricted universe
deb http://dk.archive.ubuntu.com/ubuntu/ utopic-updates main restricted universe
deb-src http://dk.archive.ubuntu.com/ubuntu/ utopic-security main restricted universe
deb-src http://dk.archive.ubuntu.com/ubuntu/ utopic-updates main restricted universe

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu utopic partner
deb-src http://archive.canonical.com/ubuntu utopic partner

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu utopic main
deb-src http://extras.ubuntu.com/ubuntu utopic main

Which worked. After running update, I could then use Synaptics to install r-base with the dependencies. Hurray!

August 16, 2014

So i tried linux again

Filed under: Uncategorized — Tags: , — Emil O. W. Kirkegaard @ 05:33

Usually every few years i try linux just to see how it has improved since last time i tried it. So far i have not migrated permanently to linux on my desktop. Simply, windows (7) is better for my purposes.

Whenever i try linux, i picked the most popular distro. This time it was Mint. Overview here. The reason to pick the most mainstream one is that it is the one likely to have the best driver support, least number of problems, most features, easiest support for programs and so on. Basically, im picking the best linux distro to compare with windows.

The first problem after installing was that i cud not make fully use of my dual screen setup. In windows i use the program UltraMon so that i can have a taskbar on the second screen as well. Very useful when one has lots of programs open. After googling it, this feature is apparently not avaiable in the default Cinnamon desktop. It’s been an open issue for 2 years.

So the solution was to install some other desktop environment. A few people mentioned that this cud be done in KDE. So then i tried installing KDE thru the standard Software Manager. However, it only worked halfway or so. Asking my linux expert roommate, he told me that SM is dumb and doesn’t install necesssary dependencies. Why would anyone make the default program so stupid? Anyway, i then did it with Synaptics (another Software Manager-ish program, also built in). I loaded over to KDE and it was possible to get a working taskbar on the second screen, altho not intuitive and kinda complicated (so complicated one needs a guide even if one is considered a computer expert). Hurray!

So, the next annoyance was to change date format and stuff, especially getting KDE to display a 24h system clock was difficult. But again with guides i managed it.

Then there was the very annoying thing that KDE opens stuff with 1 click instead of 2 clicks. This was easily solvable tho.

A larger pain is that linux still does not have a proper winamp alternative. None of the alternatives i have tried (>10) have a specific feature of library indexing that winamp has. If one has a huge library full of compilations, one will automatically have thousands of artists, most of them with only 1 or 2 tracks. All the other programs offer only alfabetic sorting of artist names. This is useless. What is needed is sorting by number of tracks by that artist, which winamp has. One cud run winamp thru Wine but it is silly that this feature is still missing after so many years.

There is ofc also the usual issue with gaming. Few games work well on linux. DOTA2 runs with unplayable 15-30 fps on linux. Using the same settings it runs with 60 on windows. Not strictly linux’s fault, but due to microsoft monopoly with directx, it is still a problem.

Another issue was that there were no useful hotkeys by default in KDE. No hotkey for minizing all windows. No hotkey for opening the applications launcer (start menu equivalent). Worse, one cud not set the WIN key for this purpose in KDE since it’s apparently purely a modifer (dead) key. In windows and Cinnamon, the WIN key is treated specially in that it can both be a modifier and a key in itself. Fortunately, there was a hack to fix this problem.

What linux needs

For linux to become decent for mainstream use, there are some obvious requirements. First one, it must never be necesssary for normal users to use the terminal or any other non-GUI app to do anything. Everything must be GUI. Linux is clearly not ready.

Some good things

Some good things i noticed. Booting is much faster. The system is lighter, especially important for my shitty laptop (which still runs linux and will continue to do so). Important working programs like R and LATEX works mostly fine. In general, Cinnamon is good. They really have to fix that obvious problem with using dual monitors effectively.

Powered by WordPress