目前,我正在尝试在支持 cuda 的 ubuntu 16.04 系统上安装 theano。安装过程本身很顺利,直到我尝试测试安装:
python -c "import theano; theano.test()"
输出的最后几行是:
======================================================================
ERROR: Failure: ImportError (No module named nose_parameterized)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/myUser/anaconda2/lib/python2.7/site-packages/theano/tests/test_rop.py", line 16, in <module>
from theano.tests import unittest_tools as utt
File "/home/myUser/anaconda2/lib/python2.7/site-packages/theano/tests/unittest_tools.py", line 7, in <module>
from nose_parameterized import parameterized
ImportError: No module named nose_parameterized
----------------------------------------------------------------------
Ran 408 tests in 13.085s
FAILED (SKIP=26, errors=80)
这些之前有大约 20 个块,似乎不同的测试在堆栈跟踪中完全相同的前 3 行上失败。final 发生的代码如下所示(添加了行号):
411. # FIXME: to support module.name names,
412. # do what resolve-name does and keep trying to
413. # import, popping tail of module into addr.call,
414. # until we either get an import or run out of
415. # module parts
416. try:
417. module = self.importer.importFromPath(
418. addr.filename, addr.module)
419. finally:
420. self.config.plugins.afterImport(
421. addr.filename, addr.module)
在寻找解决方案时,我遇到了:
运行鼻子测试时出错
我尝试了那里提出的解决方案:
sudo pip install nose-parameterized
但是这没有效果。有谁知道还有什么可能导致此错误?
编辑:所以我重新安装了 theano 以使问题更具重现性。我使用here找到的说明安装了theano ,所以我使用了:
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano
然后我用:
nosetests theano
这个输出的最后几行几乎和前面一样:
======================================================================
ERROR: Failure: ImportError (No module named nose_parameterized)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/myUser/anaconda2/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/myUser/.local/lib/python2.7/site-packages/theano/tests/test_rop.py", line 16, in <module>
from theano.tests import unittest_tools as utt
File "/home/myUser/.local/lib/python2.7/site-packages/theano/tests/unittest_tools.py", line 7, in <module>
from nose_parameterized import parameterized
ImportError: No module named nose_parameterized
----------------------------------------------------------------------
Ran 457 tests in 160.608s
FAILED (SKIP=24, errors=95)
编辑2:我认为这可能是python版本问题。当我尝试:
python -V
我得到:
Python 2.7.12 :: Anaconda 4.2.0 (64-bit)
并且存在以下文件夹:
/usr/local/lib/python2.7/dist-packages/nose_parameterized
所以,据我所知,这应该不是问题。但是,当我尝试:
python2.7 -c "import nose_parameterized"
我得到:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named nose_parameterized