我正在尝试在我的计算机上安装 MayaVi。我使用的是配备 OS X 10.6.8、4 GB RAM 的 MacBook Air。
我的 python 和大部分堆栈都是通过 Homebrew 或 pip 构建的。特别是对于 python2.7、ipython、Qt4、numpy、scipy、vtk 等来说更是如此。VTK 在 Homebrew 中使用 --python 和 --qt-extern 标志安装,并且所有构建都很好。我没有安装 wxPython,因为我无法通过 pip、手动构建或二进制文件让它工作。
如果我运行 ipython -q4thread
,我无法成功执行 from mayavi import mlab
,因为我收到与使用 PyQt 的两个不同 API 相关的错误:http://groups.google.com/group/spyderlib/browse_thread/thread/36a35baec74ca144
但是,如果我单独运行 ipython
,我可以成功运行 从 Mayavi 导入 mlab
。然后我尝试遵循以下示例: http://github.enthought.com/mayavi/mayavi /example_using_with_scipy.html,其中包括以下命令:
import numpy as np
def V(x, y, z):
""" A 3D sinusoidal lattice with a parabolic confinement. """
return np.cos(10*x) + np.cos(10*y) + np.cos(10*z) + 2*(x**2 + y**2 + z**2)
X, Y, Z = np.mgrid[-2:2:100j, -2:2:100j, -2:2:100j]
from mayavi import mlab
mlab.contour3d(X, Y, Z, V)
这一切都正常,我会弹出一个窗口,我可以旋转 3d 绘图等。但是,然后我单击该图标打开管道,这会打开另一个窗口。然后教程说双击“等值面”来更改其属性。一旦我这样做,我就会得到一个可重现的分段错误。
我不知道如何开始找出问题所在。
或者,我可以从命令行运行 MayaVi:mayavi2
,然后会弹出 GUI。当我这样做时,我得到以下输出:
Warning: Unable to import the wx backend for pyface due to traceback: Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/pyface/toolkit.py", line 45, in _init_toolkit
be = import_toolkit(tk)
File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/pyface/toolkit.py", line 31, in import_toolkit
__import__(be + 'init')
File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/pyface/ui/wx/init.py", line 14, in <module>
import wx
ImportError: No module named wx
尽管确实弹出了 GUI,但如果我尝试执行任何操作,则会出现段错误。
如果您对解决此问题有任何想法,或者对成功重新安装软件包有任何指导,请告诉我。
谢谢!
乌里
I am trying to install MayaVi on my computer. I'm on a MacBook Air with OS X 10.6.8, 4 GB RAM.
My python and most of my stack is built through Homebrew or pip. In particular this is true for python2.7, ipython, Qt4, numpy, scipy, vtk, etc. VTK was installed with --python and --qt-extern flags in Homebrew, and all the builds were fine. I do not have wxPython installed, as I failed to get it working through pip, manual building, or the binaries.
If I run ipython -q4thread
, I cannot successfully execute from mayavi import mlab
as I get an error related to usage of two different APIs for PyQt: http://groups.google.com/group/spyderlib/browse_thread/thread/36a35baec74ca144
However, if I run ipython
alone, I can successfully run from mayavi import mlab
. Then I try to follow this example: http://github.enthought.com/mayavi/mayavi/example_using_with_scipy.html, which includes these commands:
import numpy as np
def V(x, y, z):
""" A 3D sinusoidal lattice with a parabolic confinement. """
return np.cos(10*x) + np.cos(10*y) + np.cos(10*z) + 2*(x**2 + y**2 + z**2)
X, Y, Z = np.mgrid[-2:2:100j, -2:2:100j, -2:2:100j]
from mayavi import mlab
mlab.contour3d(X, Y, Z, V)
This all works fine, and I get a window that pops up and I can rotate the 3d plot etc. However, then I click on the icon to open up the pipeline, which opens another window. The tutorial then says to double-click on the "isosurface" to change its properties. As soon as I do that, I get a reproducible segmentation fault.
I have no idea how to begin to figure out what the problem is.
Alternatively, I can run MayaVi from the command line: mayavi2
, and the GUI pops up. When I do so I get the following output:
Warning: Unable to import the wx backend for pyface due to traceback: Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/pyface/toolkit.py", line 45, in _init_toolkit
be = import_toolkit(tk)
File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/pyface/toolkit.py", line 31, in import_toolkit
__import__(be + 'init')
File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/pyface/ui/wx/init.py", line 14, in <module>
import wx
ImportError: No module named wx
Although the GUI does pop up, if I try to do any operation, I get a segfault.
Please let me know if you have any thoughts on troubleshooting this, or perhaps guidance on reinstalling the package successfully.
Thanks!
Uri
我还有一台运行 OS X 10.7.4 (Lion) 的 MacBook Air。二月份我花了很多时间让 Mayavi 工作,最终成功地达到了可以制作科学绘图的程度。这仍然意味着一些示例和测试无法正确运行,并且 GUI 在控制台中生成了大量错误消息,但没有崩溃(大多数情况下)。现在,我设法破坏了我的 Python 安装(可能是通过升级 numpy),所以我需要重新安装。唉,六个月后事情并没有变得更容易!
仍然没有可行的预编译选项。我从这里尝试了 Enthought Python 发行版: http://www.enthought.com/repo/.epd_academic_installers< /a>. Mac 上的 ETS 仍然没有 64 位版本,组件很古老,基于 wxPython 的 Mayavi 看起来很丑,感觉很慢而且反应迟钝。回到
brew
和pip
。经过大量的试验和错误,以下是或多或少有效的方法:1. 先决条件
隐藏/卸载损坏的 Homebrew Python 安装:
从 Xcode (4.4.1) 中,选择
llvm-gcc
作为编译器(我用clang
不太成功):2. 安装
2.1 Python
指向新安装:
如果安装了 EPD,则需要在
/Library/Frameworks/Python.framework/Versions
,否则 EPD 将优先。2.2 Numpy
从源代码安装 numpy (
pip
1.2 目前无法正确安装npymath.ini
,这将导致 scipy 无法构建):由于有如此多的包链接到 numpy,我强烈建议您查看今天发布的正式版本 1.6.2。接下来使 numpy 标头可见:
2.3 qt、pyqt、vtk
安装 qt (4.8.2) 和 pyqt (4.9.4):
也可以安装 pyside (1.1.1),
但这似乎会产生更多崩溃 与 Mayavi。无论如何,请附加
到
.bashrc
以避免任何混淆。接下来安装 vtk(5.10.0;5.8.0 也可以)...然后等待(编译大约需要 40 分钟)。
--qt
标志并不是绝对必要的,但也没有什么坏处。接下来,从 http://www.vtk 下载 vtk 数据.org/files/release/5.10/vtkdata-5.10.0.tar.gz,在某处解压并获得
VTK_DATA_ROOT
环境变量指向VTKData
目录。 启动 TCL 示例中的一些示例使用
python.py
启动 python 示例和使用vtk
。工作起来绝对漂亮,对吧?那么接下来让我们看看 Mayavi 如何把这一切搞砸了...2.4 ETS 和 Mayavi
虽然
可以让您有所收获,但它似乎比从 github 安装前沿技术会产生更多的崩溃。获取 https://github.com/enthought/ets/raw/master/ets。 py 并运行
以克隆 ETS git 存储库。您只需要
apptools
、mayavi
、pyface
、traits
和traitsui
,可能 < code>envisage 如果您想从命令行运行mayavi2
。因此,删除其他目录并执行此操作应该允许您通过运行.py 并使用 GUI 进行操作。有很多控制台错误和很多 GUI 功能不起作用,例如选择 LUT 表。但希望它不会崩溃。
mayavi/examples/tvtk
和mayavi/examples/mayavi
来运行存储库中的一些示例>python2.5 scipy、matplotlib、ipython
我更喜欢从 github 获取 scipy 和 matplotlib 的最新技术。首先使用
brew
安装所有依赖项。然后使用
pip
安装ipython (0.13)。首先安装 qtconsole:然后
有几种可能的方法来启动 ipython 与 mayavi 一起使用,具体取决于谁控制 QT 事件循环:
ipython
withoutmlab.show()
:挂起。ipython
与mlab.show()
:可以工作,但提示可能会变得无响应。ipython --gui=qt
或ipython --pylab=qt
:可以工作,但“保存”对话框会立即关闭。mlab.show()
的ipython qtconsole
:挂起。ipython qtconsole
与mlab.show()
:有效。ipython qtconsole --gui=qt
或ipython qtconsole --pylab=qt
:有效。祝你好运!
I also have a MacBook Air with OS X 10.7.4 (Lion). I spent a lot of time back in February to get mayavi working, eventually succeeding to a point where I could produce scientific plots. That still means that some of the examples and tests wouldn't run correctly, and the GUI produced lots of error messages in the console, but didn't crash (most of the time). Now, I managed to break my Python installation (probably by upgrading numpy), so I needed to reinstall. Alas, it didn't get any easier 6 months later!
There is still no viable precompiled option. I tried the Enthought Python Distribution from here: http://www.enthought.com/repo/.epd_academic_installers. Still no 64 bit version with ETS for Mac, components are ancient, mayavi based on wxPython looks ugly and feels slow and unresponsive. So back to
brew
andpip
. After a lot of trial and error, here is what worked more or less:1. Prerequisites
Hide/uninstall the broken Homebrew Python installation:
From Xcode (4.4.1), choose
llvm-gcc
as the compiler (I had less success withclang
):2. Installation
2.1 Python
Point to the new installation:
If the EPD is installed, one needs to do the same in
/Library/Frameworks/Python.framework/Versions
, otherwise the EPD will take priority.2.2 Numpy
Install numpy from source (
pip
1.2 currently doesn't installnpymath.ini
correctly, which will make scipy fail to build):Since so many packages link against numpy, I really recommend checking out an official release, 1.6.2 as of today. Next make the numpy headers visible:
2.3 qt, pyqt, vtk
Install qt (4.8.2) and pyqt (4.9.4):
One can also install pyside (1.1.1)
but this appears to produce more crashes with mayavi. In any case, append
to
.bashrc
to avoid any mixups. Next install vtk (5.10.0; 5.8.0 works just as well)...and wait (compilation takes around 40 minutes). The
--qt
flag isn't strictly necessary, but it doesn't harm either.Next, download vtk data from http://www.vtk.org/files/release/5.10/vtkdata-5.10.0.tar.gz, unpack somewhere and have the
VTK_DATA_ROOT
environment variable point to theVTKData
directory. Run some examples inLaunch python examples with
python <example>.py
and TCL examples withvtk <example.tcl>
. Works absolutely beautifully, right? So let's see how mayavi messes it all up next...2.4 ETS and mayavi
Although
gets you somewhere, it appears to produce more crashes than installing the bleeding edge from github. Get https://github.com/enthought/ets/raw/master/ets.py and run
to clone the ETS git repository. You only need
apptools
,mayavi
,pyface
,traits
andtraitsui
, possiblyenvisage
if you want to runmayavi2
from the command line. So delete the other directories and doThis should allow you to run some of the examples in the repository in
mayavi/examples/tvtk
andmayavi/examples/mayavi
by runningpython <example>.py
and play around with the GUI. There are lots of console errors and lots of GUI features that don't work, like selecting a LUT table. But it hopefully doesn't crash.2.5 scipy, matplotlib, ipython
I prefer to get the bleeding edge from github for scipy and matplotlib. First install all dependencies using
brew
. ThenThen install ipython (0.13) using
pip
. For the qtconsole install first:then
There are a few possible ways to launch ipython for use with mayavi, depending on who controls the QT event loop:
ipython
withoutmlab.show()
: Hangs.ipython
withmlab.show()
: Works, but prompt may become unresponsive.ipython --gui=qt
oripython --pylab=qt
: Works, but "Save" dialog closes immediately.ipython qtconsole
withoutmlab.show()
: Hangs.ipython qtconsole
withmlab.show()
: Works.ipython qtconsole --gui=qt
oripython qtconsole --pylab=qt
: Works.Good luck!