I have Anaconda installed in Ubuntu (followed the instructions on the Anaconda site: https://docs.anaconda.com/free/anaconda/install/linux/) and I am trying to import the fenics module in Spyder. While I am able to import fenics from the terminal, I am not able to do so on Spyder (opened from the same environment) or IPython.
I have the environment named fenicsproject created with a fenics installation and activated in Anaconda:
conda create -n fenicsproject -c conda-forge fenics
source activate fenicsproject
I am able to import fenics if I type python
in the terminal while in the fenicsproject environment.
Python 3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 18:08:17) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or license for more information.
>>> import fenics
However, when I type
spyder
while also in the fenicsproject environment, to open the Spyder IDE, it seems to open a different environment where fenics is not installed. Running the command
import fenics
from either the console or editor results in the
No module named 'fenics'
error. The console in the Spyder IDE shows the header text
Python 3.11.4 (main, Jul 5 2023, 14:15:25) [GCC 11.2.0]
Type "copyright", "credits" or "license" for more information.
IPython 8.12.0 -- An enhanced Interactive Python
Notice that the GCC version is different in the Spyder console than the terminal.
Conda info: conda version: 23.7.2 conda-build version: 3.26.0 python version: 3.11.4.final.0