5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

macのpyenvからpypyをインストールしたかった話

Last updated at Posted at 2021-02-21

結論はこちら

環境

項目 詳細
マシン MacBook Pro (13-inch, 2017)
OS macOS Big Sur 11.2.1
pyenv pyenv 1.2.23 (from Home Brew)

経緯

Atcoderのテスト環境をローカルに作ろうと思い、公式と同じバージョンのpypyをインストールしようとした。

pyenv install pypy3.6-7.3.0

怒られた。

Downloading pypy3.6-v7.3.0-osx64.tar.bz2...
-> https://downloads.python.org/pypy/pypy3.6-v7.3.0-osx64.tar.bz2
Installing pypy3.6-v7.3.0-osx64...
Installing pip from https://bootstrap.pypa.io/get-pip.py...
error: failed to install pip via get-pip.py

BUILD FAILED (OS X 11.2.1 using 0000000000)

Inspect or clean up the working tree at (ログのパス)

Last 10 log lines:
    func = getattr(mod, fname)
  File "/Users/hoge/.pyenv/versions/pypy3.6-7.3.0/lib-python/3/ctypes/__init__.py", line 366, in __getattr__
    func = self.__getitem__(name)
  File "/Users/hoge/.pyenv/versions/pypy3.6-7.3.0/lib-python/3/ctypes/__init__.py", line 371, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
  File "/Users/hoge/.pyenv/versions/pypy3.6-7.3.0/lib_pypy/_ctypes/function.py", line 251, in __init__
    ptr = self._getfuncptr([], ctypes.c_int)
  File "/Users/hoge/.pyenv/versions/pypy3.6-7.3.0/lib_pypy/_ctypes/function.py", line 438, in _getfuncptr
    self._ptr = cdll.getfunc(self.name, ffi_argtypes, ffi_restype)
AttributeError: No symbol SCDynamicStoreCopyProxies found in library <None>

pyenvでpython3.8系とか3.6系とかがインストールできない問題にも以前ぶち当たっていたのだけど、どうやら違うところでひっかかっている模様。

原因

SCDynamicStoreCopyProxiesとかいうのがなかなか検索に引っかからず、ネットの海を漂っていたところこんなページを見つけた。

どうやらBig Surになってからの不具合らしく、ナイトリービルドでは修正されているとのこと。
が、まだ正式版には未反映。Oh...

pyenvを確認してみる。

pyenv install --list | grep pypy3
(中略)
  pypy3.6-7.3.3
  pypy3.7-c-jit-latest
  pypy3.7-7.3.2-src
  pypy3.7-7.3.2
  pypy3.7-7.3.3-src
  pypy3.7-7.3.3

よくみたら3.7がリリースされている。
latestは怖いので、pypy3.7-7.3.3をインストールするも、結果はさっきと同じ。仕方ない。

pyenv install pypy3.7-c-jit-latest

WARNING: This may eat your kittens/ affect timespace in alternate dimensions/
cause you to complain more. Nightly builds are meant for testing only.

脅されるけど気にせずインストール。

Installed pypy-c-jit-latest-osx64 to /Users/hoge/.pyenv/versions/pypy3.7-c-jit-latest

成功!

結論

macOS Big Sur+pyenvでpypyをインストールしたいときは最新版をインストールしましょう。
なお、pyenv自体を更新していないと最新版(20/02/21時点ではpypy3.7-c-jit-latest)が出てこない可能性があるので要注意。

きっと数ヶ月後には正式版として反映されている、はず。

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?