Bug 1323828
Summary: | python3 - vim - powerline issue? | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Michele Baldessari <michele> | ||||||||
Component: | powerline | Assignee: | Andreas Schneider <asn> | ||||||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||||
Severity: | medium | Docs Contact: | |||||||||
Priority: | unspecified | ||||||||||
Version: | 24 | CC: | asn, dustymabe, gerben, keramidasceid, mike, puiterwijk, silvery.corgan, vtgoal | ||||||||
Target Milestone: | --- | ||||||||||
Target Release: | --- | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | powerline-2.4-2.fc24 | Doc Type: | Bug Fix | ||||||||
Doc Text: | Story Points: | --- | |||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2016-05-14 23:31:53 UTC | Type: | Bug | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Attachments: |
|
Description
Michele Baldessari
2016-04-04 21:01:40 UTC
This is caused by the move of bindings/vim/__init__.py introduced in ceaa583d. This only moved the __init__.py, but left __init__.py[co], because of which it kept working on python2 (because python2 uses the pyc/pyo file if the __init__.py is deleted). With python3, this is no longer the case: there's no .pyc/.pyo anymore, since that's replaced by __pycache__, and if the original file is deleted, it can no longer import it. Created attachment 1147887 [details]
Patch to revert the __init__.py move
powerline-2.4-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-75cabc4d87 Still not working here: tmux-powerline-2.4-1.fc24.noarch vim-powerline-2.4-1.fc24.noarch powerline-docs-2.4-1.fc24.x86_64 powerline-2.4-1.fc24.x86_64 $ vim Traceback (most recent call last): File "<string>", line 9, in <module> ImportError: No module named powerline.vim An error occurred while importing powerline module. This could be caused by invalid sys.path setting, or by an incompatible Python version (powerline requires Python 2.6, 2.7 or 3.2 and later to work). Please consult the troubleshooting section in the documentation for possible solutions. Unable to import powerline, is it installed? Press ENTER or type command to continue Right, that is because powerline defaults to using python2 compared to python3. I'm just now testing a patch, but will attach it here as well. Created attachment 1148444 [details]
Prefer py3 over py2 for rawhide
This problem happens if you have both python2 and python3 installed: in that case, powerline will default to using python2, but vim will only inject itself in the python3 process. My patch changes the logic to prefer python3 if that's available, and only fall back to python2 if it isn't. This patch should not be merged to any branches where python2 is still the main implementation. powerline-2.4-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-75cabc4d87 Thanks Patrick, patch works fine. Shouldn't we apply this patch to f24 and beyond where vim seems to be dlopening python3 anyway? If not, it's probably worth dropping this patch from the erratum and track it for some later inclusion. Thanks again, Michele Yes, we should apply this patch on F24 and rawhide, since those have powerline moved to python3. I was mostly just trying to see if asn would pick the patch up, since I don't like to mess with other people's packages unless they ask or wait with their reply for a long time. Maybe asn can apply this patch, or give me ack to push it? Thanks for the help. Patrick feel free to push your changes and build new packages. powerline-2.4-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-75cabc4d87 powerline-2.4-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-75cabc4d87 I'm still seeing a problem even with the update: ``` $ rpm -q tmux-powerline powerline vim-powerline vim-enhanced tmux-powerline-2.4-2.fc24.noarch powerline-2.4-2.fc24.x86_64 vim-powerline-2.4-2.fc24.noarch vim-enhanced-7.4.1718-1.fc24.x86_64 ``` vim gives me: $ vim /etc/fstab Error detected while processing /home/dustymabe/.vimrc: line 42: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named powerline.vim line 43: Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'powerline_setup' is not defined line 44: Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'powerline_setup' is not defined Traceback (most recent call last): File "<string>", line 9, in <module> ImportError: No module named powerline.vim An error occurred while importing powerline module. This could be caused by invalid sys.path setting, or by an incompatible Python version (powerline requires Python 2.6, 2.7 or 3.2 and later to work). Please consult the troubleshooting section in the documentation for possible solutions. Unable to import powerline, is it installed? What is in your .vimrc on line 42 to 44? (In reply to Patrick Uiterwijk from comment #15) > What is in your .vimrc on line 42 to 44? Patrick, So sorry I missed this question a while back.. I'm creating an attachment now with my .vimrc. Created attachment 1156966 [details]
dustymabe's .vimrc
Dusty, Thanks. Could you try replacing the "python from powerline...." with "python3 from powerline..." (and the same change with the other powerline lines) together with my patches? (In reply to Patrick Uiterwijk from comment #18) > Dusty, > > Thanks. Could you try replacing the "python from powerline...." with > "python3 from powerline..." (and the same change with the other powerline > lines) together with my patches? That works. Thanks Patrick. Great, no problem. I just pushed the update on its way to stable so it should be in the F24 repos at the time of GA. powerline-2.4-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report. Sorry to poke at this some more but I just ran into this after a bare-metal upgrade from 23 -> 24b The official powerline docks still recommend using: python from powerline.vim import setup as powerline_setup python powerline_setup() python del powerline_setup to enable powerline in vimrc. I typically use the following, since I want it to be portable on systems that don't have powerline installed: if system('command -v powerline-daemon') != '' python3 from powerline.vim import setup as powerline_setup python3 powerline_setup() python3 del powerline_setup set laststatus=2 set noshowmode endif Perhaps I misunderstand how to use powerline with vim on fedora? I am sharing a .vimrc between a F23 and F24 system, and I try to make them as portable as possible. I have fully updated my upgraded F24 system, and checked that the package "powerline" has indeed installed the version for python 3. It does not seem to be prioritizing python3 over 2 on my system, perhaps because I upgraded? Error detected while processing /home/xenith/.vimrc: line 43: Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named powerline.vim Traceback (most recent call last): File "<string>", line 9, in <module> ImportError: No module named powerline.vim An error occurred while importing powerline module. This could be caused by invalid sys.path setting, or by an incompatible Python version (powerline requires Python 2.6, 2.7 or 3.2 and later to work). Please consult the troubleshooting section in the documentation for possible solutions. Unable to import powerline, is it installed? Press ENTER or type command to continue It works if I change .vimrc to be "python3" verses "python", but I don't really like that solution because it means I'm going to have to write in some logic to check for whether or not powerline is installed for python3 or 2 included in the vimrc file. The way this bug report reads is that the user should not need to know to change it to "python3" is that so? After updating to F24 I ran into the 'Unable to import powerline, is it installed?' message. Then I just commented out the python powerline lines in my .vimrc and powerline worked again. The Fedora powerline package contains an autoload/powerline file. That should remove the need for adding this to a .vimrc file, as vim should load all modules from that directory. This file should be uptodate for both python2 on F23 and python3 for F24. If this autoload doesn't work, that's another bug that I can look into. Maybe I wasn't clear enough. The autoloading works for me on F24 after removing the powerline setup lines. Maybe someone can update the instructions (for F24) on https://fedoramagazine.org/add-power-terminal-powerline ? Ah, I had been unaware of that article, thanks! I have just informed the author that the .vimrc changes are not needed, and hope it will be updated very soon. Thank you very much for the information! My two pennies: In order for the bar to be visible the only thing that is needed is to add the following line: set laststatus=2 to the .vimrc file. It would be also nice if you could add this to the autoload/powerline too. Confirmed bug on Fedora 24. I have the Ultimate Vim Setup from here: https://github.com/spf13/spf13-vim But the issue persists even if I remove it and add the lines for the powerline config. There is no autoloading for me. This is actually documented and intended behavior of powerline seemingly: https://powerline.readthedocs.io/en/latest/tips-and-tricks.html#vim. So I'm not sure we should add that laststatus=2 to the plugin code ourselves. If you think we should, that should probably be another bug, this was the bug about it refusing to load, which has been fixed. I'm encountering the same issue even with the latest powerline after upgrade F23 to F24. I have both python-2.7.12-1.fc24.x86_64 and python3-3.5.1-12.fc24.x86_64 installed. --- $ vim Traceback (most recent call last): File "<string>", line 9, in <module> ImportError: No module named powerline.vim An error occurred while importing powerline module. This could be caused by invalid sys.path setting, or by an incompatible Python version (powerline requires Python 2.6, 2.7 or 3.2 and later to work). Please consult the troubleshooting section in the documentation for possible solutions. Unable to import powerline, is it installed? Press ENTER or type command to continue $ vim --cmd 'let g:powerline_pycmd="python3"' You need vim compiled with Python 2.6, 2.7 or 3.2 and later support for Powerline to work. Please consult the documentation for more details. Press ENTER or type command to continue $ rpm -qa powerline vim* vim-minimal-7.4.1868-1.fc24.x86_64 powerline-2.4-3.fc24.x86_64 vim-enhanced-7.4.1868-1.fc24.x86_64 vim-common-7.4.1868-1.fc24.x86_64 vim-powerline-2.4-3.fc24.noarch vim-filesystem-7.4.1868-1.fc24.x86_64 vim-X11-7.4.1868-1.fc24.x86_64 --- Nevermind, I believe it's something need to be updated in the vundle of 'jmcantrell/vim-virtualenv'. |