0

以前は、%R および %%R マジックは IPython および Jupyter python ノートブックで機能していました。R 端末のバージョンは次のとおりです。

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

Enthought Canopy でバージョン 1.7.4.3348 にアップグレードすると、ノートブックと IPython が機能しなくなります。以前は機能していたRKernelhttp://irkernel.github.io/installation/のインストールに従って、再インストールを試みました。コマンドを実行してR拡張をロードします

%load_ext rpy2.ipython

次のようなエラー メッセージが表示されます。

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-691c6d73b073> in <module>()
----> 1 get_ipython().magic(u'load_ext rpy2.ipython')

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
   2161         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2162         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2163         return self.run_line_magic(magic_name, magic_arg_s)
   2164 
   2165     #-------------------------------------------------------------------------

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
   2082                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2083             with self.builtin_trap:
-> 2084                 result = fn(*args,**kwargs)
   2085             return result
   2086 

<decorator-gen-64> in load_ext(self, module_str)

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    191     # but it's overkill for just that one bit of state.
    192     def magic_deco(arg):
--> 193         call = lambda f, *a, **k: f(*a, **k)
    194 
    195         if callable(arg):

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/magics/extension.pyc in load_ext(self, module_str)
     64         if not module_str:
     65             raise UsageError('Missing module name.')
---> 66         res = self.shell.extension_manager.load_extension(module_str)
     67 
     68         if res == 'already loaded':

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/extensions.pyc in load_extension(self, module_str)
     82             if module_str not in sys.modules:
     83                 with prepended_to_syspath(self.ipython_extension_dir):
---> 84                     __import__(module_str)
     85             mod = sys.modules[module_str]
     86             if self._call_load_ipython_extension(mod):

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/rpy2/ipython/__init__.py in <module>()
----> 1 from .rmagic import load_ipython_extension

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/rpy2/ipython/rmagic.py in <module>()
     57 template_converter = ro.conversion.converter
     58 try:
---> 59     from rpy2.robjects import pandas2ri as baseconversion
     60     template_converter = template_converter + baseconversion.converter
     61 except ImportError:

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/rpy2/robjects/pandas2ri.py in <module>()
      7                              INTSXP)
      8 
----> 9 from pandas.core.frame import DataFrame as PandasDataFrame
     10 from pandas.core.series import Series as PandasSeries
     11 from pandas.core.index import Index as PandasIndex

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/__init__.py in <module>()
     20 
     21 # numpy compat
---> 22 from pandas.compat.numpy_compat import *
     23 
     24 try:

/Users/Llewelyn_home/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/compat/numpy_compat.py in <module>()
     13 
     14 # numpy versioning
---> 15 _np_version = np.version.short_version
     16 _np_version_under1p8 = LooseVersion(_np_version) < '1.8'
     17 _np_version_under1p9 = LooseVersion(_np_version) < '1.9'

AttributeError: 'module' object has no attribute 'version'

numpy の Canopy バージョンが 1.10.4-1 および np としてリストされていることに関連している可能性があります。バージョンの結果は 1.11.1 ですか (エラー メッセージに基づく)? どんな提案もありがたく受け取った。PS。R は引き続きコンソールで動作し、さらにターミナルと R カーネルを使用する Jupyter で動作します...

4

1 に答える 1

0

Enthought のサポート クルーは、numpy、次に pandas のバージョンを調べました。両方を再インストールしても問題は解決しませんでした。pip install theano --upgradeキャノピー ターミナルのコマンドから、原因不明の解決策が発生しました。このエラーは、%R の原因不明の問題としてログに記録されますが、依存関係のバージョンに関するものであることが強く示されています。

于 2016-08-11T02:16:04.530 に答える