Hi. I am having some issues importing numpy into mojo.
I am using a virtual environment managed by poetry (v. 1.6.1) using python v. 3.10.12.
I've installed numpy (v. 1.26.2) in the virtual invironment using the poetry command ' poetry add numpy'.
Now when I run mojo inside this virtual environment ('poetry run mojo') and try to import the installed numpy package:
1> from python import Python
let np = Python.import_module("numpy")
print(np.array([1,2,3]))
I get the following import error from numpy:
Error: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
(PythonObject) np = {
(PyObjectPtr) py_object = {
(DTypePointer[si8]) value = {
(pointer<scalar<si8>>) address = 0x0000557a1a843210
}
}
}
I have never seen this issue before. No other package gives this sort of error when I try to import it into mojo from python.
I hope that some of you can help me.