Pylucene installation on MacOs with adoptopenjdk / Java8 - python

I am trying to install JCC (as part of the installation of PyLucene) and I encountered several issues with it.
The python version I use is 3.7, and I have installed adoptopenjdk-8.jdk using brew cask (since Java-8 is no longer available without specific license (read it somewhere)). After this didn't really worked I manually installed Java-8
The error I am receiving while trying to run setup.py in shell (using either java8 or adoptopenjdk) is:
OSError: warning: [options] bootstrap class path not set in conjunction with -source 5
error: Source option 5 is no longer supported. Use 7 or later.
error: Target option 5 is no longer supported. Use 7 or later.
Please help me install PyLucene!
It is related to these (but they are outdated and doesn't work):
pyLucene Installation
https://medium.com/#michaelaalcorn/how-to-use-pylucene-e2e2f540024c
EDIT:
I realized this is related to javac versions but idk how to solve it.
This site looks helpful (from the code) but I can't understand whats written here: https://www.jianshu.com/p/dcd149a65eb0

So,
Changing the the setup.py file in 2 locations solved it:
line 185:
JAVAC = {
'darwin': ['/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/bin/javac', '-source', '1.5', '-target', '1.5'],
and adding one line here (line 68):
JAVAHOME = '/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home'
JDK = {
'darwin': JAVAHOME,
'ipod': '/usr/include/gcc',

After much gnashing of teeth, I found that this works to build pylucene
My configuration:
Mac OSX 10.15.7
Powerbook Intel core i7 (I note this, because I got
the weird error "gcc: error: this compiler does not support arm64"
when trying to compile with gcc)
Python 2.7.16 (Python 3.8.2 doesn't seem to work... lots of compile
errors with bad types.)
Apple clang version 12.0.0 (clang-1200.0.32.29)
gcc (Homebrew GCC 10.2.0_3) 10.2.0
I used clang instead of gcc (which doesn't seem to work at all) by doing this:
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
In the file setup.py, I removed -ljava and -ljvm flags from the LFLAG dictionary where darwin is in the key. Otherwise, ld complains.
I've managed only to build pylucene. I have no idea (yet) whether it will work with Python 2.7 or Python 3.x
I will update with details.

Related

MacOS M1 system is detected as ARM by Python package even though I'm using Rosetta

I'm on a Macbook with M1 (Apple ARM architecture) and I've tried running the following Python code using the layoutparser library, which indirectly uses pycocotools:
import layoutparser as lp
lp.Detectron2LayoutModel()
And I've received the error:
[...]
ImportError:
dlopen([...]/.venv/lib/python3.9/site-packages/pycocotools/_mask.cpython-39-darwin.so, 0x0002):
tried:
'[...]/.venv/lib/python3.9/site-packages/pycocotools/_mask.cpython-39-darwin.so'
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')),
'/usr/local/lib/_mask.cpython-39-darwin.so' (no such file),
'/usr/lib/_mask.cpython-39-darwin.so' (no such file)
The crucial info for me seems to be [...] is an incompatible architecture (have 'x86_64', need 'arm64e') [...]. Indeed, I am using the Apple ARM architecture, and sometimes it is not supported by some software. This is usually solved by using Rosetta, which simulates an Intel-x64 architecture. So I start a terminal with Rosetta (arch -x86_64 zsh), create a new virtual environment, make a fresh install of the dependencies, and try to run the code again ...
... and I receive the same error that I had also had without Rosetta:
[...] is an incompatible architecture (have 'x86_64', need 'arm64e') [...] 🥲
I've double-checked that Rosetta is really activated:
> uname -m
x86_64
Rosetta seems to be working. And yet, according to the error message, it seems not to be working.
Any ideas what could be the problem with Rosetta, or the library, or whatever, and how I could try fixing it?
Charles Duffy explained the problem in the comments, thank you! 😃
When I checked the platform in Python, it was indeed ARM:
> python -c 'import platform; print(platform.platform())'
macOS-12.0.1-arm64-i386-64bit
So I had been using a Python installation for ARM.
Now I installed brew and then python3 from the Rosetta terminal and used the newly installed Python to initiate a fresh virtual environment, and this fixed it. (This article helped me a bit with it.)
Update:
When creating Python environments with conda, it is possible to specify whether they should use Apple ARM or Intel-x64:
CONDA_SUBDIR=osx-arm64 conda create -n my_env python makes an ARM environment
CONDA_SUBDIR=osx-64 conda create -n my_env python makes an x64 environment

Building Python 3 on OS X: [Python/importlib.h] Error 133

I am trying to build Python (3.5.2) on OS X El Capitan (10.11.5). However, I run into an error when I try to make it. The error seems to be related to _freeze_importlib.
/usr/local/src/Python-3.5.2 $ make
if test "no" != "yes"; then \
./Programs/_freeze_importlib \
./Lib/importlib/_bootstrap.py Python/importlib.h; \
fi
dyld: lazy symbol binding failed: Symbol not found: _getentropy
Referenced from: /usr/local/src/Python-3.5.2/./Programs/_freeze_importlib
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _getentropy
Referenced from: /usr/local/src/Python-3.5.2/./Programs/_freeze_importlib
Expected in: /usr/lib/libSystem.B.dylib
/bin/sh: line 1: 56666 Trace/BPT trap: 5 ./Programs/_freeze_importlib ./Lib/importlib/_bootstrap.py Python/importlib.h
make: *** [Python/importlib.h] Error 133
/usr/local/src/Python-3.5.2 $
You can see my steps on GitHub.
The full Terminal output up to the make fail is in a Gist.
I fully acknowledge that this is an academic exercise, as El Capitan comes with Python 2.7.10 and you can easily install Python 3.5.2 with the official OS X installer package or via Homebrew.
The documentation for Using Python on Unix platforms provides build instructions. The documentation for Using Python on a Macintosh specifically says to use the the OS X installer package.
However, it should be possible to build on Mac.
Python on a Macintosh running Mac OS X is in principle very similar to Python on any other Unix platform, but there are a number of additional features such as the IDE and the Package Manager that are worth pointing out.
At this point, I'm not worried about those additional features. Just curious about why I am getting a make error.
Fixed.
In the output of ./configure, I noticed a reference to /Applications/Xcode-beta.app/Contents/Developer/. I installed Xcode 8 (beta) a few days ago. After switching back to the regular Command Line Tools (with Xcode 7.3.1)
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
make succeeded. Not perfectly.
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm _gdbm _sqlite3
_ssl nis ossaudiodev
spwd zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_lzma _tkinter
I hope I don't need those modules.
I've put the full output of ./configure and make in this Gist. I didn't include the output for make install as it was too long and seemed to only repeat the warnings and errors of make.
Notes
I didn't use --enable-framework or --enable-universalsdk.
I think a better solution is xcode-select --install.
If you update Xcode to 8(beta), you have to run xcode-select --install again to install all the build tools with it.
I ran into the same issue as yours and I can successfully install python through brew with Xcode8 after running xcode-select --install.
I hope it would help others with the same issue here.

Trouble installing scikit-bio on Windows

When attempting to install the scikit-bio toolkit via pip on Windows XP using Python 2.78 and Visual C++ 2008 Express Edition, the process is interrupted with the following message issued by VC:
cl : Command line error D8021 : invalid numeric argument '/Wno-error=declaration
-after-statement'
Concerning this error, Microsoft Developer Network website just says:
invalid numeric argument 'number'
A number greater than 65,534 was specified as a numeric argument.
I did not (yet) attempted to install scikit-bio under Linux (Ubuntu 12.04 Precise), but I am under the impression that it will work fine (as everything goes as regards Linux).
Has anyone ever succeeded installing scikit-bio under Windows (XP, 7, 8)? Any hints?
Thanks in advance!
I've installed Anaconda's Python (3.5) on a Windows 10 machine. As you should know, there is no official version of scikit-bio for this platform, but you can install it with this workaround:
Download the latest source from the Scikit-bio Github repository.
Using a tool like 7-zip, unzip it at your home directory.
Open a command line client and change to the source's directory
cd %HOMEPATH%\scikit-bio-master
Using Notepad++ edit the file setup.py
"C:\Program Files (x86)\Notepad++\notepad++" setup.py
Look for the line where the ssw_extra_compile_args variable is defined and change it. You can comment the previous version and redefine the variable in a new line:
#ssw_extra_compile_args = ['-Wno-error=declaration-after-statement']
ssw_extra_compile_args = []
Save the changes, close the editor and run the installation with this command:
python setup.py install
Hopefully you won't receive any error messages. Open an Anaconda's Python session (using the command python) and test if Scikit-Bio was installed rightly using print(skbio.art).
By the way, I've previously installed Visual Studio 2015 Community Edition with C++ SDK features enabled, in order to meet the compiler requirements for the package (Scikit-Bio) installation.
At this time, scikit-bio doesn't officially support windows. We'd definitely be interested in hearing about people's efforts to install, test, and use scikit-bio on Windows, but we don't have developers with expertise in this area.
This is related to biocore/skbio#941.

JPype installation on Mountain Lion: "error: command 'gcc' failed with exit status 1" [duplicate]

I am trying to use Neo4j for a project, and want to interface with it through Python since I'm a newbie to programming and don't know any Java. I'm following the installation instructions, but I'm stuck on
the first step, which is to install JPype.
I'm using OS X 10.7 (lion). I think my configuration is pretty standard
with Python 2.7.2 downloaded from the Python website and Java 1.6.0 downloaded from the Apple website.
When I run
% sudo python setup.py install
On the JPype installer, I get about a 100 lines of error code about various .h files, then it
terminates with the lines:
lipo: can't figure out the architecture type of: /var/tmp//
ccwOzLi9.out
error: command 'gcc-4.2' failed with exit status 1
I found a blog post about a gcc error with JPype, but I followed the instructions there to no avail. I also emailed the author of that post, and he told me had never actually used JPype, had been working in OS X 10.6, and didn't have any insight.
I also emailed the creator of JPype, who told me that he only uses Windows, and has no idea how to make the install work on OS X. But if we can solve this, I can point him to the answer and maybe he can add the solution to the JPype documentation and help lots of other people as well!
So, anyone know what I'm doing wrong? I would like to use Neo4j, but I
don't know Java so I'm at a complete loss for how to fix a compiler
error.
Based on reading every Google result available, my two running
theories are that:
I'm somehow using a 32-bit version of Python or of Java (though I
used standard official installations and can't figure out how to
switch to 64-bit or if that's even possible)
The JPype files can only be compiled using GCC 4.0 instead of 4.2.
But I can't find anything online about how to rollback to GCC 4.0 (or
if it comes shipped with 2011 MacBooks and there is some way to force
JPype to compile with that instead).
There is another similar question, but the solution there is to use a different adapter that goes through REST instead of hooking directly into Java. I will try that if I have to, but I would really rather use the recommended Neo4j method if it's possible.
I'm not a Python guy, but tried installing JPype on my machine:
% uname -a
Darwin fatty-i7.local.tld 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
% java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
On OSX Lion, the latest JDK appears to be located here:
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/JavaVM.framework/
A little googling turned up this post: http://blog.y3xz.com/post/5037243230/installing-jpype-on-mac-os-x
I followed those instructions to modify setup.py, then ran sudo python setup.py install with no problems.
Does that help?
On my Lion, the "include" directory in the JDK was gone, so JPype couldn't find jni.h.
I updated setup.py in two places, one to set where to find jar libraries:
def setupMacOSX(self):
self.javaHome = '/System/Library/Frameworks/JavaVM.framework'
self.jdkInclude = ""
self.libraries = ["dl"]
self.libraryDir = [self.javaHome+"/Home/lib"]
self.macros = [('MACOSX',1)]
And one to set where to find jni.h:
def setupInclusion(self):
self.includeDirs = [
self.javaHome+"/Headers",
<other stuff>
For me,
self.javaHome = '/System/Library/Frameworks/JavaVM.framework/Versions/Current/'
worked.
$ uname -a Darwin 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr 9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
$ java -version java version "1.6.0_33" Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720) Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
Here are directions I put in my README to install JPype on OS X 10.7. Same idea as the answers here but different enough to warrant the submission.
The python interface to java (JPype) needs mods to the setup.py:
In summary, you need to make sure the JPype setup.py script can see your Java SDK "Headers" and "Home" directory
I had to install Java from Apple first since my default OS X installation did not come with Headers in the typical Java install path which I found by executing:
/usr/libexec/java_home
If you do happen to have a Headers dir, you probably do not need to reinstall Java and can set the path vars below based on your java HOME directory which is likely different from those in these directions
After I installed Java, I found the new installation in:
/Library/Java/JavaVirtualMachines/
My Home directory was:
/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/
and my Header directory was:
/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Headers/
1) The JPype script assumes that Headers is within the Home directory but it's not, so I changed the Home path var and created a new Content path var in the setup.py script - In setupMacOSX(self):
self.javaHome = '/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/'
self.javaContents = '/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/'
2) In setupMacOSX(self), change self.libraryDir:
self.libraryDir = [self.javaContents + "/Libraries"]
Note that this step was mentioned as required but I did not have to do this for it to work so maybe try without it first
3) In setupInclusion, add paths to your "Home/include" dir and your "Headers" dir:
self.javaHome+"/include",
self.javaContents + "/Headers",
4) Running the installation should now work:
sudo python setup.py install
For everyone who is still trying to install Jpype but has meanwhile updated Mac OS: Andreas Kolleger's answer just works fine, but with XCode 4.3 the path changed to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/JavaVM.framework/Versions/Current/
In ML it's MacOSX10.8.sdk. At least on my system. :)
For me, on Mountain Lion
self.javaHome = '/System/Library/Frameworks/JavaVM.framework/'
worked.
$uname -a
Darwin 12.0.0 Darwin Kernel Version 12.0.0: Sun Jun 24 23:00:16 PDT 2012; root:xnu-2050.7.9~1/RELEASE_X86_64 x86_64
$ java -version
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
I did the same, but choosing
self.javaHome = '/Developer/SDKs/**MacOSX10.6.sdk**/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/'
instead
self.javaHome = '/Developer/SDKs/**MacOSX10.7.sdk**/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/'
realize that I use version 6 vs 7. With the 7 version I got the same errors that the beginning.
To make Will's answer a bit more specific: I had to modify the setupInclusion(self) method by adding the directory path he suggested, ie, '/System/Library/Frameworks/JavaVM.framework/Headers' on Mountain Lion (java version 1.6). With that the installation of JPype succeeded (though gave a bunch of warnings...)
Here's what worked for me - recommend you put the first line in your profile.
export JAVA_HOME=$(/usr/libexec/java_home)
cd $JAVA_HOME
sudo ln -s include Headers
sudo cp include/darwin/* include/
cd -
Note that instead of changing setup.py, I'm changing my JDK install. This has the advantage of fixing the issue for other projects.
For those trying to install on Mountain Lion, I had to further edit the setup.py file to include the header files here:
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers

vim compiles with wrong python version (and not working with needed version)

In brief:
I have a problem with compiling vim with preferred python version.
When I use --enable-pythoninterp it compiles with system OSX python version.
When I use --enable-pythoninterp=dynamic I get an error in vim while trying :py import sys
Here is what I was doing in more detail:
% git clone https://github.com/b4winckler/macvim.git
% cd macvim
% ./configure --enable-pythoninterp \
--with-python-config-dir=/usr/local/lib/python2.7/config <- this option has no affects on result
...
checking for python... /usr/local/bin/python
checking Python version... 2.7
checking Python is 1.4 or better... yep
checking Python's install prefix... /usr/local
checking Python's execution prefix... /usr/local
checking Python's configuration directory... /usr/local/lib/python2.7/config
...
% make
...
** BUILD SUCCEEDED **
% open src/MacVim/build/Release/MacVim.app
In the opened MacVim I type:
:py import sys; print (sys.version, sys.executable)
('2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)]',
'/usr/bin/python')
Why 2.6.1?
Why /usr/bin/python?
My default python is 2.7! And it lives at /usr/local/bin/python
I was searching for solution all day. And I found it. It is =dynamic attribute (but this solution had not explanation).
After that I tried to recompile vim with dynamic python:
% ./configure --enable-pythoninterp=dynamic
... output the same ...
% make
% open src/MacVim/build/Release/MacVim.app
In opened MacVim:
:py import sys
And here comes an error:
E370: Could not load library libpython2.7.a
E263: Sorry, this command is disabled, the Python library could not be loaded.
My OSX version is 10.6.8.
Default python version is 2.7.
% which python
/usr/local/bin/python
Can anybody explain how python is integrating into vim during the compilation?
And how to fix the error with libpython2.7.a?
update: I no longer have the environment described at the question. So I couldn't test new answers. But remaining part of mankind will appreciate your help.
My solution was to delete the configure cache file which was created from a previous built where I used the python which came with OSX.
Then I installed a new python version with homebrew and couldn't get .configure to take the new python version, even though I updated my PATH variable and which python showed the right python version.
Deleting the cache file and running configure again solved my problem.
rm src/auto/config.cache
./configure --enable-pythoninterp
Maybe it helps anybody.
I had the same problem. I compiled Macvim from source and tried to use the python version 2.7 from macports in:
/opt/local/bin/python
Some modules were not found, for example the os module. The reason for this was that the PYTHONPATH variable inside macvim is wrong!
To test, open macvim and type:
:python print sys.path
I got the following paths (note the ending, which is nonsense):
...
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.5/'
...
I presume the reason is in the linker flag "-framework Python". This picks up the wrong, i.e. the system python framework. If I change the line in the src/auto/configure script from:
if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
"import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
vi_cv_path_python_plibs="-framework Python"
to
if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
"import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
vi_cv_path_python_plibs="-F/opt/local/Library/Frameworks -framework Python"
Running configure again, after make clean,
Macvim compiles and works as expected. The -F flag tells the linker in which directory to find the following framework. Macports installs the Python.framework in this directory, YMMV.
I had a the same probleme as you (trying to compile MacVim with Python 2.7) and I finally managed to do it.
First the dynamic option doesn't work ! I've seen that tip too on the net, but if you look at the configure script (or just the help) it's not recognized. Therefore don't use it. That's equivalent to disabling python, which explain why :py doesn't work. You haven't compiled MacVim with Python.
What I've done at the end was reinstall Python 2.7.2 using the official installer on the Python website.
You should then have a config in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config.
Try to compile again with the following options
% ./configure --enable-pythoninterp \
--with-python-config-dir=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/python2.7/config
That gave me an error at the end of the compilation, but if I ignore it and launch the binary anyway that works. This problem might be specific to my computer (it seems to be related to the icon instalation).
Good luck.
Note that's the way I managed to compile MacVim with Python 2.7 (which was my objective) not necessarily the way to compile it with my runtime version of Python.
Make sure that the proper "python" is in your $PATH, which might not be the case when using "sudo".
There is an option to set the python binary to be used (if you cannot modify $PATH):
export vi_cv_path_python=/usr/local/bin/python
But still, with enable-pythoninterp=dynamic it failed to load libpython2.7.a when running ":python import sys", saying "E448: Could not load library function _PyArg_Parse_SizeT".
It sounds like the root of your problem lies in that Python is looking to the wrong directory. That should be the first part you look to correct, before worrying about integrating into vim. All Macs come with a version of Python already installed on their machine, in /usr/local/bin/python. Usually by the time you get the machine, you want install a more recent version of Python. The new version should be located:
% which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
I don't know how you installed Python to begin with, but the easiest way is easy_install or pip. This is a good link. If that doesn't solve your path problem, then you should see here. Hopefully this is all you need and the problem with vim will be resolved.
I found the above answer to be dangerous-- caused fatal errors when closing buffers in macvim.
The answer found here is much more stable:
Vim failing to compile with python on OS X
I just had the exact same wish, and MacPorts fulfilled it without additional fiddling:
$ port info macvim
MacVim #7.3.snapshot66, Revision 2 (editors)
Variants: big, cscope, [+]huge, perl, python, python25, python26, python27, python31, python32, python33, ruby, ruby19, tcl, universal, xim
...
$ sudo port install macvim +python27
---> Computing dependencies for MacVim
---> Fetching archive for MacVim
---> Attempting to fetch MacVim-7.3.snapshot66_2+huge+python27.darwin_10.x86_64.tbz2 from http://jog.id.packages.macports.org/macports/packages/MacVim
---> Attempting to fetch MacVim-7.3.snapshot66_2+huge+python27.darwin_10.x86_64.tbz2 from http://packages.macports.org/MacVim
---> Attempting to fetch MacVim-7.3.snapshot66_2+huge+python27.darwin_10.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/MacVim
---> Fetching distfiles for MacVim
---> Verifying checksum(s) for MacVim
---> Extracting MacVim
---> Applying patches to MacVim
---> Configuring MacVim
---> Building MacVim
---> Staging MacVim into destroot
---> Installing MacVim #7.3.snapshot66_2+huge+python27
---> Deactivating MacVim #7.3.snapshot66_2+huge
---> Cleaning MacVim
---> Activating MacVim #7.3.snapshot66_2+huge+python27
---> Cleaning MacVim
---> Updating database of binaries: 100.0%
---> Scanning binaries for linking errors: 100.0%
---> No broken files found.
Note: As you can see above (deactivating), I've tried the default (precompiled) MacVim first (ie. sudo port install macvim -> MacVim #7.3.snapshot66_2+huge), and it didn't have Python support compiled in.
After the adding the +python27 variant, running :py import sys; print (sys.version, sys.executable) inside the newly installed MacVim now returns:
('2.7.3 (default, Oct 22 2012, 06:12:28) \n[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]', '/Applications/MacPorts/MacVim.app/Contents/MacOS/Vim')
which happens to be the same as I have in my shell (depending on your $PATH and port select python):
$ which python
/opt/local/bin/python
$ python
Python 2.7.3 (default, Oct 22 2012, 06:12:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
...
The fix I found for this issue involved deleting the source and reacquiring it. I'm sure hg has a way to just delete the local changes, but I couldn't really find it in the help file.
I didn't use MacVim, but I suspect your issue is for the same reason.
Looking through the output of the configuration script it appears that it caches the python installation it used previously and just uses that.

Categories