Mayavi: 使用 pip 安装 Mayavi 时出现问题 - 没有名为 vtk 的模块

创建于 2012-08-29  ·  5评论  ·  资料来源: enthought/mayavi

我想使用 Mayavi。

情况

  • 我使用装有 OSX 10.7.3 的 MacBook Air。
  • 我使用 pyhton 2.7.2
  • 我安装了virtualenv 。 但是我没有在这个安装中使用它。

我已经手动安装了它的所有依赖项,包括VTK

对于VTK ,我按照它的安装指南安装了 python 包装器。

现在,如果我打开一个新的终端窗口并打开 python,我可以毫无错误地导入vtk

问题

我尝试使用以下命令安装 Mayavi:

pip install mayavi

但是出现以下错误:

Downloading/unpacking mayavi
  Running setup.py egg_info for package mayavi
    build_src
    building extension "tvtk.array_ext" sources
    building data_files sources
    build_src: building npy-pkg config files

    no previously-included directories found matching 'artwork'
    no previously-included directories found matching 'docs/pdf'
Requirement already satisfied (use --upgrade to upgrade): apptools in /Library/Python/2.7/site-packages (from mayavi)
Requirement already satisfied (use --upgrade to upgrade): traits in /Library/Python/2.7/site-packages (from mayavi)
Requirement already satisfied (use --upgrade to upgrade): traitsui in /Library/Python/2.7/site-packages (from mayavi)
Requirement already satisfied (use --upgrade to upgrade): configobj in /Library/Python/2.7/site-packages (from apptools->mayavi)
Requirement already satisfied (use --upgrade to upgrade): pyface in /Library/Python/2.7/site-packages (from traitsui->mayavi)
Installing collected packages: mayavi
  Running setup.py install for mayavi
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/Yasser/build/mayavi/setup.py", line 498, in <module>
        **config
      File "/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/core.py", line 186, in setup
        return old_setup(**new_attr)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/command/install.py", line 57, in run
        r = self.setuptools_run()
      File "/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/command/install.py", line 31, in setuptools_run
        return old_install_mod._install.run(self)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 573, in run
        self.run_command('build')
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/Users/Yasser/build/mayavi/setup.py", line 303, in run
        build_tvtk_classes_zip()
      File "/Users/Yasser/build/mayavi/setup.py", line 290, in build_tvtk_classes_zip
        gen_tvtk_classes_zip()
      File "tvtk/setup.py", line 46, in gen_tvtk_classes_zip
        from code_gen import TVTKGenerator
      File "tvtk/code_gen.py", line 10, in <module>
        import vtk
    ImportError: No module named vtk
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/Users/Yasser/build/mayavi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/53/_trhc_0x0fb6kvx6bw_wrk500000gn/T/pip-Z4hpsW-record/install-record.txt:
    running install

running build

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/Users/Yasser/build/mayavi/setup.py", line 498, in <module>

    **config

  File "/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/core.py", line 186, in setup

    return old_setup(**new_attr)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands

    self.run_command(cmd)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/command/install.py", line 57, in run

    r = self.setuptools_run()

  File "/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/command/install.py", line 31, in setuptools_run

    return old_install_mod._install.run(self)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 573, in run

    self.run_command('build')

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command

    self.distribution.run_command(command)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command

    cmd_obj.run()

  File "/Users/Yasser/build/mayavi/setup.py", line 303, in run

    build_tvtk_classes_zip()

  File "/Users/Yasser/build/mayavi/setup.py", line 290, in build_tvtk_classes_zip

    gen_tvtk_classes_zip()

  File "tvtk/setup.py", line 46, in gen_tvtk_classes_zip

    from code_gen import TVTKGenerator

  File "tvtk/code_gen.py", line 10, in <module>

    import vtk

ImportError: No module named vtk

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/Users/Yasser/build/mayavi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/53/_trhc_0x0fb6kvx6bw_wrk500000gn/T/pip-Z4hpsW-record/install-record.txt failed with error code 1 in /Users/Yasser/build/mayavi
Storing complete log in /Users/Yasser/Library/Logs/pip.log
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 8, in <module>
    load_entry_point('pip==1.1', 'console_scripts', 'pip')()
  File "/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 116, in main
    return command.main(args[1:], options)
  File "/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 141, in main
    log_fp = open_logfile(log_fn, 'w')
  File "/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 168, in open_logfile
    log_fp = open(filename, mode)
