Fenics 2019.1.0 cannot acess C++ source

I have tried a numbers of dolfin scripts and all throw an error when the run hit a line-code with V = FunctionSpace (mesh,‘Lagrange’, 1) produces Error: ‘no attribute _cpp object’

Furthermore, the call to DirichletBC (V, u0, u0_boundary) produces Error: ‘no attribute _ufl_element’`.

I think I have not managed to include this C++ or something else, while I was building Fenics. The problem always happen while constructed variable V.

I am able to solve Python matrices code on Spyder that call C++. Nevertheless, Fenics can not access this source.

I will appreciate it, someone could tell me what to do. Thanks

We would need a minimal example that can reproduce the error.
Right now, it is not clear what the issue is, as you have not shown

  1. Your imports
  2. how you define your mesh

It is also unclear how you get to the next line when the code throws an error further up.

Just a few hours ago I resolved similar problem I had encountered on my Docker image (i.e. Fenics crash on FunctionSpace calling). This thread helped me:
https://fenicsproject.discourse.group/t/error-running-demo-code/290
Basically what I did was:
apt-get -y install build-essential

Thank. I was so distress that I remove FEniCS from Ubuntu PPA fully and Load Anaconda and followed the instruction given by fenicsproject. Simply something was wrong with FEniCS software for Ubuntu. The most simply examples of FEniCS (dolfin) in any elementary textbook did not run on a python terminal and Spyder IDE. Presently, I run the following code on an environment:

/home/juan/anaconda3/envs/fenicsproject

I managed to run at least (python terminal) the following code without any wrong message: import dolfin, mesh = UnitSquareMesh (32,32), V = FunctionSpace (mesh, ‘Lagrange’, 1), u0 = Constant (0.0), bc = DirichletBC(V, u0, ‘on_boundary’), u = TrialFunction(V), v =TestFunction(V), and so on.

However, Anaconda, Spyder IDE still does not run FEniCS code. The environment for Spyder is

/home/juan/anaconda3/bin/python

The PATH seems to be the main cause of Spyder not running FEniCS code. I need help here as how to do it.

I am very sorry, about your time dedicated to the previous problem, but I hope you will continue supporting me in this new query.

See the previous post that I replied to for you: FEniCS 2019.1.0 in Ubuntu 2020.04

Thank.

If you are working on a Docker surely you will not witnesses the problem some users of FEniCS have, specially using Spyder IDE (on Ubuntu) to run FEniCS code. So far, appears, no one has a firm and proper way to solve this problem of having difficulties running FEniCS code on Spyder. I will use your instruction to see what happen. I did not have any problem by activating an environment named home/juan/anaconda3/envs/fenicsproject. FEniCS seems to work just fine using a python terminal. However, still Spyder (environment: /home/juan/anaconda3/bin/python). Both are different. How can I do to make both to talk each other.

Hello, The system responds 'build-essential is already the newest version (12.8ubuntu1). Thank for your time.

As i said above, you should change your spyder Python path: https://stackoverflow.com/questions/11919615/how-to-change-the-path-of-python-in-spyder

The link you offer to solve the problems of Spyder ‘not working with Fenics’ code is relatively outdated and not of help. I have already solved the problem after reading the following link: https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-20-04. On this link instruction are given to create new environments that were helpful for the task I was pursuing. So I created two extra environments that can be activated, i.e fenics and fenicsproject. These environment point to fenics and projectfenics that were downloaded previously.

$conda info --envs, gives me information about the paths of these new creations. I tried all. The one that works after activation was:

fenics ---- /home/juan/anaconda3/envs/fenics/bin/python

Spyder menu did not provide any useful path, it only provides the “base” which is (base) /home/juan/anaconda3, which work fine with python but not with fenics.The environment that works is /home/juan/anaconda3/envs/fenics/bin/python. Spyder was launched from this environment and bingo, it works. The default terminal starts with (base) juan@ubuntu , this has to be changed to the environment previous activation to (fenics) by using

$ conda activate fenics, and gave

(fenics) juan@ubuntu

I hope this explanation may help to many that are still straggling with Spyder and FEniCS.