tbenthompson/okada_wrapper

Unable to use the library okada_wrapper

Closed this issue · 13 comments

Hello,
I'm trying to follow what's in
https://tbenthompson.com/book/tdes/sa_tdes.html , and I'm at the point in which I have to use okada_wrapper.
During the executing of test_okada.py (being careful using Python 3.10 for not having problems of deprecations with dstutils), I have the following error: "ImportError: DDL load failed while importing DC3D", referred to "from DC3D import dc3d0, dc3d" in the "okada_wrapper.py" file.
What am I missing?
Thank you in advance.

Hi! I'm guessing you haven't installed okada_wrapper! If you're using okada_wrapper rather than developing/modifying okada_wrapper, you should be able to install it using pip install okada_wrapper and you won't need to download the repository at all.

Let me know if that helps!

Hello,
Thank you for the rapid answer!
I installed okada_wrapper, the very first step I did was to execute the command "pip install okada_wrapper", and then I followed all the other steps to continue the workflow, so I have the package actually, it's just that it fails on importing DCD3

Hmm, I have a few ideas:

  1. Did you install okada_wrapper into the same Python installation that you are using to run the test_okada.py file. You can check this using the which command.
  2. Were they any errors when you ran the pip install okada_wrapper command?

Hello,
If I execute which to check where Python and okada_wrapper are, I obtain:
for Python:
C:\Users\Ospite\anaconda3\python.exe
C:\Users\Ospite\AppData\Local\Microsoft\WindowsApps\python.exe

for okada_wrapper:
Name: okada-wrapper
Version: 18.12.7.3
Summary: Python and MATLAB wrappers for the Okada Green's function codes
Home-page: https://github.com/tbenthompson/okada_wrapper
Author: Ben Thompson
Author-email: t.ben.thompson@gmail.com
License: MIT
Location: c:\users\ospite\anaconda3\lib\site-packages
Requires: numpy

When I ran pip install okada_wrapper I had no errors

The first result sticks out to me because it appears you have two different Python installations:

  • C:\Users\Ospite\anaconda3\python.exe
  • C:\Users\Ospite\AppData\Local\Microsoft\WindowsApps\python.exe

but maybe I'm misunderstanding?

From the location of okada_wrapper (c:\users\ospite\anaconda3\lib\site-packages) it looks like you'll need to be using the anaconda Python installation.

One other thing to try: Can you copy the test_okada.py file into a empty directory and run it from within that directory? That should rule out local path conflicts in the Python import resolution process.

Hello,
thank you for your advices. Following your tip, I still obtain the same importing error of DC3D. I also ensured to run the Anaconda Python installation

I'm sorry then. I'm 99% sure this is solvable but all the standard suggestions aren't working and I don't think I have enough information to help more.

It's ok, I thank you anyway for the availability and for the rapid interview!

Update: I solved!

Hurray! What solved it?

I moved all the DLL elements generated by okada_wrapper into the DLL repository of my Python, and it worked!
I'm following along the tutorial by trying to generate a mesh, I would like to compliment you again for the nice work and the tutorials.

Best regards

Thank you very much for your attempt and answer! I encountered the same problem, and following your method, I moved the DLL files from the DC3D folder to the Python DLLs folder, and the problem was successfully resolved.

Hi,
this is a common/large enough issue: F2PY out of the box on Windows... Since there isn't a simple solution and most people use Linux anyway, I personally can't dedicate time to make the meson build work on Windows as well, but I'm sure @tbenthompson or I would be happy to accept pull requests that fix the issue for Windows users.
Edit: See here and here.
Cheers