@@ -389,7 +389,10 @@ def integers_as_exact(self):
389
389
return self .integers_as_exact
390
390
391
391
def __latex_override__ (expr , * arg ):
392
- from IPython import get_ipython
392
+ try :
393
+ from IPython import get_ipython
394
+ except ModuleNotFoundError :
395
+ pass
393
396
colab = False
394
397
try :
395
398
from google .colab import output
@@ -449,8 +452,12 @@ def __command_line_printing__(expr, *arg):
449
452
return print (tempstr + str (expr ) + labelstr )
450
453
451
454
# Now we inject the formatting override(s)
452
- from IPython import get_ipython
453
- ip = get_ipython ()
455
+ ip = None
456
+ try :
457
+ from IPython import get_ipython
458
+ ip = get_ipython ()
459
+ except ModuleNotFoundError :
460
+ ip = false
454
461
formatter = None
455
462
if ip :
456
463
# In an environment that can display typeset latex
@@ -485,7 +492,10 @@ def set_integers_as_exact():
485
492
mode of algebra_with_sympy. To turn this off call
486
493
`unset_integers_as_exact()`.
487
494
"""
488
- from IPython import get_ipython
495
+ try :
496
+ from IPython import get_ipython
497
+ except ModuleNotFoundError :
498
+ pass
489
499
if get_ipython ():
490
500
get_ipython ().input_transformers_post .append (integers_as_exact )
491
501
algwsym_config = get_ipython ().user_ns .get ("algwsym_config" , False )
@@ -506,7 +516,10 @@ def unset_integers_as_exact():
506
516
starts with `set_integers_as_exact()` enabled (
507
517
`algwsym_config.numerics.integers_as_exact = True`).
508
518
"""
509
- from IPython import get_ipython
519
+ try :
520
+ from IPython import get_ipython
521
+ except ModuleNotFoundError :
522
+ pass
510
523
if get_ipython ():
511
524
pre = get_ipython ().input_transformers_post
512
525
# The below looks excessively complicated, but more reliably finds the
@@ -544,7 +557,10 @@ def units(names):
544
557
"""
545
558
from sympy .core .symbol import symbols
546
559
#import __main__ as shell
547
- from IPython import get_ipython
560
+ try :
561
+ from IPython import get_ipython
562
+ except ModuleNotFoundError :
563
+ pass
548
564
syms = names .split (' ' )
549
565
user_namespace = None
550
566
retstr = ''
@@ -620,7 +636,6 @@ def solve(f, *symbols, **flags):
620
636
"""
621
637
from sympy .solvers .solvers import solve
622
638
from sympy .sets .sets import FiniteSet
623
- from IPython .display import display
624
639
newf = []
625
640
solns = []
626
641
displaysolns = []
0 commit comments