【问题标题】:"ImportError: No module named oldnumeric" when running PMV from mgltools从 mgltools 运行 PMV 时出现“ImportError:没有名为 oldnumeric 的模块”
【发布时间】:2018-09-26 05:48:22
【问题描述】:

我使用以下命令安装了一个名为 mgltools 的工具

conda install mgltools

当我尝试使用命令pmv 测试安装时,出现以下错误

setting PYTHONHOME environment
Run PMV from  /home/satyajeet/miniconda2/MGLToolsPckgs/Pmv
Traceback (most recent call last):
  File "/home/satyajeet/miniconda2/MGLToolsPckgs/Pmv/__init__.py", line 369, in runPmv
    from mglutil.splashregister.splashscreen import SplashScreen
  File "/home/satyajeet/miniconda2/MGLToolsPckgs/mglutil/splashregister/splashscreen.py", line 7, in <module>
    from mglutil.util.misc import ensureFontCase
  File "/home/satyajeet/miniconda2/MGLToolsPckgs/mglutil/util/misc.py", line 19, in <module>
    import numpy.oldnumeric as Numeric
ImportError: No module named oldnumeric
hit enter to continue

从网上论坛,我发现问题是numpy版本。 oldnumeric 支持在 numpy 1.9 之后被撤回,我正在运行 numpy 1.15。所以我使用以下命令将 numpy 降级为numpy 1.8.1

python -m pip install numpy==1.8.1

但现在我得到一个新错误

setting PYTHONHOME environment
Run PMV from  /home/satyajeet/miniconda2/MGLToolsPckgs/Pmv
Traceback (most recent call last):
  File "/home/satyajeet/miniconda2/MGLToolsPckgs/Pmv/__init__.py", line 378, in runPmv
    from Pmv.moleculeViewer import MoleculeViewer
  File "/home/satyajeet/miniconda2/MGLToolsPckgs/Pmv/moleculeViewer.py", line 21, in <module>
    from DejaVu.Geom import Geom
  File "/home/satyajeet/miniconda2/MGLToolsPckgs/DejaVu/__init__.py", line 200, in <module>
    from Viewer import Viewer
  File "/home/satyajeet/miniconda2/MGLToolsPckgs/DejaVu/Viewer.py", line 53, in <module>
    from DejaVu.Camera import Camera
  File "/home/satyajeet/miniconda2/MGLToolsPckgs/DejaVu/Camera.py", line 41, in <module>
    import Image
ImportError: No module named Image
hit enter to continue

我可以使用

导入图片
>>> from PIL import Image

有什么建议吗?

pip freeze的输出

absl-py==0.5.0
alabaster==0.7.11
asn1crypto==0.24.0
Babel==2.6.0
backports-abc==0.5
backports.functools-lru-cache==1.5
certifi==2018.8.24
cffi==1.11.5
chardet==3.0.4
conda==4.5.11
cryptography==2.3.1
cycler==0.10.0
Cython==0.28.5
decorator==4.3.0
deepTools==3.1.2
dill==0.2.8.2
Django==1.11.15
dm-sonnet==1.23
docutils==0.14
enum34==1.1.6
functools32==3.2.3.post2
futures==3.2.0
idna==2.7
image==1.5.25
imagesize==1.1.0
ipaddress==1.0.22
ipython-genutils==0.2.0
Jinja2==2.10
jsonschema==2.6.0
jupyter-core==4.4.0
kiwisolver==1.0.1
MACS==1.4.2
MarkupSafe==1.0
matplotlib==2.2.3
mkl-fft==1.0.6
mkl-random==1.0.1
nbformat==4.4.0
numpy==1.8.1
numpydoc==0.8.0
oldnumeric==1.0.4
packaging==17.1
pandas==0.23.4
Pillow==5.2.0
plotly==3.2.1
Pmw==2.0.1
py2bit==0.3.0
pyBigWig==0.3.12
pycosat==0.6.3
pycparser==2.18
Pygments==2.2.0
pyOpenSSL==18.0.0
pyparsing==2.2.1
pysam==0.15.0
PySocks==1.6.8
python-dateutil==2.7.3
pytz==2018.5
requests==2.19.1
retrying==1.3.3
ruamel-yaml==0.15.46
scipy==1.1.0
singledispatch==3.4.0.3
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.8.1
sphinxcontrib-websupport==1.1.0
subprocess32==3.5.2
tornado==5.1.1
traitlets==4.3.2
typing==3.6.6
urllib3==1.23

更新 1:

按照this 的建议,我设置了一个 PIL 模块。 我得到了

fatal error: X11/Xlib.h: No such file or directory

here 所述已解决。但是现在如果我尝试执行 pmv 的新错误是..

ValueError: Attempted relative import in non-package

【问题讨论】:

标签: python numpy conda


【解决方案1】:

MGLtools 看起来已被废弃,its conda package 无法使用。 The latest release was in 2012the download page of the official site was last updated in 2015 等等。

如您所见,conda 包与其他包的最新版本不兼容,并且从the files for download 的内容来看,它是为 Python 2.5(!) 构建的。

  • 因此,即使您获得了必要的 Python 模块(无论它们是什么),您仍然必须针对可用的 Python 重新编译它,才能使用扩展模块。

您只能使用conda 安装包,因为它的元数据(.tar.gz 中的info/index.json)没有指定它的依赖项(根本)。

所以,如果您仍想尝试一下,最好的办法是尝试从官方下载包进行独立安装 Downloads — MGLTools 这些包包括必要版本的 Python 和其他依赖项。

【讨论】:

  • 谢谢。事实证明,独立安装是更简单的选择。
  • 这里的问题是 MGLTool 只与 python 2 兼容。所以如果你的 Conda 设置为 python 3 则无法使用它。
  • @MohamadKouhiMoghadam OP 使用的是miniconda2。这个包太旧了,甚至不兼容。
猜你喜欢
  • 2012-06-14
  • 2018-06-30
  • 2016-04-06
  • 1970-01-01
  • 2013-01-14
  • 2013-12-16
  • 2014-11-28
  • 2016-07-10
  • 2017-01-29
相关资源
最近更新 更多