Skip to content

Commit

Permalink
Merge pull request #2843 from nicolossus/nestsonata_pandas
Browse files Browse the repository at this point in the history
NEST-SONATA: Enclose `pandas` import in `try` block
  • Loading branch information
heplesser authored Jun 28, 2023
2 parents 222055d + 23852a1 commit 2d2517a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pynest/nest/lib/hl_api_sonata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from pathlib import Path, PurePath

import numpy as np
import pandas as pd

from .. import pynestkernel as kernel
from ..ll_api import sli_func, sps, sr
Expand All @@ -34,6 +33,13 @@
from .hl_api_simulation import SetKernelStatus, Simulate
from .hl_api_types import NodeCollection

try:
import pandas as pd

have_pandas = True
except ImportError:
have_pandas = False

try:
import h5py

Expand Down Expand Up @@ -101,6 +107,9 @@ def __init__(self, config, sim_config=None):
if not have_h5py:
msg = "SonataNetwork unavailable because h5py is not installed or could not be imported"
raise kernel.NESTError(msg)
if not have_pandas:
msg = "SonataNetwork unavailable because pandas is not installed or could not be imported"
raise kernel.NESTError(msg)

self._node_collections = {}
self._edges_maps = []
Expand Down

0 comments on commit 2d2517a

Please sign in to comment.