Commit edac0b01 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[cmd] Improve imports of extra packages

parent aa768b15
......@@ -37,12 +37,6 @@ import networkx.algorithms.isomorphism as iso
import json
import csv
from urllib import quote as urllib_quote
# Remove matplotlib dependency
# It is used on demand during the drawing of a graph
try:
import matplotlib.pyplot as plt
except ImportError:
pass
# Library imports
from cadbiom.models.biosignal.sig_expr import *
......@@ -92,6 +86,17 @@ def draw_graph(output_dir, solution, solution_index, G,
:type edges_in_cond: <list>
:type edges: <list>
"""
try:
# Remove matplotlib dependency
# It is used on demand during the drawing of a graph
import matplotlib.pyplot as plt
except ImportError:
print(
"ImportError: 'matplotlib' packages is required for this task;\n"
"You might want to install 'cadbiom_cmd' with the following command:\n"
"'pip install cadbiom_cmd[matplotlib]'"
)
exit()
creation_date = dt.datetime.now().strftime("%H-%M-%S")
filename = "{}{}_{}_{}".format(
......
......@@ -35,13 +35,14 @@ import multiprocessing as mp
try:
import pandas as pd
import seaborn as sns
except ImportError:
except ImportError as e:
print(
"ImportError: 'seaborn' and 'pandas' packages are required for this task;\n"
"ImportError:", e,
". 'seaborn' and 'pandas' packages are required for this task;\n"
"You might want to install 'cadbiom_cmd' with the following command:\n"
"'pip install cadbiom_cmd[heatmaps]'"
)
raise
exit()
# Library imports
from tools.solutions import get_all_macs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment