How to use the jovian.utils.error.CondaError function in jovian

To help you get started, we’ve selected a few jovian examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JovianML / jovian-py / jovian / utils / environment.py View on Github external
def get_conda_bin():
    """Get the path to the Anaconda binary"""
    conda_bin = 'conda'
    # Try executing the `conda` command
    if os.popen(conda_bin).read().strip() == '':
        # If it fails, look for $CONDA_EXE
        conda_exe = os.popen('echo $CONDA_EXE').read().strip()
        # Check if it returns a valid path
        if conda_exe != '' and conda_exe != '$CONDA_EXE':
            # Update binary and execute again
            conda_bin = conda_exe
            if os.popen(conda_bin).read().strip() == '':
                raise CondaError(CONDA_NOT_FOUND)
    logging.info('Anaconda binary: ' + conda_bin)
    return conda_bin
github JovianML / jovian-py / jovian / utils / environment.py View on Github external
def read_conda_env(name=None):
    """Read the anaconda environment into a string"""
    if name is None:
        name = get_conda_env_name()
    command = get_conda_bin() + ' env export -n ' + \
        get_conda_env_name() + " --no-builds"
    env_str = os.popen(command).read()
    if env_str == '':
        error = 'Failed to read Anaconda environment using command: "' + command + '"'
        raise CondaError(error)
    return env_str