diff --git a/pytplot/__init__.py b/pytplot/__init__.py
index <HASH>..<HASH> 100644
--- a/pytplot/__init__.py
+++ b/pytplot/__init__.py
@@ -5,8 +5,16 @@
 
 from _collections import OrderedDict
 from . import HTMLPlotter
+import os
 import sys
 
+# runs without Qt
+if not 'PYTPLOT_NO_GRAPHICS' in os.environ:
+    using_graphics = True
+else:
+    using_graphics = False
+
+
 # This variable will be constantly changed depending on what x value the user is hovering over
 class HoverTime(object):
     hover_time = 0
@@ -26,8 +34,6 @@ class HoverTime(object):
         return
 
 
-using_graphics = True
-
 try:
     import pyqtgraph as pg
     from pyqtgraph.Qt import QtWidgets
@@ -133,8 +139,9 @@ from pytplot.tplot_math import *
 # If we are in an ipython environment, set the gui to be qt5
 # This allows the user to interact with the window in real time
 try:
-    magic = get_ipython().magic
-    magic(u'%gui qt5')
+    if using_graphics:
+        magic = get_ipython().magic
+        magic(u'%gui qt5')
 except:
     pass
Allow users to import pytplot without graphics

Users can now import without Qt By setting PYTPLOT_NO_GRAPHICS
environment variable before importing pytplot.