diff --git a/bmtk/analyzer/spikes_analyzer.py b/bmtk/analyzer/spikes_analyzer.py index af77187a6..f03778f9d 100644 --- a/bmtk/analyzer/spikes_analyzer.py +++ b/bmtk/analyzer/spikes_analyzer.py @@ -24,8 +24,8 @@ import numpy as np try: - from distutils.version import LooseVersion - use_sort_values = LooseVersion(pd.__version__) >= LooseVersion('0.19.0') + from packaging.version import Version + use_sort_values = Version(pd.__version__) >= Version('0.19.0') except: use_sort_values = False diff --git a/bmtk/utils/compile_mechanisms/compile_mechanisms.py b/bmtk/utils/compile_mechanisms/compile_mechanisms.py index c8b72f890..25951054f 100644 --- a/bmtk/utils/compile_mechanisms/compile_mechanisms.py +++ b/bmtk/utils/compile_mechanisms/compile_mechanisms.py @@ -1,7 +1,7 @@ import os import logging from subprocess import call -from distutils.dir_util import copy_tree +from shutil import copytree logger = logging.getLogger(__name__) @@ -28,4 +28,4 @@ def copy_modfiles(mechanisms_dir, cached_dir=None): cached_dir = os.path.join(local_path, '..', 'scripts/bionet/mechanisms') logger.info('Copying mod files from {} to {}'.format(cached_dir, mechanisms_dir)) - copy_tree(cached_dir, mechanisms_dir) + copytree(cached_dir, mechanisms_dir, dirs_exist_ok=True) diff --git a/bmtk/utils/create_environment/env_builder.py b/bmtk/utils/create_environment/env_builder.py index 8705de731..c7194d1be 100644 --- a/bmtk/utils/create_environment/env_builder.py +++ b/bmtk/utils/create_environment/env_builder.py @@ -27,7 +27,7 @@ from subprocess import call from collections import OrderedDict import logging -from distutils.dir_util import copy_tree +from shutil import copytree from bmtk.utils.compile_mechanisms import copy_modfiles, compile_mechanisms @@ -270,7 +270,7 @@ def _create_components_dir(self, components_dir, with_examples=True): if with_examples: logger.info(' Copying files from {}.'.format(src_dir)) - copy_tree(src_dir, trg_dir) + copytree(src_dir, trg_dir, dirs_exist_ok=True) # return components_config self._circuit_config['components'] = components_config diff --git a/bmtk/utils/sim_setup.py b/bmtk/utils/sim_setup.py index 3bd061efd..6fe97142f 100644 --- a/bmtk/utils/sim_setup.py +++ b/bmtk/utils/sim_setup.py @@ -29,7 +29,7 @@ from optparse import OptionParser from collections import OrderedDict import logging -from distutils.dir_util import copy_tree +from shutil import copytree logger = logging.getLogger(__name__) @@ -248,7 +248,7 @@ def _create_components_dir(self, components_dir, with_examples=True): if with_examples: logger.info(' Copying files from {}.'.format(src_dir)) - copy_tree(src_dir, trg_dir) + copytree(src_dir, trg_dir, dirs_exist_ok=True) # return components_config self._circuit_config['components'] = components_config @@ -852,4 +852,4 @@ def membrane_report_parser(option, opt, value, parser): elif target_sim == 'filternet': build_env_filternet(base_dir=base_dir, network_dir=options.network_dir, tstop=options.tstop, include_examples=options.include_examples, - config_file=options.config_file) \ No newline at end of file + config_file=options.config_file)