IOError: [Errno 13] Permission denied: '/Users/Yasser/Library/Logs/pip.log'

我认为问题在于vtk

谁能帮我?

其他详情

运行sudo pip install mayavi并不能解决问题。

我认为这可能会有所帮助

› which python
/usr/local/bin/python

› python
Python 2.7.2 (default, Feb 17 2012, 13:57:55) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> vtk
<module 'vtk' from '/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/VTK-5.10.0-py2.7.egg/vtk/__init__.pyc'>
>>> 

我的PYTHONPATH是空的。

所有5条评论

嗨,亚瑟,

pip 使用的 Python 好像不能导入 vtk。 你检查过
你可以成功导入 vtk,但也许你有不同的 Python
可执行文件安装和 pip 使用的是不同的
您可以导入 vtk。 看看你的回溯,那个 pip 的 Python
使用的是/usr/bin/python。

哈,

盖尔

在 2012 年 8 月 29 日星期三上午 10:40:26 -0700,Yasser Souri 写道:

我想使用 Mayavi。

情况

• 我使用装有 OSX 10.7.3 的 MacBook Air。
• 我使用 pyhton 2.7.2
• 我安装了virtualenv。 但是我没有在这个安装中使用它。

我已经手动安装了它的所有依赖项,包括 VTK。

对于 VTK,我按照它的安装指南安装了 python 包装器。

现在,如果我打开一个新的终端窗口并打开 python,我可以在没有
任何错误。

问题

我尝试使用以下命令安装 Mayavi:

pip 安装 mayavi

但是出现以下错误:

下载/解压 mayavi
为 mayavi 包运行 setup.py egg_info
build_src
构建扩展“tvtk.array_ext”源
构建 data_files 源
build_src:构建 npy-pkg 配置文件

no previously-included directories found matching 'artwork'
no previously-included directories found matching 'docs/pdf'

要求已经满足(使用 --upgrade 升级):/Library/Python/2.7/site-packages 中的 apptools(来自 mayavi)
要求已经满足(使用 --upgrade 升级):traits in /Library/Python/2.7/site-packages(来自 mayavi)
要求已经满足(使用 --upgrade 升级): traitsui in /Library/Python/2.7/site-packages (来自 mayavi)
要求已经满足(使用 --upgrade 升级):/Library/Python/2.7/site-packages 中的 configobj(来自 apptools->mayavi)
需求已经满足(使用--upgrade升级):/Library/Python/2.7/site-packages中的pyface(来自traitsui->mayavi)
安装收集的软件包:mayavi
为 mayavi 运行 setup.py install
回溯(最近一次调用最后一次):
文件 ”",第 1 行,在
文件“/Users/Yasser/build/mayavi/setup.py”,第 498 行,在
配置文件“/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/core.py”,第186行,在设置中返回 old_setup( new_attr)
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py”,第 152 行,在设置中
dist.run_commands()
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py”,第 953 行,在 run_commands 中
self.run_command(cmd)
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command
cmd_obj.run()
文件“/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/command/install.py”,第57行,运行中
r = self.setuptools_run()
文件“/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/command/install.py”,第31行,在setuptools_run
返回 old_install_mod._install.run(self)
运行中的文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py”,第 573 行
self.run_command('build')
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py”,第 326 行,在 run_command
self.distribution.run_command(命令)
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command 中
cmd_obj.run()
运行中的文件“/Users/Yasser/build/mayavi/setup.py”,第 303 行
build_tvtk_classes_zip()
文件“/Users/Yasser/build/mayavi/setup.py”,第 290 行,在 build_tvtk_classes_zip
gen_tvtk_classes_zip()
文件“tvtk/setup.py”,第 46 行,在 gen_tvtk_classes_zip
从 code_gen 导入 TVTKGenerator
文件“tvtk/code_gen.py”,第 10 行,在
导入 vtk
导入错误:没有名为 vtk 的模块
命令 /usr/bin/python -c "import setuptools;__file__='/Users/Yasser/build/mayavi/setup.py';exec(compile(open( file ).read().replace('rn) 的完整输出', 'n'),文件, 'exec'))" install --single-version-externally-managed --record /var/folders/53/_trhc_0x0fb6kvx6bw_wrk500000gn/T/pip-Z4hpsW-record/install-record.txt :
运行安装

