tbenthompson / okada_wrapper

MATLAB and Python wrappers of the Okada Green's functions.
MIT License
67 stars 33 forks source link

Unable to use the library okada_wrapper #10

Closed navre6 closed 4 months ago

navre6 commented 6 months ago

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.

tbenthompson commented 6 months ago

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!

navre6 commented 6 months ago

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

tbenthompson commented 6 months ago

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?
navre6 commented 6 months ago

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

tbenthompson commented 6 months ago

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

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.

navre6 commented 6 months ago

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

tbenthompson commented 6 months ago

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.

navre6 commented 5 months ago

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

navre6 commented 5 months ago

Update: I solved!

tbenthompson commented 5 months ago

Hurray! What solved it?

navre6 commented 5 months ago

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

fewer123 commented 4 months ago

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.

tobiscode commented 4 months ago

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