fjames 0 Posted October 30, 2020 After reading on the WIKI that PythonVersionsUnit can handle Anaconda distributions, I tested this using PythonVersionFromPath, and passing in the path to my base Anaconda distribution. While P4D correctly finds the Python DLL, it has no way of activating the anaconda environment. As such, if you try to import any of your modules that you installed with Anaconda, they will not work correctly. As an example, importing numpy returns an error that points you to: Numpy Error, where as if I activated the base anaconda environment first, no error would occur. Is there a way that P4D could activate the environment of the Anaconda distribution, that way you don't need to rely on default registered python if you need to import modules? Happy to provide any more information needed. Share this post Link to post
pyscripter 689 Posted October 31, 2020 Have you read https://github.com/pyscripter/python4delphi/wiki/MaskFPUExceptions? There is no need to activate the Anaconda environment. Just read and follow https://github.com/pyscripter/python4delphi/wiki/FindingPython. Quote Note also that for conda distributions to work properly, you need to add Format('%s;%0:s\Library\bin;', [Version.InstallPath] to your Windows path if it is not there already. If you want to work with a specific Conda environment (not the main installation) then you need to specify it as the DLLPATH. Share this post Link to post
fjames 0 Posted November 2, 2020 Apologies for having missed that comment hidden in the code snippet. Activating a Conda environment, essentially changes your Windows Path to point to the Bin folder for that environment. If I had that Bin folder in my path as the comment suggests, that would defeat the purpose of having separate environments. I see that what I need to do is essentially, while searching for Python distributions, if I find one within a Conda environment folder, I need to temporarily adjust the path to point to the env bin folder, and then restore it back to the original path later. Share this post Link to post