Fresh virtual environment installation GCC error Ubuntu 24.04

I have installed latest Anaconda on Ubuntu 24.04 and created new virtual environment as the ‘easiest’ method suggests :

conda create -n fenicsx-env
conda activate fenicsx-env
conda install -c conda-forge fenics-dolfinx mpich pyvista

Running some example code i get that error:

VerificationError: CompileError: command '/home/sergek/anaconda3/envs/fenics/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

The message begins with

In file included from libffcx_forms_9053c7f4a9fc3caca6c4629215e348ca79deda8a.c:50:
/usr/include/python3.12/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.12/pyconfig.h: No such file or directory
    3 | #  include <x86_64-linux-gnu/python3.12/pyconfig.h>
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

I have tried installing it on base, but environment wasn’t able to resolve and died eating all my RAM.

Update. Running the code example in Spyder from root is successful. How can I make it work from the fenics-env? Seems like some root rights are needed. Thanks!

Do you here imply that you got your error when not using “root” when running inside the IDE of Spyder? What happens if you activate your conda environment on commandline?
Have you installed spyder-kernels?

I am. I first activated the fenics-env in terminal and launched Spyder from there.
Later I opened the second terminal, accessed root and launched the second instance of Spyder. After that, all Spyder instances (root, base or fenics-env) managed to run the example code without errors. So the issue resolved itself, i guess.
I have not checked if spyder-kernels are installed, but i think it is. (I’ll check)
However, Spyder couldn’t locate pyvistaqt running other example, even though it is installed within the environment, but that is other story.