From ae2775f7b8585014ffe2afbf28a10f2d8e9dc9da Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Wed, 22 Jan 2020 11:22:43 +0200 Subject: [PATCH] Support poetry when agent is installed inside virtualenv --- trains_agent/helper/package/poetry_api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trains_agent/helper/package/poetry_api.py b/trains_agent/helper/package/poetry_api.py index c034d18..5f59d11 100644 --- a/trains_agent/helper/package/poetry_api.py +++ b/trains_agent/helper/package/poetry_api.py @@ -1,7 +1,9 @@ +from copy import deepcopy from functools import wraps import attr import sys +import os from pathlib2 import Path from trains_agent.helper.process import Argv, DEVNULL, check_if_command_exists from trains_agent.session import Session, POETRY @@ -56,6 +58,9 @@ class PoetryConfig: def run(self, *args, **kwargs): func = kwargs.pop("func", Argv.get_output) kwargs.setdefault("stdin", DEVNULL) + kwargs['env'] = deepcopy(os.environ) + kwargs['env'].pop('VIRTUAL_ENV', None) + kwargs['env'].pop('CONDA_PREFIX', None) if check_if_command_exists("poetry"): argv = Argv("poetry", *args) else: