Thank you for the link. It would take a lot of time to skim through all the changes that happened in NumPy between the two versions.
I was afraid to try, but here we go:
# in the .comm file
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
This worked perfectly. Then, I don't want to take too many risks so I'll install the older version of matplotlib:
>>> subprocess.check_call([sys.executable, "-m", "pip", "install", "matplotlib==3.4"])
...
Requirement already satisfied: numpy>=1.16 in c:\users\<username>\appdata\local\code_aster\v2021\python37\lib\site-packages (from matplotlib==3.4) (1.16.1)
...
Installing collected packages: typing-extensions, six, pyparsing, pillow, cycler, python-dateutil, kiwisolver, matplotlib
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
anyio 3.1.0 requires idna>=2.8, which is not installed.
jupyter-server 1.8.0 requires ipython-genutils, which is not installed.
...
Successfully installed cycler-0.11.0 kiwisolver-1.4.5 matplotlib-3.4.0 pillow-9.5.0 pyparsing-3.1.1 python-dateutil-2.8.2 six-1.16.0 typing-extensions-4.7.1
Despite the ERROR which only seems to be a warning, it worked. I found online that it is advisable to use --use-deprecated=legacy-resolver
or --use-feature=2020-resolver
. After trying to call matplotlib, this appears in the .mess file:
fort.1: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
Which has an easy fix since Tkinter is included by default. This works:
import matplotlib
matplotlib.use('TkAgg') #Agg, Qt5Agg and WXAgg didn't work
import matplotlib.pyplot as plt
plt.plot([0,1],[0,1],'.-',color='orange')
plt.show()
I can now display results directly from Code_Aster, which is great! Let's hope I don't run into problems because of this. I'll keep you updated.
EDIT: when plotting scatter() in 3D, the colors of the markers are incoherent (they are randomized each time you rotate the view). It works in 2D. This is probably due to the TkAgg backend.