Ask Your Question
1

Cannot allocate memory?

asked 2014-12-10 08:47:19 +0200

Dan-Erik gravatar image

updated 2014-12-10 14:06:48 +0200

I use the sagemath package distributed with Ubuntu. Recently, it was automatically suggested that I update this package, which I did. After that I have had a lot of problems.

I use sage almost exclusively as an R interface. All my problems are with R. After the upgrade, I will frequently get a message like "R Interpreter crashed -- automatically restarting." - except that it never restarts automatically I have to manually restart the entire sage notebook server.

I have also had several messages like R cannot allocate 125 MB memory for an array... Where I have 4 GB RAM so it shouldn't be a problem at all and I could run this code before the upgrade without problem. Just now, I tried to run install.packages() but got the error " system call failed: Cannot allocate memory". This is for a 28 kB package, so I should be able to run it on an old 286 computer for christs sake.

1) Does anyone have any suggestions on how to solve these memory limitations?

2) Alternatively, how can I "downgrade" and get my previous version of sage back? Because in my previous version I had no problems at all.

EDIT: Ubuntu version from /etc/issue = Ubuntu 14.04.1 LTS

Package: sagemath-upstream-binary
Priority: extra
Section: math
Installed-Size: 3102314
Maintainer: Jan Groenewald <jan@aims.ac.za>
Architecture: amd64
Version: 6.4.1
Recommends: openssl, build-essential, gfortran, imagemagick, dvipng, texlive, texlive-pictures, icedtea-plugin, bash, python
Suggests: m4, openssh-client, git
Depends: libc6, libexpat1, libfontconfig1, libgcc1, libssl1.0.0, libstdc++6, libgfortran3, libgomp1, libquadmath0
Pre-Depends: dpkg (>= 1.15.6~)
Filename: pool/main/s/sagemath-upstream-binary/sagemath-upstream-binary_6.4.1_amd64.deb
Size: 483102424
MD5sum: 26845d5ae2d46f2f2687693fd7819a7e
SHA1: f06b711ffd514d5d9738925d50bca212f8241f80
SHA256: 6c34bc35af4f7a0c166b3bf9bbe9c68ecfd1f5a2f7b71523abb79a9326ca40be
Description-en: Sage is a free open-source mathematics software system
 Sage is a free open-source mathematics software system licensed under the GPL. It combines the power of many existing open-source packages into a common Python-based interface.
 Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.
 .
 This package is a wrapper around an upstream pre-built binary for Ubuntu 14.04.
Description-md5: 0a4e6e212377f9056703508d29d73269

Example code that produces memory allocation error for me:

# Important notice:
# When running this through Sage, have to divide the code into 3 or more cells, because R interface
# will only accept short code snippets.
# Error will then appear in either first or last cell (creating data frames OR plotting data)

library(ggplot2)
library(gridExtra)
xvar <- c(rnorm(15000000, mean = -1), rnorm(15000000, mean = 1.5))
yvar <- c(rnorm(15000000, mean = 1), rnorm(15000000, mean = 1.5))
zvar <- as.factor(c(rep(1, 15000000), rep(2, 15000000)))
xy <- data.frame(xvar, yvar, zvar)
#placeholder plot - prints nothing at all
empty <- ggplot()+geom_point(aes(1,1), colour="white") +
     theme(                              
       plot.background = element_blank(), 
       panel.grid.major = element_blank(), 
       panel.grid.minor = element_blank(), 
       panel.border = element_blank(), 
       panel.background = element_blank(),
       axis.title.x = element_blank(),
       axis.title.y = element_blank(),
       axis.text.x = element_blank(),
       axis.text.y = element_blank(),
       axis.ticks = element_blank()
     )
#scatterplot of x and y variables
scatter <- ggplot(xy,aes(xvar, yvar ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-12-10 10:46:48 +0200

pipedream gravatar image

updated 2014-12-10 10:51:03 +0200

vdelecroix gravatar image

Hi

Thank you for reporting this.

I maintain the PPA. PPAs do not keep older versions like the Ubuntu archives. I can rebuild 6.2, but let's first try to fix the problem. I am unable to reproduce this in any of the following

notebook: %r, 1+1;
notebook: evaluate as r, 1+1;
bash prompt: sage --r: 1+1;
sage prompt: %r, 1+1;
sage prompt: %r, install.packages("test");

If you have an immediate need, all I can see is this old source: http://sagemath.org/src-old/sage-6.1.... which you will have to compile.

edit flag offensive delete link more

Comments

1

Also in the meantime consider rstudio as a frontend to R.

sudo apt-add-repository -y ppa:aims/aims-desktop sudo apt-get update sudo apt-get -y install rstudio-upstream-deb

pipedream gravatar imagepipedream ( 2014-12-10 11:40:25 +0200 )edit

In your reproduction attempt you are only trying 1+1. I have no problems running simple code snippets. What causes problems is for example generating a ggplot from a large dataset. I don't know the lower limits, but what definitely doesn't work is a density plot of 16 million row dataset in 3 columns. Many things more simple than this will work fine. (EDIT: For clarification, I did get the error message for the 28 kB package, but after a couple of reboots of sage I have now managed to install it, so I'm not sure where the limit is, if it's something like total allocated memory rather than just memory for a specific operation).

Dan-Erik gravatar imageDan-Erik ( 2014-12-10 13:40:22 +0200 )edit

Uh... Sorry, I'm starting to be a bit unsure about this. I mean, I use many different programs and R is the only thing so far that has displayed any errors. But I thought I would try the rstudio you recommended, and during installation it gives the same error: failed to allocate memory. Not sure what it means, but maybe something else went wrong in my last package upgrade... Still, this is also R-related software, so the problems are entirely focused around R.

Dan-Erik gravatar imageDan-Erik ( 2014-12-10 14:48:17 +0200 )edit

If RStudio is causing problems, assuming that you are not using the R binary in Sage with RStudio (I don't know if that's even supported), then I think we can safely conclude it's not a Sage problem per se. Maybe there is some global R config thing your machine altered for you?

kcrisman gravatar imagekcrisman ( 2014-12-10 14:54:41 +0200 )edit
0

answered 2014-12-10 09:09:48 +0200

vdelecroix gravatar image

updated 2014-12-10 10:24:34 +0200

Hello,

Could you modify your question adding a bit more information that would help the package manager:

  1. your precise ubuntu version (it is in the file /etc/issue)

  2. the version of the broken sagemath package you use. It can be obtained from the console with

    apt-cache show NAME_OF_THE_PACKAGE
    

    and possibly the sage version that it corresponds, in a console:

    sage --version
    
  3. if you know it, the previous package you used for sagemath. In that case, you can downgrade the package with

    sudo apt-get install NAME_OF_THE_PACKAGE=VERSION
    
  4. which commands did you do in R/sage in order to get these errors.

I opened a thread on sage-devel for this issue.

Thanks Vincent

edit flag offensive delete link more

Comments

I have updated the original post as per your instructions as far as I could. My example may be a bit lengthy, but it is the thing I know will produce an error with some certainty. I have run smaller snippets of code, but it seems sometimes it works and sometimes it doesn't.

Dan-Erik gravatar imageDan-Erik ( 2014-12-10 14:08:29 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-12-10 08:47:19 +0200

Seen: 2,951 times

Last updated: Dec 10 '14