Avinash
Avinash

Reputation: 603

Problem with macports picking up wrong python

I previously installed Python in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6. then after the Lion update I installed it again in /System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6. But when I install any Python package using MacPorts, the installation fails with the following message:

CPATH='/opt/local/include' MACOSX_DEPLOYMENT_TARGET='10.7' LIBRARY_PATH='/opt/local/lib' F90FLAGS='-m64' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_mercurial/mercurial/work/.CC_PRINT_OPTIONS' LDFLAGS='-arch x86_64' FCFLAGS='-m64' OBJCFLAGS='-arch x86_64' FFLAGS='-m64' CC_PRINT_OPTIONS='YES'
:debug:build Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_mercurial/mercurial/work/mercurial-1.9" && /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 setup.py --no-user-cfg build'
:debug:build Executing command line:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_mercurial/mercurial/work/mercurial-1.9" && /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 setup.py --no-user-cfg build
:info:build sh: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6: No such file or directory
:info:build shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_mercurial/mercurial/work/mercurial-1.9" && /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 setup.py --no-user-cfg build " returned error 127
:error:build Target org.macports.build returned: shell command failed (see log for details)
:debug:build Backtrace: shell command failed (see log for details)
    while executing
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"$procedure $targetname"
:info:build Warning: the following items did not execute (for mercurial): org.macports.activate org.macports.build org.macports.destroot org.macports.install
:notice:build Log for mercurial is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_mercurial/mercurial/main.log

This happened while installing mercurial. I tried setting the default Python as the active one, but it was no use.

How can I make MacPorts use the version of Python I want? I should able to tell it this is the version and place which needs to be used.

Upvotes: 0

Views: 1209

Answers (2)

Ned Deily
Ned Deily

Reputation: 85025

What do you mean by you installed Python 2.6 again in /System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6? That's the location of the Apple-supplied Python 2.6 in Lion. There are also Apple-suppled Python 2.7 and 2.5 versions in that framework. Do not modify or delete anything in /System/Library! The MacPorts version is installed as before in /opt/local/.

Since upgrading to Lion, have you:

  1. downloaded the Xcode 4.1 installer from the Mac App store and then run the installer for it (found in /Applications)?

  2. Have you updated your MacPorts ports setup to the latest updates to support Lion?

    $ sudo port selfupdate
    $ sudo port -u upgrade outdated
    
  3. Are you using the MacPorts mercurial port?

    $ sudo port install mercurial
    
  4. Have you modified your PATH to include /opt/local/bin or are you using the absolute path to the Macports Python: /opt/local/bin/python2.6

Upvotes: 2

sa125
sa125

Reputation: 28971

I find it best to work with virtualenv when programming python - then there's no mystery about which dependency is where, and installing packages is a breeze with pip or easy_install. If you google it, you can see a bunch of useful blog posts on how to set it up and use it effectively.

Upvotes: 0

Related Questions