Try to import dolfin in python 2.7 - "No module named dolfin"

Asked by Tong on 2013-04-03

Hello, I'm very new to dolfin and FEniCS. I had a problem importing dolfin to python

I downloaded python 2.7 from python.org and installed it on my windows 7 machine. And I also downloaded the latest FEniCS installation packages for window 7 and installed it separately.

Now I opened my python 2.7 shell and try to import dolfin. ( type "from dolfin import *")

It appeared the error message saying that " No module named dolfin". However, if i use the FEniCS command shell and run a python program to import doflin, it works. The FEniCS seems to have everything installed itself separately from the python 2.7 that I previous installed. It looks that it has its own python and other extension installed. I try to add the sys search path for dolfin in python 2.7 but it didn't work. Or maybe I didn't do it correctly.

I installed ipython, numpy and matplotlib after I installed python 2.7 and they all worked well. I could import them directly in the ipython command shell. I wonder is there an easy way to import dolfin and use it in the python 2.7 command shell if they were installed separately?

Thanks.

Tong

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Tong
Solved:
2013-04-03
Last query:
2013-04-03
Last reply:
2013-04-03
Johannes Ring (johannr) said : #1

No, there is unfortunately no easy way to use DOLFIN on Windows with Python 2.7 because the Windows binary was built with Python 2.6.

Tong (newton0101) said : #2

Thanks, Johannes.

So does that mean I can't not import dolfin in Python 2.7 on Windows? My situation is that I need to write a script to solve pde with numpy, matplotlib, and dolfin. Should I use Python 2.6 instead? Or can I manually install dolfin on Windows with Python 2.7? I already installed numpy, matplotlib with Python 2.7 on my Windows machine and it works well.

I also have a mac machine and a Linux machine. Will that be easier to install doflin along with ipython, numpy, and matplotlib on a different os other than Windows?

Tong (newton0101) said : #3

Finally I got it installed on my mac machine and ubuntu machine. I used MacPort to install python and then use dorsal to install Fenics. Everything works well. I can use dolfin module in ipython. On Ubuntu, the installation is even simpler.

I just couldn't figure it out how to make it work on Windows.