def raise_numpy_version(): """ import numpy if numpy.__version__ != get_numpy_version(): """ if not numpy_version_ok(): raise(AssertionError("Inconsistent numpy versions: libValkka compiled with %s / your system is using %s" % \ (get_numpy_version(), numpy.__version__)))
def warn_numpy_version(): """ import numpy if numpy.__version__ != get_numpy_version(): """ if not numpy_version_ok(): print("WARNING : Inconsistent numpy versions: libValkka compiled with %s / your system is using %s" % \ (get_numpy_version(), numpy.__version__))
print( " You probably need to update your valkka-core module (say, 'sudo apt-get update' and 'sudo apt-get upgrade valkka')" ) print( " .. or update valkka-examples by running 'git pull' in this directory" ) print() print("Loading numerical python") import numpy print("Numpy loaded ok") print(" Numpy loaded from : ", numpy.__file__) print(" Numpy version : ", numpy.__version__) print(" libValkka was compiled ") print(" with numpy version : ", core.get_numpy_version()) if (numpy.__version__ != core.get_numpy_version()): print() print("** ATTENTION ** ") print( " You are using a different numpy version than was used when libvalkka was compiled" ) print(" Normally this should pose no problem") print( " However,if you installed libValkka with apt-get, you'll have a consistent" ) print(" numpy installed in:") print(" /usr/lib/python3/dist-packages/") print(" you might want to use that version instead") print(