From 1a83514b728e863bd70a13d45712afdb9b4cd035 Mon Sep 17 00:00:00 2001
From: "Olivier J.N. Bertrand" <olivier.bertrand@uni-bielefeld.de>
Date: Mon, 26 Nov 2018 16:13:19 +0100
Subject: [PATCH] Add possibility to check blender installation

---
 README.md                                    | 12 ++++++++++++
 navipy/scripts/check_blender_versions_pip.py | 17 +++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 navipy/scripts/check_blender_versions_pip.py

diff --git a/README.md b/README.md
index a13a1d6..a0a57e5 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,18 @@ python setup.py install
 ```
 
 ## Blender-python version
+Navipy can be interfaced with blender. It is highly recommended to use the same version of packages of blender when doing so, in order to reduce problem of compatibility.
+To determine the packages that you will need, you can run the script: `navipy/script/check_blender_versions_pip.py` in blender or via commandline:
+
+```
+blender -b -P check_blender_versions_pip.py
+```
+
+It will create a textfile containing all packages used by blender. They can be installed in your virtualenvironment (prior to navipy) by doing:
+```
+pip install -r requirement.txt
+```
+
 | Blender version | Python version |
 | --------------- | -------------- |
 | 2.79b           | 3.5.3          |
diff --git a/navipy/scripts/check_blender_versions_pip.py b/navipy/scripts/check_blender_versions_pip.py
new file mode 100644
index 0000000..105511a
--- /dev/null
+++ b/navipy/scripts/check_blender_versions_pip.py
@@ -0,0 +1,17 @@
+"""
+List all installed packages in a python installation
+by using pip.
+
+It can be used to install a virtual environment, so that it matches
+another installation (for example blender)
+"""
+import pip
+
+
+installed_packages = pip.get_installed_distributions()
+installed_packages = sorted(["%s==%s" % (i.key, i.version)
+                             for i in installed_packages])
+with open('requirement.txt', 'w') as cfile:
+    for line in installed_packages:
+        print(line)
+        cfile.write(line+'\n')
-- 
GitLab