Skip to content

Commit

Permalink
CondaInstaller: Separate path for conda on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
astaric committed Oct 16, 2017
1 parent c93de13 commit 7f273f5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Orange/canvas/application/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,10 +861,24 @@ def manual_uninstall(self, dist):

class CondaInstaller:
def __init__(self):
self.conda = self._find_conda()

def _find_conda(self):
executable = sys.executable
bin = os.path.dirname(executable)

# posix
conda = os.path.join(bin, "conda")
self.conda = conda if os.path.exists(conda) else None
if os.path.exists(conda):
return conda

# windows
conda = os.path.join(bin, "Scripts", "conda.bat")
if os.path.exists(conda):
# "activate" conda environment orange is running in
os.environ["CONDA_PREFIX"] = bin
os.environ["CONDA_DEFAULT_ENV"] = bin
return conda

def install(self, pkg):
cmd = ["conda", "install", "--yes", pkg.name]
Expand Down

0 comments on commit 7f273f5

Please sign in to comment.