运行构建

回溯(最近一次调用最后一次):

文件 ”",第 1 行,在

文件“/Users/Yasser/build/mayavi/setup.py”,第 498 行,在

**config

文件“/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/core.py”,第186行,在设置中

return old_setup(**new_attr)

文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py”,第 152 行,在设置中

dist.run_commands()

文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py”,第 953 行,在 run_commands 中

self.run_command(cmd)

文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command 中

cmd_obj.run()

文件“/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/command/install.py”,第57行,运行中

r = self.setuptools_run()

文件“/Library/Python/2.7/site-packages/numpy-1.6.1-py2.7-macosx-10.7-intel.egg/numpy/distutils/command/install.py”,第31行,在setuptools_run

return old_install_mod._install.run(self)

运行中的文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py”,第 573 行

self.run_command('build')

文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py”,第 326 行,在 run_command

self.distribution.run_command(command)

文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command 中

cmd_obj.run()

运行中的文件“/Users/Yasser/build/mayavi/setup.py”,第 303 行

build_tvtk_classes_zip()

文件“/Users/Yasser/build/mayavi/setup.py”,第 290 行,在 build_tvtk_classes_zip

gen_tvtk_classes_zip()

文件“tvtk/setup.py”,第 46 行,在 gen_tvtk_classes_zip

from code_gen import TVTKGenerator

文件“tvtk/code_gen.py”,第 10 行,在

import vtk

导入错误:没有名为 vtk 的模块


命令 /usr/bin/python -c "import setuptools; file ='/Users/Yasser/build/mayavi/setup.py';exec(compile(open( file ).read().replace('rn', ' n'), file , 'exec'))" install --single-version-externally-managed --record /var/folders/53/_trhc_0x0fb6kvx6bw_wrk500000gn/T/pip-Z4hpsW-record/install-record.txt 失败并出现错误/Users/Yasser/build/mayavi 中的代码 1
将完整的日志存储在 /Users/Yasser/Library/Logs/pip.log
回溯(最近一次调用最后一次):
文件“/usr/local/bin/pip”,第 8 行,在
load_entry_point('pip==1.1', 'console_scripts', 'pip')()
文件 "/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 116, in main
返回 command.main(args[1:], 选项)
文件“/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py”,第 141 行,在 main
log_fp = open_logfile(log_fn, 'w')
文件“/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py”,第 168 行,在 open_logfile 中
log_fp = 打开(文件名,模式)
IOError: [Errno 13] 权限被拒绝: '/Users/Yasser/Library/Logs/pip.log'

我认为问题在于 vtk。

谁能帮我?

其他详情

运行 sudo pip install mayavi 不能解决问题。

我认为这可能会有所帮助

› 哪条蟒蛇
/usr/local/bin/python

> Python
Python 2.7.2(默认,2012 年 2 月 17 日,13:57:55)
[GCC 4.2.1 (基于 Apple Inc. build 5658) (LLVM build 2335.15.00)] 在 darwin
输入“帮助”、“版权”、“信用”或“许可”以获取更多信息。

导入 vtk
虚拟机

我的 PYTHONPATH 是空的。


直接回复此邮件或在 GitHub 上查看。

*

Gael Varoquaux
Researcher, INRIA Parietal
Laboratoire de Neuro-Imagerie Assistee par Ordinateur
NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France
Phone:  ++ 33-1-69-08-79-68
http://gael-varoquaux.info            http://twitter.com/GaelVaroquaux

好的。 堆栈溢出可能是提出这些问题的最佳场所:人们比我更敏感。

我在 Windows 上也有同样的问题。 点是正确的。 任何人都可以帮忙吗?
顺便说一句 - 没有名为“vtk”的模块,只有“pyvtk”。

此页面是否有帮助?
0 / 5 - 0 等级