如何解决"导入多阵列"并行python错误?

时间:2014-06-12 14:19:37

标签: python-2.7 numpy ubuntu-12.04 parallel-python

我正在尝试运行一个python 2.7脚本,该脚本使用并行python(版本1.6.1)来执行在Ubuntu Voyager(Ubuntu 12.04派生版)系统上使用numpy数组(numpy版本1.6.1)的函数。它给了我以下错误消息(实际上,它仍然更长,我想重复12次):

Starting pp with 12 workers
* An error has occured during the module import
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ppworker.py", line 49, in preprocess
    exec module
  File "<string>", line 1, in <module>
  File "/usr/share/pyshared/numpy/__init__.py", line 137, in <module>
    import add_newdocs
  File "/usr/share/pyshared/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/usr/share/pyshared/numpy/lib/__init__.py", line 4, in <module>
    from type_check import *
  File "/usr/share/pyshared/numpy/lib/type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "/usr/share/pyshared/numpy/core/__init__.py", line 5, in <module>
    import multiarray
ImportError: No module named multiarray
A fatal error has occured during the function execution
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ppworker.py", line 86, in run
    __args = pickle.loads(__sargs)
  File "/usr/share/pyshared/numpy/__init__.py", line 137, in <module>
    import add_newdocs
  File "/usr/share/pyshared/numpy/add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "/usr/share/pyshared/numpy/lib/__init__.py", line 4, in <module>
    from type_check import *
  File "/usr/share/pyshared/numpy/lib/type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "/usr/share/pyshared/numpy/core/__init__.py", line 5, in <module>
    import multiarray
ImportError: No module named multiarray
Exception in thread run_local:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/pymodules/python2.7/pp.py", line 719, in _run_local
    job.finalize(sresult)
UnboundLocalError: local variable 'sresult' referenced before assignment

Exception in thread run_local:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/pymodules/python2.7/pp.py", line 719, in _run_local
    job.finalize(sresult)
UnboundLocalError: local variable 'sresult' referenced before assignment

从其他主题(例如importing NumPy in Parallel Python)我已经看到它可能是pp和numpy通信的问题,所以我试过这些:

  • 更新pp和numpy
  • 重新安装numpy(我正在使用anaconda包)
  • 直接从shell运行代码(而不是从spyder运行)
  • 直接向具有该作业的工作人员提交多行数据(其他方式可以很好地导入)(我确信我的语法正确...)

但无济于事。你有什么其他的建议?有没有一个简单的解决方法,除了,嗯,“去除”我的功能(这将是悲伤,这是一个矩阵乘法)?我的同事使用相同操作系统的更新版本,但其他相同的python设置,似乎没有这个问题,但由于时间是一个问题更新我的系统或劫持他的较慢的计算机都不是最好的选择。

如有必要,请随时询问更多详细信息。提前谢谢你。

0 个答案:

没有答案