From 1534a936843c377ad5ff8bd170924f96d41cd4ea Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Wed, 11 Apr 2018 16:17:20 +0200
Subject: [PATCH] Cleaned up deployment & install

- moved Dockerfiles into separate directory
- tests for minimal setup on ubuntu & conda
- adapted setup scripts to correctly handle dependencies
- new conda environment files for users and developers
---
 __init__.py                  |  1 +
 sympy_gmpy_bug_workaround.py | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 sympy_gmpy_bug_workaround.py

diff --git a/__init__.py b/__init__.py
index e13647ef8..3b6abc9dd 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,3 +1,4 @@
+import pystencils.sympy_gmpy_bug_workaround
 from pystencils.field import Field, FieldType
 from pystencils.data_types import TypedSymbol
 from pystencils.slicing import make_slice
diff --git a/sympy_gmpy_bug_workaround.py b/sympy_gmpy_bug_workaround.py
new file mode 100644
index 000000000..ce2bfa3c8
--- /dev/null
+++ b/sympy_gmpy_bug_workaround.py
@@ -0,0 +1,16 @@
+# Disable gmpy backend until this bug is resolved if joblib serialize
+# See https://github.com/sympy/sympy/pull/13530
+import os
+import warnings
+
+os.environ['MPMATH_NOGMPY'] = '1'
+try:
+    import mpmath.libmp
+    # In case the user has imported sympy first, then pystencils
+    if mpmath.libmp.BACKEND == 'gmpy':
+        warnings.warn("You are using the gmpy backend. You might encounter an error 'argument is not an mpz sympy'."
+                      "This is due to a known bug in sympy/gmpy library. "
+                      "To prevent this, import pystencils first then sympy or set the environment variable "
+                      "MPMATH_NOGMPY=1")
+except ImportError:
+    pass
-- 
GitLab