Development Topics > Plugin Development

Vampy numpy problem on Ubuntu

(1/1)

grh:
Hallo!

First thanks for Vampy - it looks really nice and I am looking forward to try some algorithms and visualise it with SonicVisualiser ;).
However, I have a problem with the numpy interface (vf_ARRAY) on Ubuntu 10.04, Python 2.6.5 and numpy 1.3.0.

I installed the latest binaries of SonicVisualiser, Vampy - but all Vampy plugins which use the vf_ARRAY interface are not working, the others work.
At startup of the SonicVisualiser I get the following output:

--- Code: ---    Numpy build information: ABI level: 16777225 Numpy version: 1.1
    Numpy runtime version: 1
    Incompatible Numpy version found: 1
    Please make sure you have Numpy 1.1 or greater installed.
    Vampy: Numpy support disabled.
--- End code ---

OK, so I compiled everything myself (Vamp SDK and Vampy, using the latest source from your webpage), still the same output.
Then I set the compiler flag NUMPY_SHORTVERSION=1.3, but again:

--- Code: ---    Numpy build information: ABI level: 16777225 Numpy version: 1.3
    Numpy runtime version: 1
    Incompatible Numpy version found: 1
    Please make sure you have Numpy 1.3 or greater installed.
    Vampy: Numpy support disabled.
--- End code ---

Do you have any clues what I could try to get this working ?

Thanks for any hints,
LG
Georg

grh:
OK, I found the bug: it is in vampy-main.cpp.
You parse the Numpy version string with sscanf and this seems to have some problems: I always get "1" instead of "1.3" as a result.

One possible fix is to use C++ istringstream to parse the data:

--- Code: ------ 41,43 ----
  #include "PyExtensionManager.h"
! #include <sstream>
 
***************
*** 116,119 ****
 
!     string ver;
!     std::istringstream verStream;
      float numpyVersion;
***************
*** 148,155 ****
  ver = ver.substr(0,ver.rfind("."));
- if(EOF == sscanf(ver.c_str(), "%f", &numpyVersion))
- {
- cerr << "Could not parse Numpy version information." << endl;
- goto numpyFailure;
- }
 
  cerr << "Numpy runtime version: " << numpyVersion << endl;
--- 149,154 ----
  ver = ver.substr(0,ver.rfind("."));
 
+     // parse version string to float
+     verStream.str(ver);
+     verStream >> numpyVersion;
       cerr << "Numpy runtime version: " << numpyVersion << endl;

--- End code ---

Now everything works like expected - maybe you can include this fix (or a similar method) in a future version !

fazekasgy:
Hi Georg,
Thanks for the bug report and the fix!
It will be included in the next release.

George

grh:
Hallo George!

Thanks for the answer !

One more question: is this the right place to report such problems ?
Or should I better write such things on the mailing list ?

LG
Georg

Navigation

[0] Message Index

Go to full version