Talal Bader 0 Posted December 26, 2022 Hello, thank you for the great work of P4D first, I have a scientific package that needs to be installed in Conda environment, I follow the steps to run Miniconda as standalone python and using environment I need, the problem I am facing is that the job is run, the log says success with few millisecond but nothing showing up if someone can list for me the steps to get it done will be great. also it was recommended to : "add Format('%s;%0:s\Library\bin;', [Version.InstallPath] to your Windows path" for Conda to work, I am not sure what it means, do i have to copy this text and add it to my windows environment variables path? or this is something to be set inside my delphi project. thank you for PSD first and thank you for the help in advance Share this post Link to post
David Heffernan 2345 Posted December 26, 2022 I can't believe that modifying Windows path could be a wise thing to do in this scenario. Who advises that? Share this post Link to post
Talal Bader 0 Posted December 26, 2022 (edited) this is a snapshot of my settings for reference. my MiniConda installed under c:\MyApps\MConda38\ my environment to be used under c:\MyApps\MConda3\envs\pg Edited December 26, 2022 by Talal Bader Share this post Link to post
pyscripter 689 Posted December 26, 2022 (edited) You should not set VenvPythonExe. This is for environments created with venv and not Conda. The DLLName should be set before you call LoadDLL (e.g. in FormCreate) SetPythonHome: It should be called with the same directory as the DLLPath You may have to add the DLLPath to the environment path. Edited December 26, 2022 by pyscripter Share this post Link to post
Talal Bader 0 Posted December 26, 2022 41 minutes ago, pyscripter said: You should not set VenvPythonExe. This is for environments created with venv and not Conda. The DLLName should be set before you call LoadDLL (e.g. in FormCreate) SetPythonHome: It should be called with the same directory as the DLLPath You may have to add the DLLPath to the environment path. a HUGE thank you, following your comments, I moved all setting to form create, and did what you asked me to do, and now it works perfectly. procedure TForm1.FormCreate(Sender: TObject); begin MaskFPUExceptions(true); PythonEngine1.DllName := 'python38.dll'; PythonEngine1.DllPath := 'C:\MyApps\MConda38\envs\pg\' ; PythonEngine1.SetPythonHome('C:\MyApps\MConda38\envs\pg\'); PythonEngine1.UseWindowsConsole := False; //PythonEngine1.VenvPythonExe := 'C:\MyApps\MConda38\envs\pg\python.exe'; PythonEngine1.RegVersion := '3.8'; PythonEngine1.LoadDll; end; Share this post Link to post
pyscripter 689 Posted December 26, 2022 By the way, an easier way is to use PythonVersions. var PyVersion := PythonVersionFromPath('C:\MyApps\MConda38\envs\pg\'); PythonEngine1.Assign(PyVersion); PythonEngine1.LoadDLL; Share this post Link to post
Talal Bader 0 Posted December 26, 2022 38 minutes ago, pyscripter said: By the way, an easier way is to use PythonVersions. var PyVersion := PythonVersionFromPath('C:\MyApps\MConda38\envs\pg\'); PythonEngine1.Assign(PyVersion); PythonEngine1.LoadDLL; thanks for the extra info shared. I tried it same how you wrote it but it did not work , I tested it as below and it worked just fine var PyVersion:TPythonVersion; begin MaskFPUExceptions(true); if(PythonVersionFromPath('C:\MyApps\MConda38\envs\pg\', PyVersion)) then begin PyVersion.AssignTo(PythonEngine1); PythonEngine1.LoadDLL; end; not sure if this is caused by different versions or I am missing something. but indeed it is better way of doing it 🙂 Share this post Link to post
pyscripter 689 Posted December 26, 2022 4 hours ago, Talal Bader said: not sure if this is caused by different versions or I am missing something. but indeed it is better way of doing it 🙂 I was just writing code from memory without testing. What you did is fine. 1 Share this post Link to post