mac

Snow LeopardのMacportsでpythonをインストール

Macportsでpython26のパッケージインストールに失敗しました。
下記に対処方法があり、クリーンナップしてインストール&ソース修正&再インストールでインストールできました。

対処方法

クリーンナップ

python26とzlibパッケージをクリーンナップします。

$ sudo port -f clean python26 zlib
Password:
      • > Cleaning python26
      • > Cleaning zlib
$

zlibパッケージのインストール

+universalを付けてインストールします。
このオプションで、32ビット版にも対応したパッケージがビルドされるようです。

$ sudo port install zlib +universal
      • > Computing dependencies for zlib
      • > Fetching zlib
      • > Verifying checksum(s) for zlib
      • > Extracting zlib
      • > Applying patches to zlib
      • > Configuring zlib
      • > Building zlib
      • > Staging zlib into destroot
      • > Installing zlib @1.2.3_2+universal
      • > Deactivating zlib @1.2.3_2
      • > Activating zlib @1.2.3_2+universal
      • > Cleaning zlib
$

python26パッケージのインストール

こちらも+universalオプションを付けてインストールしますがエラーとなります。

$ sudo port install python26 +universal
      • > Computing dependencies for python26
      • > Fetching python26
      • > Verifying checksum(s) for python26
      • > Extracting python26
      • > Applying patches to python26
      • > Configuring python26
      • > Building python26
      • > Staging python26 into destroot
Error: Target org.macports.destroot returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.2" && /usr/bin/make frameworkinstall maninstall MAKE="/usr/bin/make CC=/usr/bin/gcc-4.2" DESTDIR=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot " returned error 2 Command output: /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/hello_world.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/index.html /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/output_window.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -m 644 ./Resources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Resources/English.lproj/Documentation/ide /usr/bin/install -c -s ../python.exe "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python" sed -e "s!%bundleid%!org.python.python!g" \ -e "s!%version%!`DYLD_FRAMEWORK_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.2: ../python.exe \ -c 'import platform; print(platform.python_version())'`!g" \ < "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Info.plist.in" \ > "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Info.plist" rm "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/Info.plist.in" PYTHONHOME=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6 DYLD_FRAMEWORK_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.2: arch -i386 ../python.exe ./scripts/BuildApplet.py \ --destroot "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot" \ --python=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python`test -f "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python-32" && echo "-32"` \ --output "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/Applications/MacPorts/Python 2.6/Build Applet.app" \ ./scripts/BuildApplet.py Traceback (most recent call last): File "./scripts/BuildApplet.py", line 15, in import EasyDialogs File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/EasyDialogs.py", line 34, in import Nav ImportError: No module named Nav make[1]: *** [install_BuildApplet] Error 1 make: *** [frameworkinstallapps] Error 2 Error: Status 1 encountered during processing. $

ソース修正&再インストール

参照したチケットに記載されていた通り”import Nav”の一行を削除します。
エラーメッセージに表示されているEasyDialogs.pyの34行目です。

"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/EasyDialogs.py", line 34, in 
import Nav

再度、インストールすると問題なくインストールされました。

$ sudo port install python26 +universal
      • > Computing dependencies for python26
      • > Staging python26 into destroot
      • > Installing python26 @2.6.2_4+darwin+universal
      • > Activating python26 @2.6.2_4+darwin+universal
To fully complete your installation and make python 2.6 the default, please run sudo port install python_select sudo python_select python26
      • > Cleaning python26
$

後処理の指示がありますが、下記のように一応、動いているようです。

$ python
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
$

コメント

  1. 通り素顔 より:

    2.6.1はApple謹製の/usr/bin/pythonですね。
    $PATHで/opt/local/binより/usr/binが優先されてるんじゃないでしょうか。

  2. ksaito11 より:

    コメントありがとうございました。
    確かにそうですね。

    $ type python
    python is hashed (/usr/bin/python)
    $ python -V
    Python 2.6.1
    $ /opt/local/bin/python -V
    Python 2.6.2
    $

  3. 通り素顔2 より:

    ちょっと前にfixされたようです>http://trac.macports.org/ticket/20284
    当方32bit KernelのCore2Duo MacBook4.1ですが、+universalなしでpython26が入りました。x86_64だけのバイナリです

  4. ksaito11 より:

    連絡ありがとうございました。
    確かに、修正されていました。
    今度は、ソース修正なしで64ビット版でインストールできました。

タイトルとURLをコピーしました