1
votes

I'm getting the following error while trying to install an Octave package:

binary operator '==' not implemented for 'cell' by 'scalar' operations
error: called from
    glob at line 62 column 1
    install at line 60 column 11
    pkg at line 437 column 9

This is happening for several packages- struct and optim for example, whether or not I install from a local download or from Forge.

Note this is happening if I load the Lightspeed library (version 2.8), which replaces the builtin glob function.

1
What is the question? The obvious solution to your problem is to not install the Lightspeed toolkit, or remove it from the path when installing packages. Other than that, file a bug report at the Lightspeed toolkit GitHub page. Though the toolbox is designed for MATLAB, not Octave. - Cris Luengo
@CrisLuengo I agree, but the general principle is that if a 'module' breaks an 'environment', it's the environment's fault and it needs to be fixed. So this is also worth reporting to Octave as an octave bug, to replace use of glob with builtin('glob') in their codebase. - Tasos Papastylianou
(having said that, there is no guarantee Lightspeed will be compatible with octave even then, but that's another matter) - Tasos Papastylianou
@TasosPapastylianou very much disagree with "the general principle is that if a 'module' breaks an 'environment', it's the environment's fault". In this case, the environment is the language and shadowing core functions is supported (that's how the nan package works for example). It's the module that needs to be careful and ensure that if you shadow functions they keep their signature. But I don't see where that "general principle" holds at all in the general cases. - carandraug
1. Pleasently surprised to have this many responses, even if my question was apparently a little confusing and rubbish. Clearly Octave has a strong community 2. I misused 'toolkit', Lightspeed is just a library used by some ML researchers - Jess

1 Answers

1
votes

I am unable to test this extensively on my machine, but the LightSpeed "toolkit" seems to be nothing more than a collection of 'files' (albeit needing initial compilation).

Adding this collection to the path causes it to shadow a core octave function (glob) which happens not to exist in matlab.

A way around it is to create a namespace, i.e. instead of adding the offending items to the path directly, wrap them around a folder with a plus ('+') in front of the name (e.g. "+Lightspeed"), and add that to the path. You can then call all Lightspeed functions qualified by that namespace, e.g. "Lightspeed.digamma".

In theory this should work; it's up to the particular implementation how sanely they handled relative references etc, but in theory it should be fine.

Alternatively, you could just modify Lightspeed code a bit and replace all occurences of glob with Lglob or something like that.

Or, as Cris suggested, you could try removing Lightspeed from the path and only load it whenever you need to use one of its functions (or cd to its folder before executing Lightspeed related things).

As pointed out in the comments, this is worth raising as a bug, both to Lightspeed1 and to Octave.


1: Though presumably Lightspeed will just say they don't support Octave and you're welcome to try fixing the code yourself