sblauth / cashocs

computational adjoint-based shape optimization and optimal control software for python
https://cashocs.readthedocs.io/
GNU General Public License v3.0
50 stars 10 forks source link

Error when trying to run demo problem #396

Closed AudreyDemafo closed 7 months ago

AudreyDemafo commented 7 months ago

Hi everyone,

I am encountering an issue while solving the optimal control problem for the Poisson. I reproduced the the same code that is in the cashocs tutorial and I am getting the following error:

"TypeError: Cannot convert float to petsc4py.PETSc.Vec". This is what the erro looks like:

> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
> Cell In[10], line 23
>  18 J = cashocs.IntegralFunctional(
>  19     Constant(0.5) * (y - y_d) * (y - y_d) * dx + Constant(0.5 * alpha) * u * u * dx
>  20 )
> 22 ocp = cashocs.OptimalControlProblem(e, bcs, J, y, u, p, config=config)
> ---> 23 ocp.solve() 

> File ~/yes/envs/fenicsproject/lib/python3.9/site-packages/cashocs/_optimization/optimal_control/optimal_control_problem.py:382, in > OptimalControlProblem.solve(self, algorithm, rtol, atol, max_iter)
>    379 self._setup_control_bcs()
>   381 self.solver = self._setup_solver()
>   --> 382 self.solver.run()
>    383 self.solver.post_processing()

> File ~/yes/envs/fenicsproject/lib/python3.9/site-packages/cashocs/_optimization/optimization_algorithms/l_bfgs.py:128, in 
> LBFGSMethod.run(self)
 >   125 if self.convergence_test():
 >   126     break
> --> 128 self.update_hessian_approximation()

>File ~/yes/envs/fenicsproject/lib/python3.9/site-packages/cashocs/_optimization/optimization_algorithms/l_bfgs.py:243, in > >LBFGSMethod.update_hessian_approximation(self)
  >  235     self.y_k[i].vector().vec().aypx(
  >  236         0.0,
   > 237         self.gradient[i].vector().vec()
   > 238         - self.gradient_prev[i].vector().vec(),
   > 239     )
   > 240     self.y_k[i].vector().apply("")
   > 241     self.s_k[i].vector().vec().aypx(
  >  242         0.0,
>--> 243         self.stepsize * self.search_direction[i].vector().vec(),
  >  244     )
  >  245     self.s_k[i].vector().apply("")
 >   247 self.optimization_variable_abstractions.restrict_to_inactive_set(
   > 248     self.y_k, self.y_k
   > 249 )

> File petsc4py/PETSc/Vec.pyx:90, in petsc4py.PETSc.Vec.__mul__()

> TypeError: Cannot convert float to petsc4py.PETSc.Vec"

Here is the code


from fenics imort*
import cashocs
from dolfin import*

cashocs.set_log_level(cashocs.LogLevel.INFO)
config = cashocs.load_config("config.ini")
mesh, subdomains, boundaries, dx, ds, dS = cashocs.regular_mesh(25)

V = FunctionSpace(mesh, "CG", 1)

u = Function(V)

y = Function(V)
p = Function(V)

Function(V)

e = inner(grad(y), grad(p)) * dx - u * p * dx

bcs = cashocs.create_dirichlet_bcs(V, Constant(0), boundaries, [1, 2, 3, 4])

y_d = Expression("sin(2*pi*x[0])*sin(2*pi*x[1])", degree=1)

alpha = 1e-6
J = cashocs.IntegralFunctional(
    Constant(0.5) * (y - y_d) * (y - y_d) * dx + Constant(0.5 * alpha) * u * u * dx
)

ocp = cashocs.OptimalControlProblem(e, bcs, J, y, u, p, config=config)
ocp.solve() 

Appearently, it looks like the error comes from the solve function but I have no idea on how to fix it. @sblauth any help on the issue would be very much appreciated.

I am using python 3.9.12. I install cashocs within the fenicsproject environment.

Thank you in advance.

sblauth commented 7 months ago

I cannot reproduce the problem. First, you have a typo in your code, the first line should be from fenics import * So please make sure that you copy the actual code you are using, so that reproduction is possible.

As you have not specified your config.ini file, I have tried running your code with all solvers, and it worked without any problems.

Could you post your config.ini file, so I can try to reproduce the problem? Also, please provide the version of cashocs you are using. You can show this with the lines

import cashocs
print(cashocs.__version__)
AudreyDemafo commented 7 months ago

Thank you very much your reply. I have copied exactly the same code from my jupyter notebook and this is what it looks like. I have tried to check whether the space between import and the star changes anything in the code and both syntaxes work well for me.

Here is the code and the config.ini file as well

from fenics import*
from dolfin import*
import cashocs

cashocs.set_log_level(cashocs.LogLevel.INFO)
config = cashocs.load_config("config.ini")
mesh, subdomains, boundaries, dx, ds, dS = cashocs.regular_mesh(25)

V = FunctionSpace(mesh, "CG", 1)

u = Function(V)

y = Function(V)
p = Function(V)

Function(V)

e = inner(grad(y), grad(p)) * dx - u * p * dx

bcs = cashocs.create_dirichlet_bcs(V, Constant(0), boundaries, [1, 2, 3, 4])

y_d = Expression("sin(2*pi*x[0])*sin(2*pi*x[1])", degree=1)

alpha = 1e-6
J = cashocs.IntegralFunctional(
    Constant(0.5) * (y - y_d) * (y - y_d) * dx + Constant(0.5 * alpha) * u * u * dx
)

ocp = cashocs.OptimalControlProblem(e, bcs, J, y, u, p, config=config)
ocp.solve() 

