Closed pamdla closed 5 years ago
I'm not 100% I can help with this, but could you please give the full error message you're getting when trying to install?
This is correct - Python 3 is not supported at present (but we would always welcome patches to add such support!)
@tturocy Thank you for your confirmation. @robert-7 I tried to produce the exact error message I had encountered with Python3 in my virtual env, however I could not make it install while came to your comment&request.
E:\gambit-15.1.0\src\python>python setup.py install
running install
running bdist_egg
running egg_info
writing gambit.egg-info\PKG-INFO
writing top-level names to gambit.egg-info\top_level.txt
writing dependency_links to gambit.egg-info\dependency_links.txt
writing entry points to gambit.egg-info\entry_points.txt
reading manifest file 'gambit.egg-info\SOURCES.txt'
writing manifest file 'gambit.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
skipping 'gambit/lib\libgambit.cpp' Cython extension (up-to-date)
building 'gambit.lib.libgambit' extension
C:\Users\Tehnrry\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I../.. -I.. "-IC:\Program Files (x86)\Python\Python27\include" "-IC:\Program Files (x86)\Python\Python27\PC" /Tpgambit/lib\libgambit.cpp /Fobuild\temp.win-amd64-2.7\Release\gambit/lib\libgambit.obj
libgambit.cpp
C:\Users\Tehnrry\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
e:\gambit-15.1.0\src\libgambit\game.h(841) : warning C4290: C++ exception specification ignored except to indicate a function is not declspec(nothrow)
e:\gambit-15.1.0\src\libagg\proj_func.h(104) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
e:\gambit-15.1.0\src\libagg\trie_map.h(134) : error C3646: 'attribute' : unknown override specifier
e:\gambit-15.1.0\src\libagg\trie_map.h(577) : see reference to class template instantiation 'trie_map
Microsoft C++ is not a supported compiler. In fact building on Windows probably doesn't work, at least not without some doing.
Also, please do open a separate issue with a new question rather than hijacking an unrelated one - it helps keep people from getting confused.
I have been fiddling with making the code compatible with Python3. It requires 4 types of modifications (see e.g. http://python-future.org/compatible_idioms.html):
print x, y
raise Exception, str
from functools import reduce
try
clause around the dict in setup.py
All in all only the following files need to be modified:
modified: contrib/scripts/enumpoly/enumpoly.py
modified: src/python/gambit/games/meanstat.py
modified: src/python/gambit/gte.py
modified: src/python/gambit/levelk.py
modified: src/python/gambit/lib/behav.pxi
modified: src/python/gambit/lib/mixed.pxi
modified: src/python/gambit/lib/stratspt.pxi
modified: src/python/gambit/pctrace.py
modified: src/python/gambit/profiles.py
modified: src/python/gambit/qre.py
modified: src/python/setup.py
With these modifications, the same source builds using both python2.7 and python3.5 on Ubuntu 16.04. The nosetests also continue to pass.
I hesitate to do a pull request as I still have some installation issues:
gambit
gives an error that it can't find the nash
and gte
local modules. My understanding of the Python lookup mechanism is insufficient to resolve this. However, if someone would be willing to investigate it, I can do the pull request for the source modifications for Python3.
Many thanks for your interest in this very useful issue to be dealing with.
I would be available to help support a contribution on this. It would be useful to think first about the most practical way to organise it.
My own preference, based on the 2-to-3 conversions I have been doing with other code of mine, is to use futurize, and also possibly to work on changing one type of change per commit. This should make it somewhat easier to debug - as probably it would be a very good idea to add a few additional tests to exercise the parts of the code where changes are required.
Yeah, futurize
is the way to do this properly, making sure python2 users aren’t affected. I’ll also try and put up a Travis CI so that the py2/py3 dependencies are cleanly separated and documented and the tests automated after every commit.
Can’t promise a quick timeframe as this is purely a side project. I was trying to implement counter factual regret (CFR) minimization algorithms, and at first "only" wanted to use Gambit as a check on the equilibrium being computed. Then I realized the whole extensive form infrastructure was too nice not to use for CFR as well. :)
I'll be happy to have contributions as and when. I am fully booked the next few months but realistically I may be able to allocate some time in July and August to deal with the various pending packaging and Python 2/3 issues that are outstanding.
Commit b0f989d3 introduces Python3 support. Python 2.7 continues to be supported as well.
I downloaded gambit-15.1 from github, and installed to my python site-packages folder. However, it seems that I can ONLY install gambit with Python2.7, but Python3.5/Python3.6 will throw error that saying "dict is not writable".