Jump to content
Sign in to follow this  
Talal Bader

no success in loading MiniConda with recommended setup

Recommended Posts

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

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

 

 

image.thumb.png.20c32f7cc91feabb8b68694abff440e9.png

Edited by Talal Bader

Share this post


Link to post
  • 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 by pyscripter

Share this post


Link to post
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

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
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
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.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×