And here is the config.ini file

#[Mesh]
#mesh_file = ../mesh/mesh.xdmf

[StateSystem]
is_linear = True
newton_rtol = 1e-11
newton_atol = 1e-13
newton_iter = 50
newton_damped = True
newton_inexact = False
newton_verbose = False
picard_iteration = False
picard_rtol = 1e-10
picard_atol = 1e-12
picard_iter = 10
picard_verbose = False

[OptimizationRoutine]
algorithm = lbfgs
rtol = 1e-3
atol = 0.0
max_iter = 100
gradient_method = direct
gradient_tol = 1e-9
soft_exit = False

[LineSearch]
initial_stepsize = 1.0
safeguard_stepsize = True
epsilon_armijo = 1e-4
beta_armijo = 2

[AlgoLBFGS]
bfgs_memory_size = 3
use_bfgs_scaling = True

[AlgoCG]
cg_method = PR
cg_periodic_restart = False
cg_periodic_its = 5
cg_relative_restart = False
cg_restart_tol = 0.5

[AlgoTNM]
inner_newton = cg
max_it_inner_newton = 100
inner_newton_rtol = 1e-15
inner_newton_atol = 0.0

[Output]
verbose = True
save_results = True
save_txt = True
save_state = False
save_adjoint = False
save_gradient = False
result_dir = ./
precision = 3
time_suffix = False

I am using the version 2.0.11 of cashocs. Thank you

sblauth commented 7 months ago

I am sorry, but I still cannot replicate your problem. I just copied the files and got the following results with v2.0.11 of cashocs:

cashocs - INFO - Generating mesh.
cashocs - INFO - Done generating mesh. Elapsed time: 0.01 s.
cashocs - INFO - Successfully generated 2-dimensional mesh on 1 CPU(s).
cashocs - INFO - Mesh contains 676 vertices and 1,250 cells of type triangle.

iter,  cost function,  rel. grad. norm,  abs. grad. norm,  step size

   0,      1.224e-01,        1.000e+00,        6.169e-03,  

   1,      1.224e-01,        9.998e-01,        6.168e-03,  1.000e+00
   2,      4.065e-02,        2.308e+00,        1.424e-02,  1.000e+00
   3,      8.569e-03,        4.848e-01,        2.991e-03,  5.000e-01
   4,      7.846e-04,        2.605e-03,        1.607e-05,  1.000e+00
   5,      7.842e-04,        2.149e-03,        1.326e-05,  1.000e+00
   6,      7.831e-04,        1.065e-03,        6.568e-06,  1.000e+00
   7,      7.831e-04,        6.823e-03,        4.209e-05,  1.000e+00
   8,      7.828e-04,        1.588e-03,        9.797e-06,  1.000e+00
   9,      7.827e-04,        7.597e-04,        4.687e-06,  1.000e+00

Optimization was successful.
Statistics:
    total iterations:    9
    final objective value:  7.827e-04
    final gradient norm:    7.597e-04
    total number of state systems solved:     11
    total number of adjoint systems solved:   10

You said you installed cashocs in the fenicsproject environment? Are you using conda? If so, could you please provide the list of installed packages with conda list?

Have you tried creating a new environment with a clean installation of cashocs, as suggested in https://cashocs.readthedocs.io/en/stable/about/installation/#installation-instructions ?

AudreyDemafo commented 7 months ago

Thanks. I am using conda indeed. here is the list of installed package in the fenicsproject environment that I have:

