diff --git a/Makefile b/Makefile index 6e8513e06c..c8edb5d650 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ # Setting variables SHELL := /bin/bash +PIP_INSTALL := python3 -m pip install +PIP_UNINSTALL := python3 -m pip uninstall ## Install directories ifeq ($(shell id -u), 0) # is root @@ -146,8 +148,8 @@ dev-install: .PHONY: uninstall uninstall: - -pip3 uninstall -y nni - -pip3 uninstall -y nnictl + -$(PIP_UNINSTALL) -y nni + -$(PIP_UNINSTALL) -y nnictl -rm -rf $(INSTALL_PREFIX)/nni -rm -f $(BIN_PATH)/nnimanager -rm -f $(BIN_PATH)/nnictl @@ -222,10 +224,10 @@ install-node-modules: .PHONY: install-dev-modules install-dev-modules: #$(_INFO) Installing Python SDK $(_END) - cd src/sdk/pynni && pip3 install $(PIP_MODE) -e . + cd src/sdk/pynni && $(PIP_INSTALL) $(PIP_MODE) -e . #$(_INFO) Installing nnictl $(_END) - cd tools && pip3 install $(PIP_MODE) -e . + cd tools && $(PIP_INSTALL) $(PIP_MODE) -e . mkdir -p $(INSTALL_PREFIX)/nni diff --git a/src/nni_manager/common/utils.ts b/src/nni_manager/common/utils.ts index ba0650ef28..f272ea22b1 100644 --- a/src/nni_manager/common/utils.ts +++ b/src/nni_manager/common/utils.ts @@ -161,10 +161,6 @@ function parseArg(names: string[]): string { function getMsgDispatcherCommand(tuner: any, assessor: any): string { let command: string = `python3 -m nni --tuner_class_name ${tuner.className}`; - if (process.env.VIRTUAL_ENV) { - command = path.join(process.env.VIRTUAL_ENV, 'bin/') +command; - } - if (tuner.classArgs !== undefined) { command += ` --tuner_args ${JSON.stringify(JSON.stringify(tuner.classArgs))}`; } diff --git a/src/nni_manager/core/nnimanager.ts b/src/nni_manager/core/nnimanager.ts index 48d9fa3c83..f562598b11 100644 --- a/src/nni_manager/core/nnimanager.ts +++ b/src/nni_manager/core/nnimanager.ts @@ -236,14 +236,16 @@ class NNIManager implements Manager { newCwd = cwd; } // TO DO: add CUDA_VISIBLE_DEVICES + let nniEnv = { + NNI_MODE: mode, + NNI_CHECKPOINT_DIRECTORY: dataDirectory, + NNI_LOG_DIRECTORY: getLogDir() + }; + let newEnv = Object.assign({}, process.env, nniEnv); const tunerProc: ChildProcess = spawn(command, [], { stdio, cwd: newCwd, - env: { - NNI_MODE: mode, - NNI_CHECKPOINT_DIRECTORY: dataDirectory, - NNI_LOG_DIRECTORY: getLogDir() - }, + env: newEnv, shell: true }); this.dispatcherPid = tunerProc.pid;