Octave Statistics not loading

Re: Octave Statistics not loading

by Richard Lobb -
Number of replies: 1

Jobe starts Octave with a command of the form

octave --version --norc --no-window-system --silent -H prog.m

The --norc will prevent autoloading of packages. I don't remember all the details, but I don't think you can remove that option as the task is running as user Jobe, who for security reasons has no home directory.

I installed the statistics package on my development server and was able to submit an Octave answer that began

pkg load statistics

So can you not just clone the octave_function question prototype (or whatever prototype you're using) and edit it so it begins

pkg load statistics
{{ STUDENT_ANSWER }}

?

You could call your new question type octave_stats or some such. 

That has the slight disadvantage that error line numbers seen by the students will be out by one but students soon learn not to trust error line numbers anyway.


In reply to Richard Lobb

Re: Octave Statistics not loading

by Rea Sutter -

Hi Richard,

I'm working with Christoph to solve that statistics problem.

Your hint about removing --norc was one part of the solution, and an important one. Let me detail here how I got statistics to load automatically in CodeRunner, just in case someone else is looking for this:

  • in the file octave_task.php (in /var/www/html/jobe/applications/libraries/), remove both instances of --norc. It is used in lines 19 and 27.
  • in /etc/octave.conf add the line
    pkg ("load", "statistics"); just before atexit ("__finish__"); (this is the file that is linked from .octaverc)
  • Now statistics loads, but the following warning is shown (which is why answers evaluate as wrong): function /usr/share/octave/packages/statistics-1.4.0/distributions/binopdf.m shadows a core library function
    to get rid of this warning, I renamed the file binopdf.m at the given path to binopdf1.m
I will do some more research to find out whether it makes any difference which of the functions is disabled - the one in core or the one in the statistics package. But it's finally working now! :-)

Are you sure, Richard, that removing the --norc is safe?

Anyway, thank you for your help!