# packages in environment at /home/audreydemafo/yes/envs/fenicsproject:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
alsa-lib                  1.2.10               hd590300_0    conda-forge
anyio                     4.3.0              pyhd8ed1ab_0    conda-forge
argon2-cffi               23.1.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0           py39hd1e30aa_4    conda-forge
arrow                     1.3.0              pyhd8ed1ab_0    conda-forge
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
async-lru                 2.0.4              pyhd8ed1ab_0    conda-forge
attr                      2.5.1                h166bdaf_1    conda-forge
attrs                     23.2.0             pyh71513ae_0    conda-forge
babel                     2.14.0             pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.12.3             pyha770c72_0    conda-forge
binutils_impl_linux-64    2.40                 hf600244_0    conda-forge
binutils_linux-64         2.40                 hbdbef99_2    conda-forge
bleach                    6.1.0              pyhd8ed1ab_0    conda-forge
blosc                     1.21.5               h0f2a231_0    conda-forge
brotli                    1.1.0                hd590300_1    conda-forge
brotli-bin                1.1.0                hd590300_1    conda-forge
brotli-python             1.1.0            py39h3d6467e_1    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
c-ares                    1.26.0               hd590300_0    conda-forge
ca-certificates           2024.2.2             hbcca054_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cairo                     1.18.0               h3faef2a_0    conda-forge
cashocs                   2.0.11             pyhd8ed1ab_0    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0           py39h7a31438_0    conda-forge
cftime                    1.6.3            py39h44dd56e_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
cmake                     3.28.3               hcfe8598_0    conda-forge
comm                      0.2.1              pyhd8ed1ab_0    conda-forge
contourpy                 1.2.0            py39h7633fee_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
debugpy                   1.8.1            py39h3d6467e_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
eigen                     3.4.0                h00ab1b0_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.0              pyhd8ed1ab_2    conda-forge
executing                 2.0.1              pyhd8ed1ab_0    conda-forge
expat                     2.5.0                hcb278e6_1    conda-forge
fenics                    2019.1.0        py39hcaacaa7_42    conda-forge
fenics-dijitso            2019.1.0          pyhd8ed1ab_39    conda-forge
fenics-dolfin             2019.1.0        py39h3ef2b04_42    conda-forge
fenics-ffc                2019.1.0          pyhd8ed1ab_39    conda-forge
fenics-fiat               2019.1.0          pyhd8ed1ab_39    conda-forge
fenics-libdolfin          2019.1.0            h05c4287_42    conda-forge
fenics-ufl                2019.1.0        py39hf3d152e_38    conda-forge
fftw                      3.3.10          mpi_mpich_h5537406_8    conda-forge
fltk                      1.3.7                h83e168f_1    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 h77eed37_1    conda-forge
fontconfig                2.14.2               h14ed4e7_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.49.0           py39hd1e30aa_0    conda-forge
fqdn                      1.5.1              pyhd8ed1ab_0    conda-forge
freeimage                 3.18.0              hca5c823_12    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
gcc_impl_linux-64         12.3.0               he2b93b0_5    conda-forge
gcc_linux-64              12.3.0               h76fc315_2    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
glib                      2.78.4               hfc55251_0    conda-forge
glib-tools                2.78.4               hfc55251_0    conda-forge
gmp                       6.3.0                h59595ed_0    conda-forge
gmpy2                     2.1.2            py39h376b7d2_1    conda-forge
gmsh                      4.11.1               h51d60e7_3    conda-forge
graphite2                 1.3.13            h58526e2_1001    conda-forge
gst-plugins-base          1.22.9               h8e1006c_0    conda-forge
gstreamer                 1.22.9               h98fc4e7_0    conda-forge
gxx_impl_linux-64         12.3.0               he2b93b0_5    conda-forge
gxx_linux-64              12.3.0               h8a814eb_2    conda-forge
h11                       0.14.0             pyhd8ed1ab_0    conda-forge
h2                        4.1.0            py39hf3d152e_0    conda-forge
h5py                      3.10.0          nompi_py39h2c511df_101    conda-forge
harfbuzz                  8.3.0                h3d44ed6_0    conda-forge
hdf4                      4.2.15               h9772cbc_5    conda-forge
hdf5                      1.14.3          mpi_mpich_ha2c2bf8_0    conda-forge
hpack                     4.0.0              pyh9f0ad1d_0    conda-forge
httpcore                  1.0.3              pyhd8ed1ab_0    conda-forge
httpx                     0.26.0             pyhd8ed1ab_0    conda-forge
hyperframe                6.0.1              pyhd8ed1ab_0    conda-forge
hypre                     2.28.0          mpi_mpich_h716cb5e_0    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
imath                     3.1.6                h6239696_1    conda-forge
importlib-metadata        7.0.1              pyha770c72_0    conda-forge
importlib-resources       6.1.1              pyhd8ed1ab_0    conda-forge
importlib_metadata        7.0.1                hd8ed1ab_0    conda-forge
importlib_resources       6.1.1              pyhd8ed1ab_0    conda-forge
ipykernel                 6.29.2             pyhd33586a_0    conda-forge
ipython                   8.18.1             pyh707e725_3    conda-forge
ipywidgets                8.1.2              pyhd8ed1ab_0    conda-forge
isoduration               20.11.0            pyhd8ed1ab_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.3              pyhd8ed1ab_0    conda-forge
jpeg                      9e                   h0b41bf4_3    conda-forge
json5                     0.9.17             pyhd8ed1ab_0    conda-forge
jsonpointer               2.4              py39hf3d152e_3    conda-forge
jsonschema                4.21.1             pyhd8ed1ab_0    conda-forge
jsonschema-specifications 2023.12.1          pyhd8ed1ab_0    conda-forge
jsonschema-with-format-nongpl 4.21.1             pyhd8ed1ab_0    conda-forge
jupyter                   1.0.0             pyhd8ed1ab_10    conda-forge
jupyter-lsp               2.2.2              pyhd8ed1ab_0    conda-forge
jupyter_client            8.6.0              pyhd8ed1ab_0    conda-forge
jupyter_console           6.6.3              pyhd8ed1ab_0    conda-forge
jupyter_core              5.7.1            py39hf3d152e_0    conda-forge
jupyter_events            0.9.0              pyhd8ed1ab_0    conda-forge
jupyter_server            2.12.5             pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.5.2              pyhd8ed1ab_0    conda-forge
jupyterlab                4.1.2              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.3.0              pyhd8ed1ab_1    conda-forge
jupyterlab_server         2.25.3             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.10             pyhd8ed1ab_0    conda-forge
jxrlib                    1.1                  hd590300_3    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_17    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.5            py39h7633fee_1    conda-forge
krb5                      1.21.2               h659d440_0    conda-forge
lame                      3.100             h166bdaf_1003    conda-forge
lcms2                     2.15                 hfd0df8a_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libaec                    1.1.2                h59595ed_1    conda-forge
libblas                   3.9.0           21_linux64_openblas    conda-forge
libboost                  1.82.0               h6fcfa73_6    conda-forge
libboost-headers          1.84.0               ha770c72_1    conda-forge
libbrotlicommon           1.1.0                hd590300_1    conda-forge
libbrotlidec              1.1.0                hd590300_1    conda-forge
libbrotlienc              1.1.0                hd590300_1    conda-forge
libcap                    2.69                 h0f662aa_0    conda-forge
libcblas                  3.9.0           21_linux64_openblas    conda-forge
libcbor                   0.10.2               hcb278e6_0    conda-forge
libclang                  15.0.7          default_hb11cfb5_4    conda-forge
libclang13                15.0.7          default_ha2b6cf4_4    conda-forge
libcups                   2.3.3                h4637d8d_4    conda-forge
libcurl                   8.5.0                hca28451_0    conda-forge
libdeflate                1.17                 h0b41bf4_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libevent                  2.1.12               hf998b51_1    conda-forge
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libfido2                  1.14.0               h4446dcb_0    conda-forge
libflac                   1.4.3                h59595ed_0    conda-forge
libgcc-devel_linux-64     12.3.0             h8bca6fd_105    conda-forge
libgcc-ng                 13.2.0               h807b86a_5    conda-forge
libgcrypt                 1.10.3               hd590300_0    conda-forge
libgfortran-ng            13.2.0               h69a702a_5    conda-forge
libgfortran5              13.2.0               ha4646dd_5    conda-forge
libglib                   2.78.4               h783c2da_0    conda-forge
libglu                    9.0.0             hac7e632_1003    conda-forge
libgomp                   13.2.0               h807b86a_5    conda-forge
libgpg-error              1.47                 h71f35ed_0    conda-forge
libhwloc                  2.9.3           default_h554bfaf_1009    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
liblapack                 3.9.0           21_linux64_openblas    conda-forge
libllvm15                 15.0.7               hb3ce162_4    conda-forge
libnetcdf                 4.9.2           nompi_h9612171_113    conda-forge
libnghttp2                1.58.0               h47da74e_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.26          pthreads_h413a1c8_0    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.42               h2797004_0    conda-forge
libpq                     16.2                 h33b98f1_0    conda-forge
libraw                    0.21.1               h89bc310_0    conda-forge
libsanitizer              12.3.0               h0f45ef3_5    conda-forge
libsndfile                1.2.2                hc60ed4a_1    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsqlite                 3.45.1               h2797004_0    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-devel_linux-64  12.3.0             h8bca6fd_105    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_5    conda-forge
libsystemd0               255                  h3516f8a_0    conda-forge
libtiff                   4.6.0                ha9c0a0a_2    conda-forge
libudev1                  255                  h3f72095_0    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libuv                     1.47.0               hd590300_0    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libwebp-base              1.3.2                hd590300_0    conda-forge
libxcb                    1.15                 h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libxkbcommon              1.6.0                hd429924_1    conda-forge
libxml2                   2.12.5               h232c23b_0    conda-forge
libzip                    1.10.1               h2629f0a_3    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
markdown-it-py            3.0.0              pyhd8ed1ab_0    conda-forge
markupsafe                2.1.5            py39hd1e30aa_0    conda-forge
matplotlib                3.8.3            py39hf3d152e_0    conda-forge
matplotlib-base           3.8.3            py39he9076e7_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mdurl                     0.1.2              pyhd8ed1ab_0    conda-forge
meshio                    5.3.5              pyhd8ed1ab_0    conda-forge
metis                     5.1.0             h59595ed_1007    conda-forge
mistune                   3.0.2              pyhd8ed1ab_0    conda-forge
mpc                       1.3.1                hfe3b2da_0    conda-forge
mpfr                      4.2.1                h9458935_0    conda-forge
mpg123                    1.32.4               h59595ed_0    conda-forge
mpi                       1.0                       mpich    conda-forge
mpi4py                    3.1.5            py39h6cbbaa3_0    conda-forge
mpich                     4.2.0              h846660c_100    conda-forge
mpmath                    1.3.0              pyhd8ed1ab_0    conda-forge
mumps-include             5.2.1               ha770c72_11    conda-forge
mumps-mpi                 5.2.1               h7ee95aa_11    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mysql-common              8.0.33               hf1915f5_6    conda-forge
mysql-libs                8.0.33               hca2cd23_6    conda-forge
nbclient                  0.8.0              pyhd8ed1ab_0    conda-forge
nbconvert                 7.16.1             pyhd8ed1ab_0    conda-forge
nbconvert-core            7.16.1             pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.16.1             pyhd8ed1ab_0    conda-forge
nbformat                  5.9.2              pyhd8ed1ab_0    conda-forge
ncurses                   6.4                  h59595ed_2    conda-forge
nest-asyncio              1.6.0              pyhd8ed1ab_0    conda-forge
netcdf4                   1.6.5           nompi_py39h4282601_100    conda-forge
notebook                  7.1.0              pyhd8ed1ab_0    conda-forge
notebook-shim             0.2.4              pyhd8ed1ab_0    conda-forge
nspr                      4.35                 h27087fc_0    conda-forge
nss                       3.98                 h1d7d5a4_0    conda-forge
numpy                     1.26.4           py39h474f0d3_0    conda-forge
occt                      7.7.2           novtk_h130ccc2_101    conda-forge
openexr                   3.1.5                h0cdce71_2    conda-forge
openjpeg                  2.5.0                h488ebb8_3    conda-forge
openssh                   9.6p1                h2d3b35a_0    conda-forge
openssl                   3.2.1                hd590300_0    conda-forge
overrides                 7.7.0              pyhd8ed1ab_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pandoc                    3.1.12.1             ha770c72_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parmetis                  4.0.3             h2a9763c_1005    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pcre2                     10.42                hcad00b1_0    conda-forge
petsc                     3.20.2          real_h622a54c_100    conda-forge
petsc4py                  3.20.2          real_hbc6119c_100    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    10.2.0           py39had0adad_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
pixman                    0.43.2               h59595ed_0    conda-forge
pkg-config                0.29.2            h36c2ea0_1008    conda-forge
pkgconfig                 1.5.5              pyhd8ed1ab_4    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_1    conda-forge
platformdirs              4.2.0              pyhd8ed1ab_0    conda-forge
ply                       3.11                       py_1    conda-forge
prometheus_client         0.20.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.42             pyha770c72_0    conda-forge
prompt_toolkit            3.0.42               hd8ed1ab_0    conda-forge
psutil                    5.9.8            py39hd1e30aa_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptscotch                  6.0.9                hb499603_2    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pulseaudio-client         16.1                 hb77b528_5    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pybind11                  2.11.1           py39h7633fee_2    conda-forge
pybind11-global           2.11.1           py39h7633fee_2    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.17.2             pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pyqt                      5.15.9           py39h52134e7_5    conda-forge
pyqt5-sip                 12.12.2          py39h3d6467e_5    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.9.18          h0755675_1_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.19.1             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.7              pyhd8ed1ab_0    conda-forge
python_abi                3.9                      4_cp39    conda-forge
pytz                      2024.1             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1            py39hd1e30aa_1    conda-forge
pyzmq                     25.1.2           py39h8c080ef_0    conda-forge
qt-main                   5.15.8              h5810be5_19    conda-forge
qtconsole-base            5.5.1              pyha770c72_0    conda-forge
qtpy                      2.4.1              pyhd8ed1ab_0    conda-forge
rapidjson                 1.1.0             he1b5a44_1002    conda-forge
readline                  8.2                  h8228510_1    conda-forge
referencing               0.33.0             pyhd8ed1ab_0    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
rfc3339-validator         0.1.4              pyhd8ed1ab_0    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
rhash                     1.4.4                hd590300_0    conda-forge
rich                      13.7.0             pyhd8ed1ab_0    conda-forge
rpds-py                   0.18.0           py39h9fdd4d6_0    conda-forge
scalapack                 2.2.0                hd931219_1    conda-forge
scotch                    6.0.9                hb2e6521_2    conda-forge
send2trash                1.8.2              pyh41d4057_0    conda-forge
setuptools                69.1.0             pyhd8ed1ab_1    conda-forge
sip                       6.7.12           py39h3d6467e_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
slepc                     3.20.1          real_hac23e11_100    conda-forge
slepc4py                  3.20.1          real_hab767b8_100    conda-forge
snappy                    1.1.10               h9fff704_0    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.5                pyhd8ed1ab_1    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
suitesparse               5.10.1               h5a4f163_3    conda-forge
superlu                   5.2.2                h00795ac_0    conda-forge
superlu_dist              7.2.0                h25dcc4a_0    conda-forge
sympy                     1.12            pypyh9d50eac_103    conda-forge
sysroot_linux-64          2.12                he073ed8_17    conda-forge
tbb                       2021.11.0            h00ab1b0_1    conda-forge
terminado                 0.18.0             pyh0d859eb_0    conda-forge
tinycss2                  1.2.1              pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tornado                   6.4              py39hd1e30aa_0    conda-forge
traitlets                 5.14.1             pyhd8ed1ab_0    conda-forge
types-python-dateutil     2.8.19.20240106    pyhd8ed1ab_0    conda-forge
typing-extensions         4.9.0                hd8ed1ab_0    conda-forge
typing_extensions         4.9.0              pyha770c72_0    conda-forge
typing_utils              0.1.0              pyhd8ed1ab_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
unicodedata2              15.1.0           py39hd1e30aa_0    conda-forge
uri-template              1.3.0              pyhd8ed1ab_0    conda-forge
urllib3                   2.2.1              pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.13             pyhd8ed1ab_0    conda-forge
webcolors                 1.13               pyhd8ed1ab_0    conda-forge
webencodings              0.5.1              pyhd8ed1ab_2    conda-forge
websocket-client          1.7.0              pyhd8ed1ab_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
widgetsnbextension        4.0.10             pyhd8ed1ab_0    conda-forge
xcb-util                  0.4.0                hd590300_1    conda-forge
xcb-util-image            0.4.0                h8ee46fc_1    conda-forge
xcb-util-keysyms          0.4.0                h8ee46fc_1    conda-forge
xcb-util-renderutil       0.3.9                hd590300_1    conda-forge
xcb-util-wm               0.4.1                h8ee46fc_1    conda-forge
xkeyboard-config          2.41                 hd590300_0    conda-forge
xorg-fixesproto           5.0               h7f98852_1002    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.1.1                hd590300_0    conda-forge
xorg-libsm                1.2.4                h7391055_0    conda-forge
xorg-libx11               1.8.7                h8ee46fc_0    conda-forge
xorg-libxau               1.0.11               hd590300_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h0b41bf4_2    conda-forge
xorg-libxfixes            5.0.3             h7f98852_1004    conda-forge
xorg-libxmu               1.1.3                h7f98852_0    conda-forge
xorg-libxrender           0.9.11               hd590300_0    conda-forge
xorg-libxt                1.3.0                hd590300_1    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h0b41bf4_1003    conda-forge
xorg-xf86vidmodeproto     2.3.1             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zeromq                    4.3.5                h59595ed_0    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               hd590300_5    conda-forge
zstd                      1.5.5                hfc55251_0    conda-forge

