Closed talsaiag closed 3 years ago
We now have an Apple M1 processor (MacBook Pro) for testing and development to provide a local executable. Until then, there is still the public server available with remote=True
or you can install an APM Linux or Windows server and run locally without an Internet connection with remote=True
and server='http://10.0.0.10'
with your local server address. The target is to release the new version of the local executable with dual ARM and x86_64 support. One of the complications is that gcc is still under development for the new platform: https://developer.apple.com/forums/thread/651476
Note: I am using 2.9 GHz 6-Core Intel Core i9
and not the new apple processor.
This worked as expected right before I update the python on the same host
@APMonitor I think that the issue is the missing libquadmath
library which is not statically compiled with the apm_mac
and is is not found in the gcc version that the python3 was compiled for using the brew's gcc
I know that it works correctly on Python3.9 (on another intel macbook)
Python 3.9.0 (default, Oct 27 2020, 14:15:17)
[Clang 12.0.0 (clang-1200.0.32.21)] on darwin
Where he has /usr/local/opt/gcc/lib/gcc/9
But not on mine:
Python 3.9.1 (default, Jan 6 2021, 12:44:33)
[Clang 12.0.0 (clang-1200.0.32.28)] on darwin
where I have /usr/local/opt/gcc/lib/gcc/10
only
@APMonitor is there a way to compile the binary locally or make it statically linked?
I've been working with the Apple M1 MacBook Pro but the gcc compilers aren't ready yet to provide a universal architecture executable. I'll let you know as soon as one is available. An alternative is to create a Windows or Linux APM server and then use that server locally with m = GEKKO(remote=True, server='http://10.0.0.10')
with the correct local IP address. I'll make it a point to statically link all the libraries on this next release.
I tried to install a Linux server; it did not work.
For example, instructions on the referenced webpage are wrong: sudo cp -n apm_linux/lib/* /usr/lib/
(there is no lib Directory on https://github.com/APMonitor/apm_server.git).
When running the python test, the system does not succeed because it cannot load the file "results.csv" which should've presumably been produced by running apm(s,a).
At this moment, the suggested workaround does not work.
Or did I do something wrong?
Another way to run Gekko locally is to run with remote=False
on Linux or Windows. The /lib file is only needed when IPOPT is linked with the executable. You can skip that step for your install. The results.csv
file is generated when you issue a solve command.
Thanks.
Do you mind trying to help me installing a local server? I can give you the commands I used and the errors/observations that follow. No results.csv is produced; an error log is written in /var/log/apache2/error.log :
[Sat Apr 03 15:33:14.926845 2021] [mpm_prefork:notice] [pid 1736] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations [Sat Apr 03 15:33:14.926879 2021] [core:notice] [pid 1736] AH00094: Command line: '/usr/sbin/apache2' [Sat Apr 03 15:37:58.714331 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: mkdir(): No such file or directory in /var/www/html/apm_server/apm_linux/online/apm_line.php on line 24 [Sat Apr 03 15:37:58.714371 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: fopen(127.0.0.1_test_python/127.0.0.1_test_python.apm): failed to open stream: No such file or directory in /var/www/html/apm_server/apm_linux/online/apm_line.php on line 38 [Sat Apr 03 15:37:58.714379 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: fclose() expects parameter 1 to be resource, bool given in /var/www/html/apm_server/apm_linux/online/apm_line.php on line 64 [Sat Apr 03 15:37:58.714389 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: opendir(/var/www/html/online/127.0.0.1_test_python/): failed to open dir: No such file or directory in /var/www/html/apm_server/apm_linux/online/rrmdir.php on line 4 [Sat Apr 03 15:37:58.714394 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: readdir() expects parameter 1 to be resource, bool given in /var/www/html/apm_server/apm_linux/online/rrmdir.php on line 6 [Sat Apr 03 15:37:58.714405 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: unlink(/var/www/html/online/127.0.0.1_test_python/): No such file or directory in /var/www/html/apm_server/apm_linux/online/rrmdir.php on line 10 [Sat Apr 03 15:37:58.714410 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: readdir() expects parameter 1 to be resource, bool given in /var/www/html/apm_server/apm_linux/online/rrmdir.php on line 6 [Sat Apr 03 15:37:58.714417 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: unlink(/var/www/html/online/127.0.0.1_test_python/): No such file or directory in /var/www/html/apm_server/apm_linux/online/rrmdir.php on line 10 ...
The error log coninues with a repetitition of the last two lines until the disk is full: [Sat Apr 03 15:37:58.714498 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: readdir() expects parameter 1 to be resource, bool given in /var/www/html/apm_server/apm_linux/online/rrmdir.php on line 6 [Sat Apr 03 15:37:58.714513 2021] [php7:warn] [pid 1757] [client 127.0.0.1:44816] PHP Warning: unlink(/var/www/html/online/127.0.0.1_test_python/): No such file or directory in /var/www/html/apm_server/apm_linux/online/rrmdir.php on line 10
Does it work to put the directory /var/www/html/apm_server/apm_linux/online/
in /var/www/html/online/
instead?
No. Still the same error: [Sun Apr 04 17:18:14.338475 2021] [php7:warn] [pid 317093] [client 127.0.0.1:37722] PHP Warning: unlink(/var/www/html/online/127.0.0.1_test_python/): No such file or directory in /var/www/html/online/rrmdir.php on line 10 [Sun Apr 04 17:18:14.338479 2021] [php7:warn] [pid 317093] [client 127.0.0.1:37722] PHP Warning: readdir() expects parameter 1 to be resource, bool given in /var/www/html/online/rrmdir.php on line 6
Those look like warnings. Can you see if the directory: /var/www/html/online/127.0.0.1_test_python/ is created and if it contains the .apm file or result.csv file? It looks like you are running with Matlab?
Thanks. No, python. No results.csv is produced. Not even the directory 127.0.0.1_test_python is produced.
(base) bn@bn-ubuntu-i7-focal:/var/www/html$ ls /var/www/html/online/ apm_line.php apm_t0.php dbs.php get_tag.php index.php info.php meas.php plot.php plot_select.php plot_top.php plt.php rrmdir.php view_pass.php (base) bn@bn-ubuntu-i7-focal:/var/www/html$ ls /var/www/html/apm_server/apm_linux/online/ apm_line.php apm_t0.php dbs.php get_tag.php index.php info.php meas.php plot.php plot_select.php plot_top.php plt.php rrmdir.php view_pass.php
log: [Mon Apr 05 19:46:19.155956 2021] [php7:warn] [pid 954529] [client 127.0.0.1:33884] PHP Warning: unlink(/var/www/html/online/127.0.0.1_test_python/): No such file or directory in /var/www/html/online/rrmdir.php on line 10 [Mon Apr 05 19:46:19.155960 2021] [php7:warn] [pid 954529] [client 127.0.0.1:33884] PHP Warning: readdir() expects parameter 1 to be resource, bool given in /var/www/html/online/rrmdir.php on line 6
It looks like a permission problem. Could you run ls -la
in the directory /var/www/html/online
and for the online
directory to ensure that the php files can write a new directory in that folder? You can test that a new folder is created with this Gekko script:
from gekko import GEKKO
m = GEKKO(server='http://127.0.0.1',remote=True)
x = m.Var() # define new variable, default=0
y = m.Var() # define new variable, default=0
m.Equations([3*x+2*y==1, x+2*y==0]) # equations
m.solve(disp=False) # solve
print(x.value,y.value) # print solution
There may also be a write permission error with Ubuntu. This thread discusses some of the issues and potential solutions: https://askubuntu.com/questions/246437/how-to-give-apache2-permission-to-write-and-read-files
The local executable in Gekko v1.0.0 now runs without dependencies. Please let us know if there are any additional issues.
happy to see that the new version Gekko v1.0.0 resolved this issue. I have came across this issue so many times, and have this workaround:
usr/local/opt/gcc/lib/gcc
cp -R 11 9
but yeah this is very annoying should be fixed in new version
Error running using local
m = Gekko(remote=False)
and then of course (a little less indicative error):
Same code worked on same machine before upgrading from python3.8 to python3.9 (using
brew install python3
)Environment:
3.9.1
(installed viabrew install python3
)0.2.6
(installed viapip3 install gekko
using pip3 version20.3.3
)