Comments (25)
I had to add this to get mine to work:
python import sys; sys.path.append("/usr/local/lib/python2.7/site-packages/")
OSX Lion, brew, macvim. I tried the above approaches and wasn't able to get it working.
from powerline.
That's strange. What's the output when you run this inside vim:
python import sys; print(sys.path)
from powerline.
python import sys; print(sys.path)
['/usr/lib/python27.zip', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-darwin', '/usr/lib/python2.7/plat-mac', '/usr/lib/pyt
hon2.7/plat-mac/lib-scriptpackages', '/usr/Extras/lib/python', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/us
r/lib/python2.7/lib-dynload']
Press ENTER or type command to continue
from powerline.
Works now.
It was missing the following path: /Library/Python/2.7/site-packages
I added this: python import sys; sys.path.append("/Library/Python/2.7/site-packages")
above: python from powerline.ext.vim import source_plugin; source_plugin()
in my vimrc
This is a fresh new install of OSX, This might want to get added to the readme somewhere as to help those who run into this same issue on OSX.
from powerline.
It shouldn't really be necessary to manually append the path if you've installed the package system-wide, but if you installed it local to your user it may act differently on OS X. Anyways, I'll add some info about this to the troubleshooting section of the docs for others who may run into the same issue.
from powerline.
I did check to make sure that powerline was in fact installed system-wide, It seems as though on a new installation of Mac OSX 10.8.2 Mountain Lion that the '/Library/Python/x.x/site-packages' is not in the PYTHONPATH for vim by default.
from powerline.
I had this problem too and got it resolved.
System Vim and System Python
$ port select python
Available versions for python:
none (active)
python25-apple
python26
python26-apple
python27
python27-apple
in /usr/bin/vim:
:python import sys; print(sys.path)
['/usr/lib/python27.zip', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-darwin', '/usr/lib/python2.7/plat-mac', '/usr/lib/python2.7/plat-mac/lib-scriptpackages
', '/usr/Extras/lib/python', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload']
System Vim and MacPorts' Python
$ sudo port select python python27
Selecting 'python27' for 'python' succeeded. 'python27' is now active.
:python import sys; print(sys.path)
['/Users/hanfei/.config/powerline', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/powerline', '/opt/local/Library/Fra
meworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg', '/Library/Python/2.7/site-packages/readline-6.2.2-py2.7-macosx-10.7-inte
l.egg', '/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg', '/Library/Python/2.7/site-packages/gevent-1.0rc1-py2.7-macosx-10.8-intel.egg', '/usr/local/lib/
wxPython-unicode-2.8.12.1/lib/python2.7/site-packages', '/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode', '/opt/local/L
ibrary/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/opt/local/Libr
ary/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/opt/local/Library/Frameworks/Python.framework/Versions
/2.7/Extras/lib/python', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/opt/local/Library/Frameworks/Python.framework/Ver
sions/2.7/lib/python2.7/lib-old', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/opt/local/Library/Frameworks/Python
.framework/Versions/2.7/lib/python2.7/site-packages', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11
-py2.7.egg-info', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/PIL', '/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7']
This is not a system-wide python.
System Vim and Apple's Python
$ sudo port select python python27-apple
Selecting 'python27-apple' for 'python' succeeded. 'python27-apple' is now active.
:python import sys; print(sys.path)
['/Users/hanfei/.config/powerline', '/Library/Python/2.7/site-packages/powerline', '/Library/Python/2.7/site-packages/readline-6.2.2-py2.7-macosx-10.7-intel.egg
', '/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg', '/Library/Python/2.7/site-packages/gevent-1.0rc1-py2.7-macosx-10.8-intel.egg', '/usr/local/lib/wxPyt
hon-unicode-2.8.12.1/lib/python2.7/site-packages', '/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode', '/System/Library/F
rameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks
/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/F
rameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python'
, '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-o
ld', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/
python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/PIL', '/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7']
This should work.
MacVim and any version Python
:python import sys; print(sys.path)
['/Users/hanfei/.config/powerline', '/Library/Python/2.7/site-packages/powerline', '/Library/Python/2.7/site-packages/readline-6.2.2-py2.7-macosx-10.7-intel.egg
', '/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg', '/Library/Python/2.7/site-packages/gevent-1.0rc1-py2.7-macosx-10.8-intel.egg', '/usr/local/lib/wxPyt
hon-unicode-2.8.12.1/lib/python2.7/site-packages', '/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode', '/System/Library/F
rameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks
/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/F
rameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python'
, '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-o
ld', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/
python/PyObjC', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/PIL', '/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7']
This should work too.
from powerline.
I had the same issue with homebrew-installed python. I had to add /usr/local/lib/python2.7/site-packages
to my path.
from powerline.
I had the same issue. I'm using the system installed version of Python (2.7). Not homebrew.
# file /Library/Python/2.7/site-packages/powerline/ext/vim/powerline.vim
/Library/Python/2.7/site-packages/powerline/ext/vim/powerline.vim: ASCII Java program text
from vim:
:python import sys; print(sys.path)
['/usr/lib/python27.zip', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-darwin', '/usr/lib/python2.7/plat-mac', '/usr/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/Extras/lib/python', '/usr/lib/python2.7/lib-tk', '/
usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload']
Adding the following line above the powerline import in my vimrc fixed the issue:
python import sys; sys.path.append("/Library/Python/2.7/site-packages")
from powerline.
That's probably because you installed a seperate python (via brew or
something) and installed powerline into that python's site-packages instead
of the systems standard python site packages.
$ which python
^^ will probably say /usr/local/bin/python (which is not the system default
python)
Also sounds like you have /usr/local/bin in front of /usr/bin in you PATH.
OSX by default does not use /usr/local, 3rd party products like brew use
that location.
On Sunday, January 20, 2013, Anthony Cook wrote:
I had to add this to get mine to work:
python import sys; sys.path.append("/usr/local/lib/python2.7/site-packages/")
OSX Lion, brew, macvim. I tried the above approaches and wasn't able to
get it working.β
Reply to this email directly or view it on GitHubhttps://github.com//issues/39#issuecomment-12467215.
from powerline.
I did specify brew. Either way, this plugin is extremely finicky at this stage. And its worse if you're not a python developer, but have been using Powerline for a long time. Pretty much everything has to be ripped out and started over.
I wrote up my experiences getting the Vim (MacVim and Ubuntu commandline) module working, hopefully it helps someone else:
http://acook.github.com/powerline
from powerline.
I have an ImportError too and nothing works for me :
Error detected while processing /usr/local/lib/python2.7/site-packages/powerline/bindings/vim/powerline.vim:
line 10:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/powerline/core.py", line 10, in <module>
from powerline.lib import underscore_to_camelcase
File "/usr/local/lib/python2.7/site-packages/powerline/lib/__init__.py", line 1, in <module>
from powerline.lib.memoize import memoize # NOQA
File "/usr/local/lib/python2.7/site-packages/powerline/lib/memoize.py", line 8, in <module>
import tempfile
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 34, in <module>
from random import Random as _Random
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 47, in <module>
from os import urandom as _urandom
ImportError: cannot import name urandom
line 11:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'Powerline' is not defined
Press ENTER or type command to continue```
In vimrc :
python import sys; print(sys.path)
:
['/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framewo
rk/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg', '/Library/Python/2.7/site-packages/regetron-1.4-py2.7.egg', '/usr/local/lib/python2.7/site-packages/pip-1.2
.1-py2.7.egg', '/usr/local/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/us
r/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darw
in', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/p
ython2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/usr/local/Cellar/python/2.7.3/Frameworks/Python
.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.3/Frame
works/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/warez/Library/Python/2.7/lib/python/site-packages', '/Library/Python/2.7/site-packages', '/usr/local/lib/pyth
on2.7/site-packages', '/usr/local/lib/python2.7/site-packages/']
OS X 10.7.5, python (homebrew)
from powerline.
I was able to get this up and running successfully this morning, so I thought I would share the process.
I have it running with:
- iTerm2 1.0.0.20130201-nightly
- Python 2.7.3
- Vim 7.3.798
- Zsh 5.0.2
iTerm2
I used the latest nightly release from here: http://iterm2.com/nightly/latest
Python
I decided to try using Homebrew's version -- brew install python
gave me version 2.7.3.
Vim
I used a brew for this as well, using part of the install command in the docs. The brew for Vim requires Mercurial, but there wasn't anything special about that install.
brew install mercurial;
brew install vim --env-std --override-system-vim --enable-pythoninterp;
Modified $PATH
As others have noted, Homebrew installs things into /usr/local/bin
. Rather than try to deal with my existing $PATH declarations, I just commented out all of them in ~/.zshrc
and threw this at the top:
export PATH="/usr/local/bin:$PATH"
Installing Powerline
After making sure that the version of Python in my path was the correct one ( /usr/local/bin/python
), I basically just followed the instructions for OSX Installation.
pip install --user git+git://github.com/Lokaltog/powerline
- Added this to
~/.vimrc
:python from powerline.bindings.vim import source_plugin; source_plugin()
source /usr/local/lib/python2.7/site-packages/powerline/bindings/vim/plugin/source_plugin.vim
- Added this to
~/.zshrc
:. /usr/local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh
- And this went into
~/.tmux.conf
:source /usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf
I hope someone finds this helpful.
In case you're compiling Vim yourself, here's the big features list from my compile:
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
from powerline.
carwin, followed your steps. when i try to start Vim I get:
ImportError: No module named site
Any thoughts?
from powerline.
Same as above.
from powerline.
fixed with 8b8de32
Thx a lot !
from powerline.
I got Powerline running in Vim this evening using:
- Mac OS X 10.8.2
- Python 2.7.3
- Vim 7.3.831
- iTerm2 Build 1.0.0.20130210
Similar to carwin, I used brew to install Python 2.7.3, Mercurial, and standard Vim (not MacVim). Homebrew requires /usr/bin/local to be at the start of your path so that brew installs override anything else.
brew install vim --env-std --override-system-vim --enable-pythoninterp;
Installed Powerline via pip:
pip install --user git+git://github.com/Lokaltog/powerline
Now here's what I had to fix, the Powerline bindings filenames changed. Add this to .vimrc:
source /usr/local/lib/python2.7/site-packages/powerline/bindings/vim/plugin/powerline.vim
This got Powerline enabled in Vim, but I'm still having issues with the fonts. I do have the most recent patched version of Menlo for Powerline, and it works fine for the Powerline-inspired "agnoster" zsh theme. UTF-8 is set across the board, and iTerm2 is using the font.
from powerline.
Patching Menlo manually with fontforge from brew, and my system's Menlo font has fixed the fonts issue with Vim Powerline... my agnoster theme is no longer functioning properly. Strange.
Also, I was able to uninstall Powerline via pip and install it using Vundle, still working now.
Edit: I've fixed the agnoster oh-my-zsh theme to use the Powerline beta glyphs.
from powerline.
Using: Mountain Lion, MacVim and Homebrew
For me the problem was the Homebrew MacVim was not building against the Homebrew Python even with the Python flags set. This http://superuser.com/a/440982 post solved that problem for me by hacking the install script. I made the changes to my MacVim Homebrew install script and reinstalled it with the following command.
brew reinstall macvim --env-std --override-system-vim
And in my .vimrc.before
file:
set rtp+=~/.janus/powerline/powerline/bindings/vim
And in my .vimrc.after
file:
set guifont=Inconsolata-dz\ for\ Powerline:h12
from powerline.
Hi all. I pushed an update to Homebrew and now MacVim (and Vim in another commit) both build against system and against a (newer) brewed python. Brewed Python is preferred, if available. I tested the python bindings with powerline and works great for me now. We assume that this is a upstream issue with how (Mac)Vim builds on OS X, so now we pass -L ...
and -F ...
flags now to force brewed python - if you have a brewed Python. Note that you should upgrade your brewed python to 2.7.5 if not done already.
Downside is that we had to disable --with-python3
because the window just disappeared and Python 2.x bindings broke. We are waiting for upsteam in this case.
Oh, and don't rename anything in /System
, please.
But the good is brew install macvim
should just workβ’ as expected, again!
from powerline.
That's great. Thanks for the effort @samueljohn. π
from powerline.
When trying to install Powerline, it complained with
error: can't combine user with prefix, exec_prefix/home, or install_(plat)base
I am running on 10.8.4 using a brew-installed Python 2.7.5.
The solution was simple and is documented on http://stackoverflow.com/questions/4495120/combine-user-with-prefix-error-with-setup-py-install
Cheers
from powerline.
I got the powerline (kinda) working, but not the zsh bindings. When I source the powerline.zsh file I get a command not found error:
zsh: command not found: powerline
from powerline.
If you use brew to install python, you can just run without the --user
option. #552 (comment)
from powerline.
Yes, see my comment there #552 (comment)
from powerline.
Related Issues (20)
- No such file or directory (sometimes) HOT 1
- metadata-generation-failed when installing on on python 3.11/macOS 12 HOT 1
- setup fails for development version of tmux HOT 1
- Centre segments section HOT 1
- Logging test fail on python 3.8+
- Is it possible to set a highlight group for the environment variable segment? HOT 1
- Powerline doesn't working on Ubuntu 22.04.3 and bash
- Color and colorshemes override not working - gnome terminal - shell HOT 3
- powerline.segments.common.net.internal_ip HOT 2
- TMUX_VAR_RE does not use raw string, leading to SyntaxWarning with python 3.12
- powerline deprecation warning
- [feature] json schema support HOT 1
- The imp module is removed in Python 3.12 HOT 4
- Questions about Copilot + Open Source Software Hierarchy
- Questions about Copilot + Open Source Software Hierarchy
- does powerline works for csh HOT 4
- Terminal graphics donβt work correctly in Fedora 40 KDE HOT 2
- fuzzy_time segment prints "o'clock three" instead of "three o'clock" HOT 2
- Weather segment broken (Bad Yahoo Weather SSL Cert) in RHEL 9
- Apt package missing bash bindings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powerline.