install_utils#

Utilities module with minimal dependencies (standard library only) for installation

class CondaPackage(line: str)[source]#

Bases: object

property comment#
property name#
split_pattern = re.compile('^(?P<name>[\\w\\.\\-]+)(?P<version>[\\s=><,]+[\\d\\.\\*]+)?(?:\\s*(?P<comment>\\#.*))?$')#
property version#
class CondaParser[source]#

Bases: object

static get_conda_pkg_info(pkg_name, channels, version_pattern)[source]#
static pkg_to_v_string(pkg)[source]#
class EnvFileManager(cfg_path, dest_path)[source]#

Bases: object

add_channel(channel_name)[source]#
add_dependency(package_name, pkg_version='')[source]#
add_pip_dependency(package_name)[source]#
add_pip_option(option)[source]#
get_env_name()[source]#
get_package_version(package_name)[source]#
patch_env_var(var_name, var_val)[source]#
patch_environment_package_line(package_name, pkg_version='', comparison_operator='=')[source]#

Patch the yaml environment file

Parameters:
  • package_name

  • pkg_version

Returns

remove_channel(channel_name)[source]#
remove_dependencies(package_names)[source]#
remove_dependency(package_name)[source]#
write()[source]#
property python_version#
class PytorchVersionManager(cfg_path, python_version, pytorch_version='1.11')[source]#

Bases: object

static assert_cuda()[source]#
static check_pytorch()[source]#
get_best_match_cuda_version(versions)[source]#
get_pytorch_cpu_info()[source]#
get_pytorch_gpu_info()[source]#
get_toolkit_info()[source]#
get_toolkit_versions()[source]#
match_pytorch_to_cuda()[source]#
match_pytorch_to_toolkit()[source]#
toolkit_dep_to_version(dep_str)[source]#
toolkit_version_from_torch_pkg(pkg)[source]#
torch_build_to_cuda_version(build)[source]#
property cuda_major#
property cuda_version#
property pytorch_info#
patch_env(cfg_path, dest_path, use_cuda_torch=True, pip_mode=False, use_spyder=False, tmp_dir=None)[source]#

Patch the environment file to match the desired configuration. This is mostly to get a working pytorch installation with the correct cuda version.

Parameters:
  • cfg_path

  • dest_path (str) – If evaluates to False, the cfg_path is overwritten

  • use_cuda_torch (bool) – If True, install pytorch with cuda support

  • pip_mode (bool) – If True, install pytorch with pip (since the nvidia channel is now considered a paid channel)

  • use_spyder

  • tmp_dir

Returns

set_elastix_path(elastix_path)[source]#