Opened 11 years ago

Closed 11 years ago

#39207 closed defect (fixed)

vim @7.3.762_2+cscope+huge+perl+python27+python33+tcl is broken after upgrading MacPorts python27 from 2.7.3 to 2.7.5

Reported by: ksze (Kal Sze) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: Cc: jyrkiwahlstedt, macports@…, ned-deily (Ned Deily), dcecchin@…
Port: vim python27

Description (last modified by larryv (Lawrence Velázquez))

  1. Upgrade python27 in MacPorts to version 2.7.5
  2. Open a existing Python source file in vim; e.g. vim helloworld.py
  3. Get a Python 2.7 traceback and see vim crash.

The traceback is as follows:

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 548, in <module>
    main()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 530, in main
    known_paths = addusersitepackages(known_paths)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 231, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 516, in get_config_var
    return get_config_vars().get(name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 449, in get_config_vars
    import re
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 105, in <module>
    import sre_compile
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_compile.py", line 14, in <module>
    import sre_parse
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT

This StackOverflow QA seems to be relevant: http://stackoverflow.com/questions/16301735/importerror-cannot-import-name-maxrepeat-with-cx-freeze

Change History (14)

comment:1 Changed 11 years ago by larryv (Lawrence Velázquez)

Cc: jwa@… added; raimue@… removed
Description: modified (diff)
Keywords: python removed
Owner: changed from macports-tickets@… to raimue@…
Port: python27 added

comment:2 Changed 11 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:3 Changed 11 years ago by raimue (Rainer Müller)

Hm, strange error. Can you try to rebuild vim against the new python27?

sudo port -n upgrade --force vim

comment:4 Changed 11 years ago by ned-deily (Ned Deily)

Cc: nad@… added

Cc Me!

comment:5 Changed 11 years ago by ned-deily (Ned Deily)

See http://bugs.python.org/issue18050. I believe that vim embeds a static version of the Python interpreter. If that version is Python 2.7.3 or earlier 2.7 and if the MacPorts Python 2.7 is upgraded to 2.7.4 or .5, you will run into this problem. The forced rebuild of vim with a current Python 2.7.5 installed *should* fix the problem.

comment:6 Changed 11 years ago by ksze (Kal Sze)

I just tried rebuilding with

sudo port -n upgrade --force vim

But I still get the error.

FYI, I do have MacPorts' python27 selected:

$ port select --list python
Available versions for python:
	none
	python25-apple
	python26-apple
	python27 (active)
	python27-apple
	python32
	python33

$ port installed python27
The following ports are currently installed:
  python27 @2.7.5_0+universal (active)
Last edited 11 years ago by ksze (Kal Sze) (previous) (diff)

comment:7 Changed 11 years ago by chris.lasher@…

I encountered this problem for MacVim, too. I found that I had to remove the +python33 variant. If I try the +python33 variant without the +python27 variant, I still get the error. Very frustrating, as it seems like MacPorts is unable to compile Python 3.3 support in MacVim/vim presently. :-(

comment:8 Changed 11 years ago by ned-deily (Ned Deily)

FWIW, on OS X 10.8.4, I am able to successfully build, install, and run vim +python27, vim +python33, and vim +python27 +python33 from source with the current python27 and python33 ports installed:

  python27 @2.7.5_0+universal (active)
  python33 @3.3.2_0+universal (active)
  vim @7.3.762_2+huge+python33+universal
  vim @7.3.762_2+huge+python27+universal
  vim @7.3.762_2+huge+python27+python33+universal (active)

You could try forcing a vim rebuild from source with port -d -s. In the debug output, you should see something like this:

checking --with-python argument... /opt/local/bin/python2.7
checking Python version... 2.7
checking Python is 1.4 or better... yep
checking Python's install prefix... /opt/local/Library/Frameworks/Python.framework/Versions/2.7
checking Python's execution prefix... /opt/local/Library/Frameworks/Python.framework/Versions/2.7
checking Python's configuration directory... /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
checking if -pthread should be used... no
checking if compile and link flags for Python are sane... yes
checking --enable-python3interp argument... yes
checking --with-python3 argument... /opt/local/bin/python3.3
checking Python version... 3.3
checking Python's abiflags... m
checking Python's install prefix... /opt/local/Library/Frameworks/Python.framework/Versions/3.3
checking Python's execution prefix... /opt/local/Library/Frameworks/Python.framework/Versions/3.3
checking Python's configuration directory... /opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config-3.3m
Last edited 11 years ago by ned-deily (Ned Deily) (previous) (diff)

comment:9 in reply to:  8 Changed 11 years ago by ksze (Kal Sze)

Replying to nad@…:

You could try forcing a vim rebuild from source with port -d -s. In the debug output, you should see something like this:

checking --with-python argument... /opt/local/bin/python2.7
checking Python version... 2.7
checking Python is 1.4 or better... yep
checking Python's install prefix... /opt/local/Library/Frameworks/Python.framework/Versions/2.7
checking Python's execution prefix... /opt/local/Library/Frameworks/Python.framework/Versions/2.7
checking Python's configuration directory... /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
checking if -pthread should be used... no
checking if compile and link flags for Python are sane... yes
checking --enable-python3interp argument... yes
checking --with-python3 argument... /opt/local/bin/python3.3
checking Python version... 3.3
checking Python's abiflags... m
checking Python's install prefix... /opt/local/Library/Frameworks/Python.framework/Versions/3.3
checking Python's execution prefix... /opt/local/Library/Frameworks/Python.framework/Versions/3.3
checking Python's configuration directory... /opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config-3.3m

I just tried rebuilding with -d -s. I see the exact same lines as you do. But when I try editing a .py file, Vim still crashes with the same error.

EDIT 1: I am starting to suspect that the error I see is caused by a Python-related plugin instead of Vim itself.

EDIT 2: I think I can confirm that pyflakes.vim is the immediate culprit in my case. Removing pyflakes.vim allows me to at least open Python files without immediately getting the MAXREPEAT import error.

Last edited 11 years ago by ksze (Kal Sze) (previous) (diff)

comment:10 Changed 11 years ago by dcecchin@…

Cc: dcecchin@… added

Cc Me!

comment:11 Changed 11 years ago by dcecchin@…

I suspect i'm having the same issue, +python27 just does not seem to work. python33 does, I installed with:

sudo port -d install vim +huge +cscope +python27 +python33 sudo port -d install MacVim +huge +cscope +python27 +python33

I've tried all combinations, -python27 +python33, +python27 -python33, +python27, +python33 etc.

I also set python with: port select --set python python27

Don't have time right now to dig through the logs, but something is certainly wrong.

comment:12 Changed 11 years ago by dcecchin@…

I'm seeing this in my compile when compiling with: $ sudo port -d -s install vim +huge +cscope +python27 +python33

checking --enable-pythoninterp argument... yes
checking --with-python argument... /opt/local/bin/python2.7
checking Python version... 2.7
checking Python is 1.4 or better... yep
checking Python's install prefix... /opt/local/Library/Frameworks/Python.framework/Versions/2.7
checking Python's execution prefix... /opt/local/Library/Frameworks/Python.framework/Versions/2.7
checking Python's configuration directory... /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
checking if -pthread should be used... no
checking if compile and link flags for Python are sane... no: PYTHON DISABLED
checking --enable-python3interp argument... yes
checking --with-python3 argument... /opt/local/bin/python3.3
checking Python version... 3.3
checking Python's abiflags... m
checking Python's install prefix... /opt/local/Library/Frameworks/Python.framework/Versions/3.3
checking Python's execution prefix... /opt/local/Library/Frameworks/Python.framework/Versions/3.3
checking Python's configuration directory... /opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config-3.3m
checking if -pthread should be used... no
checking if compile and link flags for Python 3 are sane... yes
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 26 2013 11:31:57)
MacOS X (unix) version
Included patches: 1-244, 246-762
Compiled by dcecchin@haven.local
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent -clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds
+localmap -lua +menu +mksession +modify_fname +mouse -mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg +path_extra -perl
 +persistent_undo +postscript +printer +profile -python +python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl
+terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
   system vimrc file: "/opt/local/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp  -pipe -Os -arch x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -L/usr/local/lib -o vim       -lm  -lncurses -liconv -lintl -framework Cocoa      -L/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/
python3.3/config-3.3m -lpython3.3 -lintl -framework CoreFoundation

comment:13 Changed 11 years ago by dcecchin@…

comment:14 Changed 11 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: newclosed

Fix committed in r110123.

Note: See TracTickets for help on using tickets.