New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to support Python 3 #994
Conversation
I get this error trying to build using python and boost installed via homebrew, any thoughts on how to make sure this works for anaconda and brew installs on os x?
|
Check and see if you're linking against libboost-python.so built for Python 3.5 or for other versions of Python. Very likely you're linking against libboost-python.so built for Python 2.7. |
@@ -8,7 +8,8 @@ | |||
# $(error Please run 'make' at the top level only) | |||
#endif | |||
|
|||
PYTHON_VERSION = 2.7 | |||
# change this to 2.7 for Python 2.7 | |||
PYTHON_VERSION = 3 | |||
PYTHON_INCLUDE = $(shell python$(PYTHON_VERSION)-config --includes) | |||
PYTHON_LDFLAGS = $(shell python$(PYTHON_VERSION)-config --ldflags) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change this line to get it to build appropriately for 3 or 2.7
ifeq "$(PYTHON_VERSION)" "3"
PYTHON_LIBS = -l boost_python3
else
PYTHON_LIBS = -l boost_python
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "-l boost_python3" part cannot be counted on to work in all systems. In my Ubuntu system using Boost from the APT package libboost-all-dev, there's no libboost_python3.so. libboost_python.so is just a symbolic link that originally points to Boost Python library for Python 2.7, I manually changed this symbolic link to point to Boost Python library for Python 3.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, that's unfortunate. I wonder if there's another way to find the correct library automatically?
yes that was it, thanks |
also for posterity, if we're going to switch to python3 as the default in the Makefile when people run into this error:
it means you are trying to run the pylibvw compiled for python3 with python2 |
@hal3 Can you take a close look at this? |
I want to have a broader discussion on the list about this one. My
W.r.t. 1, can the right version of python be autodetected rather than What is needed to make problems with 2 go away? I realize that a python More generally, there is a question about which version of python we should -John On Tue, May 24, 2016 at 12:56 PM, Coveralls notifications@github.com
|
My impression is that most people still use 2.7 and not 3. It would be For me, at least, it's very important not to lose l2s. On 05/25/2016 02:29 PM, John Langford wrote:
|
wrt 1) |
Compared to say a couple of years ago, support for Python 3 (3.4 onwards) in the popular numerical packages (e.g. numpy, scipy, sklearn) has definitely matured that there are no major obstacles that I'm aware of using those packages in Python 3. This page also adds some context on the recent (as of August 2015) status of Python 2 vs 3: http://ncoghlan-devs-python-notes.readthedocs.io/en/latest/python3/questions_and_answers.html The ideal case is to support both Python 2.7 and 3.x equally so that there are no discernible differences when using either Python version, I think this is now the case in numpy, scipy, and sklearn. I also think it is a good idea to manage the installation of the Python package of VW through setuptools, which is typically used in most Python packages these days. Time permitting, I can look into this. |
Please do look into Python 2.7+3 support. That sounds quite good if we can get it. |
I just added some improvements to get the wrapper to work with setuptools and ultimately be installable using pip via PyPI. #1012 Will need to merge changes made here into that if it is pulled in. Also, regardless of the change to the Makefile we should merge in the python3 updates since they are still compatible with Python 2. At least we can move forward there, and then we can work through how to resolve building pylibvw.so appropriately for Python 2-3 as a separate issue. |
Closing as this one has been incorporated in #1052 . |
Tested on Anaconda Python running Python 2.7 and Python 3.5 running on Ubuntu. In python/Makefile, PYTHON_VERSION needs to be modified to the appropriate version. Learning_to_Search.ipynb not converted yet (when run on Python 2.7 and 3.5, it crashes the kernel).