Skip to content

Commit 4b1c2a1

Browse files
tg359Fraser Greenroyd
authored and
Fraser Greenroyd
committed
Enabled installation of Referenced VirtualEnv handling nulls
1 parent bc5bd24 commit 4b1c2a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Python_Engine/Compute/InstallReferencedVirtualenv.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ public static oM.Python.PythonEnvironment InstallReferencedVirtualenv(
6767
string bhomPythonExecutable = baseEnv.Executable;
6868

6969
// set location where virtual env will be created
70-
string targetDirectory = Query.VirtualEnvDirectory(name);
70+
string targetDirectory = Path.Combine(Query.EnvironmentsDirectory(), name);
7171
if (!Directory.Exists(targetDirectory))
72+
{
7273
Directory.CreateDirectory(targetDirectory);
74+
}
7375

7476
// return existing env if it already exists
75-
oM.Python.PythonEnvironment env = new oM.Python.PythonEnvironment() { Name = name, Executable = Query.VirtualEnvPythonExePath(name) };
77+
oM.Python.PythonEnvironment env = new oM.Python.PythonEnvironment() { Name = name, Executable = Path.Combine(targetDirectory, "Scripts", "python.exe") };
7678
if (env.EnvironmentExists())
7779
{
7880
BH.Engine.Base.Compute.RecordNote($"The {name} environment already exists and is being returned here instead of installing it again. To install a fresh version of this environment, remove this environment first.");

0 commit comments

Comments
 (0)