Import mshr error

The following code

from fenics import *
# import numpy as np
# import matplotlib.pyplot as plt
from mshr import *

gives error

File ~/anaconda3/envs/py38/lib/python3.8/site-packages/mshr/__init__.py:24
      4 # Copyright (C) 2017 Benjamin Kehlet
      5 
      6 # This file is part of mshr.
   (...)
     19 # along with mshr.  If not, see <http:#www.gnu.org/licenses/>.
     20 #
     22 import dolfin
---> 24 from .cpp import Circle
     25 from .cpp import Ellipse
     26 from .cpp import Rectangle

ImportError: generic_type: type "CSGGeometry" referenced unknown base type "dolfin::Variable"

I have installed mshr and fenics, the result of “conda list mshr” is

Name Version Build Channel

mshr 2019.1.0 py38hd39c085_7 conda-forge

I have saw the topic

But it seems cannot well resolve the problem.

For me mshr does not work locally either. However, it works in Google Colab. One workaround would thus be to create the mesh in Google Colab, save it to file and load the mesh file locally on your own device. Nevertheless, as explained in this forum post mshr is no longer maintained and it is better to use some other software. Besides my quick and dirty workaround, I also use pygmsh and in my opinion this yields much more optimized meshes than mshr for complex geometries.

Thanks! I will try pygmsh