Note: you may need to restart the kernel to use updated packages.

I am trying to do the installation in a new conda environment as suggested in https://cashocs.readthedocs.io/en/stable/about/installation/#installation-instructions. The process is not yet complete.

sblauth commented 7 months ago

Regarding your packages: You have installed PETSc 3.20.2 - cashocs currently has issues when using PETSc 3.20, as explained in #320 The issue I discovered does not come from cashocs, but from FEniCS itself. However, there could be other issues (as the one you are describing) which I have not yet been able to test rigorously. Based on my testing with PETSc 3.20 it should not be an issue, but I would suggest installing cashocs to a new enviroment - if you follow the instructions then a version of PETSc < 3.20 will be used automatically.

I think that this issue was fixed in #321, so the new cashocs version 2.1.0 should also work with PETSc 3.20, at least as far as your code goes.

I think the easiest solution is to update the cashocs package with conda, this should fix your problem.

AudreyDemafo commented 7 months ago

I have created a new environment in which I installed cashocs. Within the new environment the version changed to 1.8.12 and the code still gives me the sane error. I have tried to update the version with the syntax

conda update cashocs

but it seems not to be working.

sblauth commented 7 months ago

This won't happen. My nightly tests show what happens when you create a new conda environment with cashocs using conda create -n test -c conda-forge cashocs python=3.11.

