pypest / pypestutils

python-wrapped PEST utilities #winning
The Unlicense
11 stars 6 forks source link

Missing DLL #13

Closed wkitlasten closed 10 months ago

wkitlasten commented 10 months ago

As mentioned today, I have special issues. I installed pypestutils using:

pip install pypestutils

and it shows up with conda list

pypestutils 0.1.0 pypi_0 pypi

But in exploring_w_structured_freyberg notebook I get the following:

sys.path.insert(0,"..")
from pypestutils.pestutilslib import PestUtilsLib
lib = PestUtilsLib()
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In [6], line 3
      1 sys.path.insert(0,"..")
      2 from pypestutils.pestutilslib import PestUtilsLib
----> 3 lib = PestUtilsLib()

File C:\modelling\pypestutils\examples\..\pypestutils\pestutilslib.py:36, in PestUtilsLib.__init__(self, logger_level)
     33 from .logger import get_logger
     35 self.logger = get_logger(self.__class__.__name__, logger_level)
---> 36 self.pestutils = load()
     37 self.logger.debug("loaded %s", self.pestutils)
     38 prototype(self.pestutils)

File C:\modelling\pypestutils\examples\..\pypestutils\finder.py:51, in load()
     49         finally:
     50             os.environ["PATH"] = oldenv
---> 51     raise OSError(f"could not find or load {lib_name}")
     53 elif os.name == "posix":
     54     # posix includes both mac and linux
     55     # use the extension for the specific platform
     56     if platform.system() == "Darwin":
     57         # macos shared libraries are `.dylib`

OSError: could not find or load pestutils.dll

I can't seem to find pypestutils or pestutils.dll anywhere in C:\Users\wesk\AppData\Local\mambaforge\envs\py39 but the Windoh$ surch is usually pretty worthless. I can't find the dll in the repo either, should it be?

jtwhite79 commented 10 months ago

I think I know whats wrong. That notebook is embarrassingly green and I added that sys.path.insert so that python would pickup my locally compiled experimental pestutilslib shared lib (at the one-up dir level). Can you restart your kernel and remove that line and see if t works now?

I'll clean this notebooks up soon (and also add a few more...).

wkitlasten commented 10 months ago

Yep! Still curious where the DLL gets stuffed.

purdy image

briochh commented 10 months ago

@wkitlasten, so the issue is that with that path insert in there python thinks that the actual pypestutils parent directory is your installed package, and goes looking there rather than wherever the pip install package lives.

wkitlasten commented 7 months ago

Hey, I never fully understood where the dll is located. I am fresh off holidays, a bit fuzzy(ier than usual), and on a new computer. I pulled from the repo and did pip install -e "." from the pypestutils dir:

I get a similar error when I run the exploring_lowlevel_pypestutils_functions (and other notebooks).

Does pip install -e "." cause python to look for the dll somewhere else, compared to pip install pypestutils?

If I do pip install pypestutils the files will not change if I pull from the repo unless I uninstall/reinstall pypestutils, correct?

mwtoews commented 7 months ago

Thanks for the reminder that I have a draft recipe that could potentially help put pypestutils and/or pestutils to conda-forge. One would then install just pestutils to get the compiled Fortran stuff, then they would be able to pip install -e . for the Python stuff. I'll see if I can get that idea rolling...