diff --git a/mocpy/tests/test_moc.py b/mocpy/tests/test_moc.py
index <HASH>..<HASH> 100644
--- a/mocpy/tests/test_moc.py
+++ b/mocpy/tests/test_moc.py
@@ -11,6 +11,13 @@ from astropy_healpix import HEALPix
 
 from ..moc import MOC, WCS
 
+# WARN PY2: turn off tkinter for python2 testing
+# with travis
+import sys
+if sys.version_info.major == 2:
+    import matplotlib
+    matplotlib.use('Agg')
+
 
 #### TESTING MOC creation ####
 def get_random_skycoords(size):
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ import sys
 from setuptools import setup, find_packages
 from setuptools_rust import RustExtension
 
-PYTHON_MAJOR_VERSION = sys.version_info[0]
+PYTHON_MAJOR_VERSION = sys.version_info.major
 
 exec(open('mocpy/version.py').read())
turn off tkinter for PY2