Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

brew installed vim --with-python3 #20327

Closed
kenhan opened this issue Jun 7, 2013 · 22 comments
Closed

brew installed vim --with-python3 #20327

kenhan opened this issue Jun 7, 2013 · 22 comments

Comments

@kenhan
Copy link

kenhan commented Jun 7, 2013

I have python3 installed via homebrew. When I 'brew install vim --with-python3' vim installs successfully, and 'vim --version' shows ' +python3/dyn '

But when I open vim and do

:py3 print("hello")

it returns
E370: Could not load library Python.framework/Versioins/3.3/Python
E263: Sorry, this command is disabled, they Python library could not be loaded.

Can someone explain why vim --version shows +python3/dyn but it actually does not work? Thanks!

@samueljohn
Copy link
Contributor

I am going to investigate this. I know I built vim with python3 earlier and was able to print.

@ghost ghost assigned samueljohn Jun 8, 2013
@mbcoguno
Copy link
Contributor

Vim will drop all python linking flags while you build with enable both python2 and python3 binding. That is vim will not load homebrew's framework if you build vim this way.

@kenhan
Copy link
Author

kenhan commented Jun 10, 2013

@samueljohn Thanks for looking into it. Anything yet?
@mbcoguno Also, thanks. But when I brew install vim --with-python3 without --with-python it builds successfully, but vim --version shows +python/dyn AND +python3/dyn. Then :py3 print("hello") from inside vim still gives me the same error as before.

@kenhan
Copy link
Author

kenhan commented Jun 10, 2013

I had to explicitly pass --without-python while building vim: so
brew install vim --with-python3 --without-python built vim with python3 support, and :py3 print("hello") now works as expected.

@kenhan kenhan closed this as completed Jun 10, 2013
@mistydemeo
Copy link
Member

@samueljohn Is this expected?

@samueljohn
Copy link
Contributor

not solved yet. Reopening.

I assumed brew install vim --with-python3 installs for both python 2.x and 3.x. But note when you first issue an :python command inside vim (and perhaps from the .vimrc), vim will disable :python3 and vice versa. So The first command decides if you are running python 2.x or 3.x. At least that is what I got from testing.

But I have not completely looked into this.

@samueljohn samueljohn reopened this Jun 10, 2013
@samueljohn
Copy link
Contributor

For MacVim, I had to remove Python 3.x support because it caused the MacVim window to disappear and the 2.x Python was also not working.

But since ee0d6c0, python 2.x from homebrew should work with MacVim. I'll look into the vim issue here, next

@samueljohn
Copy link
Contributor

I label this upstream-issue. I don't know how to fix ...

@kenhan
Copy link
Author

kenhan commented Jun 12, 2013

Thanks for looking into it. In the mean time, can you revert it back to the way it use to be? I can't build vim with python3 enabled anymore no matter what argument I pass to brew install vim

@samueljohn
Copy link
Contributor

@kenhan I had to disable python 3.x support until someone is able to find a fix (perhaps upstream) because it breaks 2.x bindings and most people still use 2.x.

I'd love to have both bindings but MacVim seems to get confused.

@kenhan
Copy link
Author

kenhan commented Jun 12, 2013

@samueljohn I see. Thanks again!

@samueljohn
Copy link
Contributor

As a side-node: Brew does not complain if you pass options to brew install that are not available. This is hard to fix because you can see this as a feature because options are passed down to deps, so if some formula has --with-python, the deps are also automatically installed with this option.

@kenhan
Copy link
Author

kenhan commented Aug 3, 2013

Has there been any progress here? Still would like to have python3 support in vim.

@adamv
Copy link
Contributor

adamv commented Aug 23, 2013

There have been recent fixes to superenv/stdenv, as well as updates to Python and Vim in the last two months.

Can someone brew update and try this fresh?

@kenhan
Copy link
Author

kenhan commented Aug 23, 2013

Still no success building with python3 support. brew install vim --with-perl --with-ruby --with-python3 builds vim successfully with perl and ruby, but not python3, although it shows +python

Similarly, brew install vim --with-perl --with-ruby builds vim with +python.

@kenhan kenhan closed this as completed Aug 23, 2013
@samueljohn
Copy link
Contributor

@kenhan and if you disable Python 2.x by passing --without-python --with-python3 ? I guess building vim with both at the same time might be even trickier... (I have not tried)

@samueljohn
Copy link
Contributor

Can someone explain why vim --version shows +python3/dyn but it actually does not work? Thanks!

Vim's build system is strange. It detects python correctly but then fails to link because it does not use the recommended standard method of python-config --ldflags to figure out the linking parameter.

@samueljohn
Copy link
Contributor

Oh btw. we don't have an option --with-python3 for vim! So no surprise here. But pull requests that add depends_on :python3 and get vim's build system to use a brewed python3 are welcome.

@mbcoguno
Copy link
Contributor

#21366.
This is WIP. I can drop external frameworked Python now.

BTW, python[3]/dyn will loaded Python only from OSX defined location, like /Library/Frameworks.

@samueljohn
Copy link
Contributor

Can we patch (or inreplace) such that it used the actual python framework location and not the hard coded one?
In homebrew python.framework might help to get the dir.

@mbcoguno
Copy link
Contributor

@samueljohn Updated #21366 is done. Now vim can load brewed Python dynamic library using absolute path.

@samueljohn
Copy link
Contributor

@mbcoguno cool ... I'll check your PR. That is good news!

@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants