Unable to import Viper
After upgrading to dolfin 0.9.7 plotting doesn't work.
>>> from dolfin import *
No module named vtk
*** Warning: Unable to import Viper, plotting disabled.
>>>
>>>
>>> import viper
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/
from viper import *
File "/Users/
import vtk, numpy, os, math
ImportError: No module named vtk
I have tried to reinstall vtk via macports but the problem remains.
Aron
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Aron Wahlberg
- Solved:
- Last query:
- Last reply:
Related FAQ:
None Link to a FAQ
Revision history for this message
|
#1 |
I still have the same problem.
I have reinstalled vtk:
sudo port uninstall vtk-devel
sudo port install vtk-devel +py26
and the rebuilt dolfin with dorsal.
I can't see why there is a problem now. Everything worked with my former version of dolfin (0.9.5).
Can I test vtk my installation of vtk in some other way? I get no warnings or anything while building it.
What file is being looked for when i type import vtk in a python shell? Can I somehow point this file out for my computer.
Anyone?
Revision history for this message
|
#2 |
I'm also struggling with a Mac. Not with VTK though, but with MPI. Anyway, try to start Python and import VTK:
fenicsslave2@
Python 2.6.4 (r264:75706, Feb 19 2010, 17:57:28)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> vtk.__file__
'/opt/
>>>
I'm using VTK from MacPorts and it works for me.
Revision history for this message
|
#3 |
VTK also comes with a lot of examples. For instance you can try this:
python /opt/local/
Does this work for you? It doesn't seem like your problem has anything to do with DOLFIN.
Revision history for this message
|
#4 |
Well, 'import vtk' just gives me the same old 'no module named vtk'.
However I did a 'locate vtk/__init__.pyc' which only gave me a reference to my Paraview directory.
In /opt/local/
Running 'python /opt/local/
Appreciate your efforts!
Aron
Revision history for this message
|
#5 |
What do you get from running this command:
port contents vtk-devel | grep site-packages
?
Here is my output:
fenicsslave2@
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
/opt/
fenicsslave2@
Revision history for this message
|
#6 |
I get nothing if I run that command. I have no directory /opt/local/
Revision history for this message
|
#7 |
Yes, it seems to be something wrong with your VTK installation. You should try to reinstall like you did above but this time try to clean the build directory before installing:
sudo port uninstall vtk-devel
sudo port clean --all vtk-devel
sudo port -v install vtk-devel +py26
Look for anything suspicious in the output.
Revision history for this message
|
#8 |
I discovered that I had two port pythons of which only one was active. I uninstalled the older inactive port version of python. Then I did exactly what you suggest below, Johannes. I can't find anything peculiar or suspicious in the output but I still get the same error. I did have a few "not found" though. I don't know how alarming that is? I have made sure about 100 times that I run the mac port python and not the MacOSX one.
Aron
On 4 Mar, 2010, at 18:14, Johannes Ring wrote:
> Your question #102151 on DOLFIN changed:
> https:/
>
> Johannes Ring posted a new comment:
> Yes, it seems to be something wrong with your VTK installation. You
> should try to reinstall like you did above but this time try to clean
> the build directory before installing:
>
> sudo port uninstall vtk-devel
> sudo port clean --all vtk-devel
> sudo port -v install vtk-devel +py26
>
> Look for anything suspicious in the output.
>
Revision history for this message
|
#9 |
Do I have to manually put vtk on the pythonpath? In that case, what file/directory should go there?
Aron
On 4 Mar, 2010, at 18:14, Johannes Ring wrote:
> Your question #102151 on DOLFIN changed:
> https:/
>
> Johannes Ring posted a new comment:
> Yes, it seems to be something wrong with your VTK installation. You
> should try to reinstall like you did above but this time try to clean
> the build directory before installing:
>
> sudo port uninstall vtk-devel
> sudo port clean --all vtk-devel
> sudo port -v install vtk-devel +py26
>
> Look for anything suspicious in the output.
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
Revision history for this message
|
#10 |
This problem is now solved. Instead of installing vtk-devel +py26 I installed vtk-devel + python26. I have no idea about the differences but it worked for me.
sudo port install vtk-devel +python26
was the magic key.
Aron
Revision history for this message
|
#11 |
Thanks for pointing this out, I have made the change in the installation notes.
At some point, what was +py26 has become +python26. And for something like this in the future, you can do 'port variants package-name'