Assertion error on Poisson problem with complex option

In testing the complex number option on FEniCSx, I got an assertion error.
%python3 CmplxPoisson.py
float64
complex128
<class ‘numpy.float64’>****THIS IS SUPPOSED TO BE <class ‘numpy.complex128’>
Traceback (most recent call last):
File “/Users/carlajadamson/Documents/CmplxPoisson.py”, line 16, in
assert np.dtype(PETSc.ScalarType).kind == ‘c’
AssertionError

I assume this means that I did not get the correct version of PETSc downloaded when I downloaded FEniCSx from this site: https://fenicsproject.org/download/. Is there an update I missed?

I am on MAC Book running Apple M3 Max.

See: Conda install dolfinx for complex-valued problem - #4 by dokken

The output was

no matches found: petsc==complex

This is what was downloaded from FEniCSx

petsc conda-forge/osx-arm64::petsc-3.20.5-real_h7646cce_100
petsc4py conda-forge/osx-arm64::petsc4py-3.20.5-real_hd567e68_100

Please provide the full command that you were running, and the full output (not just the last line of the error message).

conda create -n env3-10-complex -c conda-forge python=3.10 fenics-dolfinx petsc=*=complex* mpich
zsh: no matches found: petsc==complex

I cannot reproduce this on my linux system. @minrk do you know why this isn’t working on osx-arm64?

zsh (not mac-specific, but it is the default shell on macs) expands globs a little differently from bash, you need to put strings with * that aren’t file globs in quotes to prevent glob expansion:

conda create -n env3-10-complex -c conda-forge python=3.10 fenics-dolfinx 'petsc=*=complex*' mpich

bash has weird but useful glob expansion behavior where if a glob doesn’t match anything it’s replaced by the original pattern, effectively assuming you didn’t mean it as a glob, whereas zsh always treats globs as globs and tells you when they don’t match anything.

2 Likes

used yours and got the complex download:
petsc conda-forge/osx-arm64::petsc-3.20.5-complex_h8e9ca2b_0
petsc4py conda-forge/osx-arm64::petsc4py-3.20.5-complex_h1f0f144_0
However, when I run the program:
python3 CmplxPoisson.py
float64
complex128
<class ‘numpy.float64’>
Traceback (most recent call last):
File “/Users/carlajadamson/Documents/CmplxPoisson.py”, line 16, in
assert np.dtype(PETSc.ScalarType).kind == ‘c’
AssertionError

should I put * in somewhere in code?

Please provide the output of conda env export

Never mind! I was so excited at a solution to my problem, I forgot to activate the environment!

Thank you!

1 Like