Hi Kuba,
thanks for your reply. Sry, I wasn't clear. I'm using import AmiPy, I know it's case sensitive, sry, I spelled it incorrectly. But if I run my .py in Spyder IDE, I get an error because AmiPy is not an "installed module" (see picture).
So what I'm asking is:
What is the best way to debug the python code (i.e. in Spyder IDE) since I can't "run" it, as it will always show the error. How do you debug your more complex python codes when using AmiPy? - Do you run it without AmiPy first, make sure everything works, then you add back in?
As I have stated before in this thread, AmiPy is an embedded module. That means that it is not available outside AmiPy execution context.
Either way, you do not have to import AmiPy module for it to work from AFL, as it only gives You a way to interact with AFL environment from python. If You want to debug/run your code outside AmiPy, You can just comment the import out, and if You are using its functions, you can create a no-op module with the same interfaces.
Hello @ [SpandexMan]: -
Its off topic but looking to connect with you for building 3rd party data plugin in c++ .
can we connect at veekysoft@gmail.com
Hello, I have Amibroker 6.93 Professional. I installed Python 3.12.5 from the official website. I installed pip, then numpy, and it installed numpy version 2.1.0
When I open Amibroker it loads the AmiPy plug fine. But when I try to run the example I get these errors below related the numpy version. I tried to downgrade to numpy 1.9.2 but still get same error. Any advice?
AmiPy 1.0.2 log:
AB: 6.93
PY: 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]
Logging message mask: error warning main_ev
Logging started 2024-09-01 14:56:03
10.29 ms (TID: 00003280) : Python started
567.16 ms (TID: 00003280) : Error: cannot import array API (no numpy?) [numpy.core.multiarray failed to import]
RuntimeError: module compiled against ABI version 1000009 but this version of numpy is 2000000
567.18 ms (TID: 00003280) : AmiPy was not initialized successfully => stopping MainPythonThread
567.20 ms (TID: 00002428) : Error: cannot import array API (no numpy?) [numpy.core.multiarray failed to import]
RuntimeError: module compiled against ABI version 1000009 but this version of numpy is 2000000
567.55 ms (TID: 00002428) : Error: cannot import array API (no numpy?) [numpy.core.multiarray failed to import]
RuntimeError: module compiled against ABI version 1000009 but this version of numpy is 2000000
567.64 ms (TID: 00002428) : Error: cannot import array API (no numpy?) [numpy.core.multiarray failed to import]
RuntimeError: module compiled against ABI version 1000009 but this version of numpy is 2000000
Yes I did. I kept experimenting with numpy versions and downloaded 1.26.4 and that seemed to work.
What a great plugin you wrote. I upgraded my AB just to use it! I used to use the R plugin back in the day, but this 1000x better. Thomaz should make it official, lol.
I hope you can keep it updated, like with the numpy version.
Hi Kuba, one thing I wanted to ask. I noticed that you can't seem to pass integers in functions from AFL to python. I have no problem casting the variable to int in the python code, but I was wondering if this is by design or perhaps a limitation with how Amibroker stores integers?
In AmiBroker, every number is a float, not integer.
If you want integer in Python you must do the cast yourself in Python.
There are no declarations in AFL, therefore you can't declare an integer and all numbers are floats.
You might say that you don't need declarations and x = 1 would implicitly get integer and only 0.5 would be float type, but that is not good idea. Once you assume that you have implicit coercion/conversion new types of errors would start occur, you would need to start having arrays of mixed types (integers and floats at the same time, you would need to store type per array element) and general performance will drop because of hidden conversions float->int and int->float. Such conversions are slow, especially without SSE2. Overall, without forced declarations it is Pandora's box.
about making a donation. I do not have a Paypal account (anymore) but there is a setting that you can set to receive donations from a credit card. Maybe you can activate that. So for instance when I press the "donate" button in the first post of this thread I would get into this window so I can chose to pay with a credit card:
i meant to say that it is possible to donate to a PayPal account without having a PayPal account myself. But the PayPal account holder (@Kuba) needs to activate a setting (inside PayPal) to be able to receive funds donated directly from a credit card
hi, I installed the latest AmiPy plugin and I am using Numpy 2.1.1 currently. All working fine except that the latest version of Tensorflow 2.11 and higher is no longer supported on Native Windows, see: native windows
Caution: TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows.
I did not solve this problem yet. Anyone tackle this problem? Do I need to install Windows WSL2? I have no clue if the AmiPy plugin would work or not. I guess not. So if someone already solved this please let me know.
I think the easiest way to fix this is to rollback using a previous version.
For this reason I suggest @kuba to publish multiple versions (current and past) to a public repository, documenting the required Python version and/or corresponding other requirements such as numpy, and also compatibility with the Amibroker version.
yes I also saved the old plugin so I can still use Python 3.8.5 which I also have installed. So that is easy to do.
I just wonder if we can run Python 3.12 from ubuntu using the AmiPy plugin. I installed ubuntu using WSL2 on my Windows 11 computer. But that is as far as I got.
I can install Python 3.12 and Tensorflow on there. Question is if I can then use that version of python installed in the ubuntu environment using the AmiPy plugin.
Unfortunately when developing in Python it often happens that new versions make some libraries incompatible (more frequently in Windows) and updates become a nightmare...
This is why I suggest @Kuba make available (a document) multiple versions of his plugin (current and past) for those who perhaps haven't used AmiPy yet (and never downloaded it in the past) and have an older stable version of a Python environment and prefer to continue using that.
not sure why Tensorflow stopped GPU support for versions higher than 2.11 (under native windows). Main problem is that when I install Tensorflow under Python 3.12 it will uninstall Numpy 2.1.1 (reverting back to v1.26) and then the latest AmiPy plugin will not work.
Maybe I will switch to PyTorch. Most examples are however written in Tensorflow. I was just about to test some interesting example code: reinforcement learning
As of the python in WSL I do not know if it even is possible without rewriting everything to be out of process. And even then I would believe that IPC between windows and WSL would bring even more problems.