scipy
を(関節的に)使用していて、以下のような warning
が発生しました。
- warning 内容
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/sparse/compressed.py:130: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`. if np.rank(self.data) != 1 or np.rank(self.indices) != 1 or np.rank(self.indptr) != 1: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/sparse/coo.py:200: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`. if np.rank(self.data) != 1 or np.rank(self.row) != 1 or np.rank(self.col) != 1:
対処した結果を記載しておきます。
前提
-
OS情報
sw_vers -productVersion ============================ 10.12.4 ============================
-
python version
python -V ============================ Python 2.7.10 ============================
-
scipy
の verisonpip list | grep scipy ============================================== scipy (0.13.0b1) ==============================================
対応方法
調べると、以下 Stack Overflow
の質問がヒットしました。
numpy - VisibleDeprecationWarning in python - Stack Overflow
scipy
を upgrade
すると、解決するようなので、以下を実行。
pip install --upgrade scipy
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-bCbIGX-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy-0.13.0b1-py2.7.egg-info'
どうも、エラーとして、mac os sierra の pandas を upgrade したら [Errno 1] Operation not permitted:
が発生 | Monotalk
と同じ匂いを感じるエラーだったので、six
を除外してインストールを実行。
pip install --upgrade scipy --ignore-installed six
=====================================================
Collecting scipy
Downloading scipy-0.19.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (16.2MB)
100% |████████████████████████████████| 16.2MB 55kB/s
Collecting six
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting numpy>=1.8.2 (from scipy)
Downloading numpy-1.12.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.4MB)
100% |████████████████████████████████| 4.4MB 114kB/s
Installing collected packages: numpy, scipy, six
Successfully installed numpy-1.12.1 scipy-0.19.0 six-1.10.0
======================================================
無事成功し、警告は出力されなくなりました。
MAC は OS upgrade すると細かいトラブル多いですね..
どのOSも似たようなもんですかね..
以上です。
コメント