Jump to content

Search the Community

Showing results for tags 'anaconda'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 2 results

  1. The app I am working on needs to support running Octave (GNU answer to Matlab) scripts. My approach is to use Python4Delphi to enable Python scripting in my Delphi app, which works fine. (Note: I have other uses for Python scripting in other areas of the app.) In the Python scripts, I am using Oct2Py to connect to Octave. Because Oct2Py requires NumPy and SciPy, my Python installation is recent Anaconda, which comes with those packages pre-installed. After much trial and error, with great help from here and Stack Overflow, I got it all working. But... Yesterday I tried to set up the app on my client's machine and I couldn't get it to work. The problem is shown with the following two-line Python script: from oct2py import Oct2Py octave = Oct2Py() I'm not sure, but I believe the first line is the problem; if not that, then the second. The following message is displayed: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy c-extensions failed. This error can happen for different reasons, often due to issues with your setup. If I run the exact same script from an Anaconda shell (i.e. from the Python shell), it works correctly, so Anaconda/Oct2Py/Octave is working correctly. When run from my Delphi app, it fails with that error. Other Python can run correctly from my Delphi app, so the basic Python4Delphi mechanism seems to be working. It is the whole Delphi/Python4Delphi/Oct2Py/Octave chain that fails, on that machine (Windows 10; mine is Windows 11 - I have not been able to find any differences of significance yet!). I think the key question is why Numpy appears broken to scripts running via TPythonEngine vs. the Anaconda shell? Any ideas? For reference, this is the procedure I followed when installing everything on my client's computer: 1. Install Anaconda (https://repo.anaconda.com/archive/Anaconda3-2022.05-Windows-x86.exe) for All Users as administrator 2. Install Octave (https://ftpmirror.gnu.org/octave/windows/octave-8.2.0-w32-installer.exe) the same way. 3. In Anaconda admin shell, install oct2py (conda install -c conda-forge oct2py) 4. Make sure PATH is set to point to Anaconda correctly 5. Add system variable OCTAVE_EXECUTABLE to point to octave-cli.exe
  2. 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.
×