Recent

Author Topic: python for lazarus  (Read 1174 times)

suibaf

  • New Member
  • *
  • Posts: 16
python for lazarus
« on: July 05, 2022, 09:53:04 pm »
Hi,
I'm trying to permit to work to a app that I found on youtube that is an example of python for lazarus:

https://www.youtube.com/watch?v=WREEoECCMy0

In general it work, with simply python command, but if I try to run a python example of matplotlib with lazarus app it give me an error.

If I run the same python code with Idle or Thonny it work fine. The lazarus give me this error:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.8 from "/usr/bin/python3"
  * The NumPy version is: "1.23.0"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: /home/fabio/.local/lib/python3.8/site-packages/numpy/core/_multiarray_umath.cpython-38-x86_64-linux-gnu.so: undefined symbol: PyObject_SelfIter
.

Press OK to ignore and risk data corruption.
Press Abort to kill the program
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Can you help me to understand what is the problem?
I run with lazarus 2.2.2 on Linux Mint.
BR




mercurhyo

  • Full Member
  • ***
  • Posts: 219
Re: python for lazarus
« Reply #1 on: July 06, 2022, 02:37:24 am »
so the error said itself ... "IMPORTANT... SEE NUMPY" I guess you should ask NUMPY if any forum
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1132
Re: python for lazarus
« Reply #2 on: July 06, 2022, 03:48:32 am »
hello,
how have you installed the module matplotlib ? with pip ? with apt-get install ?
I have no problem on Ubuntu 20.04 Lazarus 2.2  Last version of Python4Lazarus python 3.8 to import matplotlib in a python script used by Python4Lazarus.
matplotlib installed with the command :
Quote
apt-get install python3-matplotlib
Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

suibaf

  • New Member
  • *
  • Posts: 16
Re: python for lazarus
« Reply #3 on: July 06, 2022, 01:45:28 pm »
I'm going to try to reinstall matplotlib, but if I run the python code with thonny or with Pycharm it work fine!

No work inside the lazarus app.

Thank you

suibaf

  • New Member
  • *
  • Posts: 16
Re: python for lazarus
« Reply #4 on: July 06, 2022, 09:05:59 pm »
As yuo can see with thonny the code python work, inside the lazarus app no!
Thank you

AlexTP

  • Hero Member
  • *****
  • Posts: 1899
    • UVviewsoft
Re: python for lazarus
« Reply #5 on: July 06, 2022, 10:10:23 pm »
I am not sure Python4Lazarus lacks something, yes it lacks 'PyObject_SelfIter' symbol, but Python4Delphi (original project) lacks it too!

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1132
Re: python for lazarus
« Reply #6 on: July 07, 2022, 07:15:22 am »
Hello,
As yuo can see with thonny the code python work, inside the lazarus app no!
No problem to run your python script in Lazarus on Ubuntu 20.04 (see attachment).
the packages numpy and matplotlib are in the folder /usr/lib/python3/dist-packages
Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

suibaf

  • New Member
  • *
  • Posts: 16
Re: python for lazarus
« Reply #7 on: July 07, 2022, 10:41:41 am »
I'm newbie of Lazarus, so I don't know what can I do.
Can you send me your code?
BR

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1132
Re: python for lazarus
« Reply #8 on: July 07, 2022, 11:48:42 am »
in attachments, lazarus project using Python4Lazarus and matplotlib
MAy be you need to change the properties  DllName, DllPath and regVersion of the TPythonEngine component (see attachment for an example).
Friendly, J.P
« Last Edit: July 07, 2022, 11:56:09 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

suibaf

  • New Member
  • *
  • Posts: 16
Re: python for lazarus
« Reply #9 on: July 07, 2022, 08:59:48 pm »
Your app work perfectly!

suibaf

  • New Member
  • *
  • Posts: 16
Re: python for lazarus
« Reply #10 on: July 08, 2022, 04:51:12 pm »
As I said your app work very well, but if I calcel pythonengine from the form and then I put on the form new pythonengine it does not work, also if I write correct reference to dllname and dllpath. There is something in my system that is corrupt.

BR

 

TinyPortal © 2005-2018