Output is

package                    |            build
    ---------------------------|-----------------
    brotli-1.1.0               |       h0dc2134_1          19 KB  conda-forge
    brotli-bin-1.1.0           |       h0dc2134_1          16 KB  conda-forge
    bzip2-1.0.8                |       h10d778d_5         125 KB  conda-forge
    c-ares-1.26.0              |       h10d778d_0         144 KB  conda-forge
    ca-certificates-2024.2.2   |       h8857fd0_0         152 KB  conda-forge
    cached-property-1.5.2      |       hd8ed1ab_1           4 KB  conda-forge
    cached_property-1.5.2      |     pyha770c72_1          11 KB  conda-forge
    cairo-1.18.0               |       h99e66fa_0         865 KB  conda-forge
    cashocs-2.1.0              |     pyhd8ed1ab_0         202 KB  conda-forge
    certifi-2024.2.2           |     pyhd8ed1ab_0         157 KB  conda-forge
    cftime-1.6.3               |  py311hc9a392d_0         207 KB  conda-forge
    cmake-3.28.3               |       h7c85d92_0        15.8 MB  conda-forge
    contourpy-1.2.0            |  py311h7bea37d_0         242 KB  conda-forge
    curl-8.5.0                 |       h726d00d_0         150 KB  conda-forge
    cycler-0.12.1              |     pyhd8ed1ab_0          13 KB  conda-forge
    eigen-3.4.0                |       h1c7c39f_0         1.0 MB  conda-forge
    expat-2.5.0                |       hf0c8a7f_1         118 KB  conda-forge
    fenics-2019.1.0            | py311h1768d6d_39          24 KB  conda-forge
    fenics-dijitso-2019.1.0    |    pyhd8ed1ab_39          41 KB  conda-forge
    fenics-dolfin-2019.1.0     | py311he8092e6_39         1.0 MB  conda-forge
    fenics-ffc-2019.1.0        |    pyhd8ed1ab_39         238 KB  conda-forge
    fenics-fiat-2019.1.0       |    pyhd8ed1ab_39          75 KB  conda-forge
    fenics-libdolfin-2019.1.0  |      h01bef3c_39         2.0 MB  conda-forge
    fenics-ufl-2019.1.0        | py311h6eed73b_38         456 KB  conda-forge
    fftw-3.3.10                |mpi_mpich_h4a8b384_7         1.8 MB  conda-forge
    fltk-1.3.8                 |       h299f19b_2         1.2 MB  conda-forge
    font-ttf-dejavu-sans-mono-2.37|       hab24e00_0         388 KB  conda-forge
    font-ttf-inconsolata-3.000 |       h77eed37_0          94 KB  conda-forge
    font-ttf-source-code-pro-2.038|       h77eed37_0         684 KB  conda-forge
    font-ttf-ubuntu-0.83       |       h77eed37_1         1.5 MB  conda-forge
    fontconfig-2.14.2          |       h5bb23bf_0         232 KB  conda-forge
    fonts-conda-ecosystem-1    |                0           4 KB  conda-forge
    fonts-conda-forge-1        |                0           4 KB  conda-forge
    fonttools-4.49.0           |  py311he705e18_0         2.6 MB  conda-forge
    freeimage-3.18.0           |      h29db62a_17         411 KB  conda-forge
    freetype-2.12.1            |       h60636b9_2         585 KB  conda-forge
    gettext-0.21.1             |       h8a4c099_0         4.0 MB  conda-forge
    gmp-6.3.0                  |       h93d8f39_0         509 KB  conda-forge
    gmpy2-2.1.2                |  py311hc5b4402_1         166 KB  conda-forge
    gmsh-4.11.1                |       h92d8eba_5        11.1 MB  conda-forge
    h5py-3.8.0                 |nompi_py311h777de7a_100         1.0 MB  conda-forge
    hdf4-4.2.15                |       h9804679_6         708 KB  conda-forge
    hdf5-1.12.2                |mpi_mpich_hc154f39_0         3.9 MB  conda-forge
    hypre-2.27.0               |mpi_mpich_h5eb2ec2_0         1.8 MB  conda-forge
    icu-73.2                   |       hf5e326d_0        11.2 MB  conda-forge
    imath-3.1.9                |       h7d26f99_0         152 KB  conda-forge
    importlib-metadata-7.0.1   |     pyha770c72_0          26 KB  conda-forge
    importlib_metadata-7.0.1   |       hd8ed1ab_0           9 KB  conda-forge
    jxrlib-1.1                 |       h10d778d_3         215 KB  conda-forge
    kiwisolver-1.4.5           |  py311h5fe6e05_1          59 KB  conda-forge
    krb5-1.21.2                |       hb884880_0         1.1 MB  conda-forge
    lcms2-2.15                 |       ha53face_2         220 KB  conda-forge
    lerc-4.0.0                 |       hb486fe8_0         284 KB  conda-forge
    libblas-3.9.0              |21_osx64_openblas          14 KB  conda-forge
    libboost-1.82.0            |       h99d8d82_6         1.9 MB  conda-forge
    libboost-headers-1.84.0    |       h694c41f_1        13.2 MB  conda-forge
    libbrotlicommon-1.1.0      |       h0dc2134_1          66 KB  conda-forge
    libbrotlidec-1.1.0         |       h0dc2134_1          30 KB  conda-forge
    libbrotlienc-1.1.0         |       h0dc2134_1         292 KB  conda-forge
    libcblas-3.9.0             |21_osx64_openblas          14 KB  conda-forge
    libcbor-0.10.2             |       hf0c8a7f_0          35 KB  conda-forge
    libcurl-8.5.0              |       h726d00d_0         359 KB  conda-forge
    libcxx-16.0.6              |       hd57cbcb_0         1.1 MB  conda-forge
    libdeflate-1.19            |       ha4e1b8e_0          67 KB  conda-forge
    libedit-3.1.20191231       |       h0678c8f_2         103 KB  conda-forge
    libev-4.33                 |       h10d778d_2         104 KB  conda-forge
    libexpat-2.5.0             |       hf0c8a7f_1          68 KB  conda-forge
    libffi-3.4.2               |       h0d85af4_5          50 KB  conda-forge
    libfido2-1.14.0            |       h3cbcf74_0         261 KB  conda-forge
    libgfortran-5.0.0          |13_2_0_h97931a8_3         108 KB  conda-forge
    libgfortran5-13.2.0        |       h2873a65_3         1.5 MB  conda-forge
    libglib-2.78.4             |       hab64008_0         2.4 MB  conda-forge
    libhwloc-2.9.3             |default_h24e0189_1009         2.4 MB  conda-forge
    libiconv-1.17              |       hd75f5a5_2         651 KB  conda-forge
    libjpeg-turbo-2.1.5.1      |       h0dc2134_1         446 KB  conda-forge
    liblapack-3.9.0            |21_osx64_openblas          14 KB  conda-forge
    libnetcdf-4.9.1            |mpi_mpich_hbde6a2f_2         708 KB  conda-forge
    libnghttp2-1.58.0          |       h64cf6d3_1         586 KB  conda-forge
    libopenblas-0.3.26         |openmp_hfef2a42_0         5.8 MB  conda-forge
    libpng-1.6.42              |       h92b6c6a_0         263 KB  conda-forge
    libraw-0.21.1              |       h9804679_1         574 KB  conda-forge
    libsqlite-3.45.1           |       h92b6c6a_0         881 KB  conda-forge
    libssh2-1.11.0             |       hd019ec5_0         253 KB  conda-forge
    libtiff-4.6.0              |       haeeb97c_1         254 KB  conda-forge
    libuv-1.47.0               |       h67532ce_0         395 KB  conda-forge
    libwebp-base-1.3.2         |       h0dc2134_0         338 KB  conda-forge
    libxcb-1.15                |       hb7f2c08_0         306 KB  conda-forge
    libxml2-2.12.5             |       hc0ae0f7_0         605 KB  conda-forge
    libzip-1.10.1              |       hc158999_3         125 KB  conda-forge
    libzlib-1.2.13             |       h8a1eda9_5          58 KB  conda-forge
    llvm-openmp-17.0.6         |       hb6ac08f_0         293 KB  conda-forge
    markdown-it-py-3.0.0       |     pyhd8ed1ab_0          63 KB  conda-forge
    matplotlib-base-3.8.3      |  py311h6ff1f5f_0         7.4 MB  conda-forge
    mdurl-0.1.2                |     pyhd8ed1ab_0          14 KB  conda-forge
    meshio-5.3.5               |     pyhd8ed1ab_0         374 KB  conda-forge
    metis-5.1.0                |    he965462_1007         3.7 MB  conda-forge
    mpc-1.3.1                  |       h81bd1dd_0         107 KB  conda-forge
    mpfr-4.2.1                 |       h0c69b56_0         368 KB  conda-forge
    mpi-1.0                    |            mpich           4 KB  conda-forge
    mpi4py-3.1.4               |  py311hbdc7f45_0         535 KB  conda-forge
    mpich-4.0.3                |     hd33e60e_100         5.4 MB  conda-forge
    mpmath-1.3.0               |     pyhd8ed1ab_0         428 KB  conda-forge
    mumps-include-5.2.1        |      h694c41f_11          24 KB  conda-forge
    mumps-mpi-5.2.1            |      h690e093_11         3.2 MB  conda-forge
    munkres-1.1.4              |     pyh9f0ad1d_0          12 KB  conda-forge
    ncurses-6.4                |       h93d8f39_2         803 KB  conda-forge
    netcdf4-1.6.3              |nompi_py311he6f34b2_100         437 KB  conda-forge
    numpy-1.26.4               |  py311hc43a94b_0         7.2 MB  conda-forge
    occt-7.7.2                 |novtk_h0a0d97a_101        24.3 MB  conda-forge
    openexr-3.2.1              |       h747cbf1_0         1.3 MB  conda-forge
    openjpeg-2.5.0             |       ha4da562_3         328 KB  conda-forge
    openssh-9.6p1              |       h6dd4ff7_0         904 KB  conda-forge
    openssl-3.2.1              |       hd75f5a5_0         2.4 MB  conda-forge
    packaging-23.2             |     pyhd8ed1ab_0          48 KB  conda-forge
    parmetis-4.0.3             |    hb7fa8f8_1005         295 KB  conda-forge
    pcre2-10.42                |       h0ad2156_0         879 KB  conda-forge
    petsc-3.18.4               |real_h238465a_100         9.3 MB  conda-forge
    petsc4py-3.18.4            |real_h4c46328_100         1.0 MB  conda-forge
    pillow-10.0.1              |  py311hd5308a1_1        44.0 MB  conda-forge
    pip-24.0                   |     pyhd8ed1ab_0         1.3 MB  conda-forge
    pixman-0.43.2              |       h73e2aa4_0         317 KB  conda-forge
    pkg-config-0.29.2          |    ha3d46e9_1008         263 KB  conda-forge
    pkgconfig-1.5.5            |     pyhd8ed1ab_4          10 KB  conda-forge
    pthread-stubs-0.4          |    hc929b4f_1001           6 KB  conda-forge
    ptscotch-6.0.9             |       h4f3afa6_2         1.5 MB  conda-forge
    pybind11-2.11.1            |  py311h5fe6e05_2         184 KB  conda-forge
    pybind11-global-2.11.1     |  py311h5fe6e05_2         169 KB  conda-forge
    pygments-2.17.2            |     pyhd8ed1ab_0         840 KB  conda-forge
    pyparsing-3.1.1            |     pyhd8ed1ab_0          87 KB  conda-forge
    python-3.11.8              |h9f0c242_0_cpython        13.4 MB  conda-forge
    python-dateutil-2.8.2      |     pyhd8ed1ab_0         240 KB  conda-forge
    python_abi-3.11            |          4_cp311           6 KB  conda-forge
    rapidjson-1.1.0            |    hb1e8313_1002         104 KB  conda-forge
    readline-8.2               |       h9e318b2_1         250 KB  conda-forge
    rhash-1.4.4                |       h0dc2134_0         173 KB  conda-forge
    rich-13.7.0                |     pyhd8ed1ab_0         180 KB  conda-forge
    scalapack-2.2.0            |       hc746714_1         2.1 MB  conda-forge
    scotch-6.0.9               |       h3da7401_2         1.2 MB  conda-forge
    setuptools-69.1.0          |     pyhd8ed1ab_1         459 KB  conda-forge
    six-1.16.0                 |     pyh6c4a22f_0          14 KB  conda-forge
    slepc-3.18.2               |real_ha03fd1b_100         3.5 MB  conda-forge
    slepc4py-3.18.2            |real_h5730752_100         311 KB  conda-forge
    suitesparse-5.10.1         |       h4bf45ed_3         1.4 MB  conda-forge
    superlu-5.2.2              |       h1f0f902_0         330 KB  conda-forge
    superlu_dist-7.2.0         |       h4bb6bf2_0         1.1 MB  conda-forge
    sympy-1.12                 | pypyh9d50eac_103         4.1 MB  conda-forge
    tbb-2021.11.0              |       h7728843_1         169 KB  conda-forge
    tk-8.6.13                  |       h1abcd95_1         3.1 MB  conda-forge
    typing_extensions-4.9.0    |     pyha770c72_0          35 KB  conda-forge
    tzdata-2024a               |       h0c530f3_0         117 KB  conda-forge
    wheel-0.42.0               |     pyhd8ed1ab_0          56 KB  conda-forge
    xorg-fixesproto-5.0        |    h0d85af4_1002           9 KB  conda-forge
    xorg-kbproto-1.0.7         |    h35c211d_1002          27 KB  conda-forge
    xorg-libice-1.1.1          |       h0dc2134_0          48 KB  conda-forge
    xorg-libsm-1.2.4           |       h0dc2134_0          24 KB  conda-forge
    xorg-libx11-1.8.7          |       hbd0b022_0         760 KB  conda-forge
    xorg-libxau-1.0.11         |       h0dc2134_0          13 KB  conda-forge
    xorg-libxdmcp-1.1.3        |       h35c211d_0          17 KB  conda-forge
    xorg-libxext-1.3.4         |       hb7f2c08_2          42 KB  conda-forge
    xorg-libxfixes-5.0.3       |    h0d85af4_1004          15 KB  conda-forge
    xorg-libxrender-0.9.11     |       h0dc2134_0          28 KB  conda-forge
    xorg-renderproto-0.11.1    |    h0d85af4_1002           9 KB  conda-forge
    xorg-xextproto-7.3.0       |    hb7f2c08_1003          30 KB  conda-forge
    xorg-xproto-7.0.31         |    h35c211d_1007          73 KB  conda-forge
    xz-5.2.6                   |       h775f41a_0         233 KB  conda-forge
    yaml-0.2.5                 |       h0d85af4_2          82 KB  conda-forge
    zipp-3.17.0                |     pyhd8ed1ab_0          19 KB  conda-forge
    zlib-1.2.13                |       h8a1eda9_5          89 KB  conda-forge
    zstd-1.5.5                 |       h829000d_0         488 KB  conda-forge
    ------------------------------------------------------------

So cashocs 2.1.0 with PETSc 3.18 will be installed. Regarding conda update: I have found that for complex environments this is usually not working so well. For your fenicsproject environment, you could also just uninstall cashocs and reinstall it with pip, that should get you to the latest version, too.

AudreyDemafo commented 7 months ago

Thank you very much @sblauth . I was able to fix the problem by installing the python 3.11 version in the new environment that I created and the code works fine now. Thank you very much for your help on the issue.

sblauth commented 7 months ago

Okay, I'm glad to hear that. If you have any further issues, please let me know.