[Solved] APSO: No module named numpy.core._multiarray_umath

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
El Catala
Posts: 22
Joined: Mon Dec 07, 2020 6:29 pm

[Solved] APSO: No module named numpy.core._multiarray_umath

Post by El Catala »

Hello,
From the APSO console in libreoffice base, I am trying to use the numpy module.
When I type the command:

Code: Select all

import numpy as np
Where :

Code: Select all

import sys
sys.path.append ("/ home / elfouste / .local / lib / python3.8 / site-packages")
import numpy as np,
I still get the same error message:

Code: Select all

No module named 'numpy.core._multiarray_umath
I specify that I can use the numpy module in the Thonny IDE to run the python macro.
Despite numerous uninstallation and reinstallation, nothing or done.


Have you ever encountered this problem and how did you solve it?


Have a good evening
Last edited by MrProgrammer on Wed Apr 24, 2024 7:42 pm, edited 2 times in total.
Reason: Tagged ✓ [Solved] Original question about numpy was resolved -- MrProgrammer, forum moderator
LibreOffice 7.0.4 Xubuntu 20.4
El Catala
Posts: 22
Joined: Mon Dec 07, 2020 6:29 pm

Re: No module named 'numpy.core._multiarray_umath

Post by El Catala »

Hello,
First of all, I would like to point out that the numpy and matplotlib modules work correctly in a python editor.
It is only when I import these modules into a macro started with APSO from LO that I encounter this problem.
To answer your second remark concerning internet research, I started with but is it my very, very low level in English or something else, I did not know how to solve the problem.
Forced the path of the file did not bring anything more:

Code: Select all

sys.path.append("/home/elfouste/.local/lib/python3.8/site-packages")
The python embedded in LO is 3.8.8.
The version of numpy is 1.22.0
The matplotlib version is 3.5.1
The PC OS is XUBUNTU 20.04
Libreoffice is in version 7.1.8.1
Hoping to have brought as much information as possible.

cordially
LibreOffice 7.0.4 Xubuntu 20.4
User avatar
karolus
Volunteer
Posts: 1160
Joined: Sat Jul 02, 2011 9:47 am

Re: No module named 'numpy.core._multiarray_umath

Post by karolus »

Hallo
I see a different LO-version in you signature, why did you NOT use the Version 7.0.4 provided by your Xubuntu?

(btw. I'm now on Debian11-Bullseye which comes with LO7.0.4 and python 3.9.2 which is also the python-Interpreter used for LO…

Code: Select all

import numpy
…for example works from any python-shell without "playing" with manually appended pathes )
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
El Catala
Posts: 22
Joined: Mon Dec 07, 2020 6:29 pm

Re: No module named 'numpy.core._multiarray_umath

Post by El Catala »

Hello,
To be sure, I uninstalled my current version of LO. After downloading, I installed the version you indicated to me, namely 7.04.
The problem remains the same.
In fact, under xubuntu, the embedded python is version 3.7.7. The conflict could be with the version of numpy.
However, even assuming I load the correct version of numpy, this cannot be a peer-to-peer solution because, I might not be able to have an up-to-date LO.
As for the version offered in the software library, there are two:
A global first contained in a snapcraft set in version 7.2.4.1
A second in .DEBS in version 6.4.7
In conclusion, what to do? It's really the beard !!!
cordially
LibreOffice 7.0.4 Xubuntu 20.4
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: No module named 'numpy.core._multiarray_umath

Post by RoryOF »

Use the python dir command to examine the library you are importing, to see if numpy is present.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
El Catala
Posts: 22
Joined: Mon Dec 07, 2020 6:29 pm

Re: No module named 'numpy.core._multiarray_umath

Post by El Catala »

Hello again
In fact, I solved part of the problem.
I replaced my LO version with 7.2.4.
Then, I replaced the numpy version with 1.18 and finally I replaced the matpltlib 3.5 version with 3.3.
For numpy, no more problem.
On the other hand, for matplotlib, I cannot install the cycler module correctly.
I end up with only the cycler-0.11.0.dist-info folder when I should, it seems to me, also have a cycler folder.
Is that correct?
The installation of all these modules was done with pip3.
cordially
LibreOffice 7.0.4 Xubuntu 20.4
User avatar
Jurassic Pork
Posts: 24
Joined: Wed Oct 25, 2017 7:55 am
Location: France

Re: No module named 'numpy.core._multiarray_umath

Post by Jurassic Pork »

Hello,
your problem seems to be , the one that i have had with the example of the new version of APSO using numpy. See the README.md ( or LISEZMOI.md in french) here.
Friendly, J.P
OpenOffice 4.1.14 , LibreOffice 7.6.2.1 on Windows 11/ LibreOffice 7.3.7 on Lubuntu 22.04
User avatar
karolus
Volunteer
Posts: 1160
Joined: Sat Jul 02, 2011 9:47 am

Re: No module named 'numpy.core._multiarray_umath

Post by karolus »

Hallo
A bit »longwinded« isnt it?

Code: Select all

import numpy as np

def genRandomData(*args):
    doc = XSCRIPTCONTEXT.getDocument()
    named = doc.NamedRanges
    maxint = named["MaxInt"].ReferredCells.Value
    nbCol = named["NbCol"].ReferredCells.Value
    nbRow = named["NbRow"].ReferredCells.Value
    dest = named["Dest"].ReferredCells.String
    oFeuille = doc.Sheets["Random"]
    res = np.random.randint(int(maxint), size=(int(nbRow),int(nbCol))).tolist()
    cursor = oFeuille.createCursorByRange(oFeuille[dest])
    cursor.collapseToSize( len(res[0]) , len(res) )
    cursor.setDataArray(res)

def clearData(*args):
    doc = XSCRIPTCONTEXT.getDocument()
    oFeuille = doc.Sheets["Random"]
    rangeToClear = doc.NamedRanges["ClearRange"].ReferredCells.String
    oFeuille[rangeToClear].clearContents(5)
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
User avatar
Jurassic Pork
Posts: 24
Joined: Wed Oct 25, 2017 7:55 am
Location: France

Re: No module named 'numpy.core._multiarray_umath

Post by Jurassic Pork »

karolus wrote: Wed Mar 06, 2024 5:26 am A bit »longwinded« isnt it?
no loop :mrgreen:
OpenOffice 4.1.14 , LibreOffice 7.6.2.1 on Windows 11/ LibreOffice 7.3.7 on Lubuntu 22.04
Post Reply