-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileNotFoundError: cfunits requires UNIDATA UDUNITS-2. Can't find the 'udunits2' library.
on M2 Macbook Pro
#53
Comments
Thanks for reporting this and for all the detail which is really helpful, @wknoben. On our small dev team we don't have much Mac OS experience (we are hardcore Linux users) which means we can't readily investigate this, but we do have access to a Mac in the office so we may be able to look into it in due course (though I am currently working fully remotely for the foreseeable so this is unlikely to be soon). (And unless I am mistake, one can't legally get a VM for Mac OS.) I see from your report that you have followed the advice as quoted from the cfunits installation page, namely:
so there's not anything else I could suggest without the ability to play around on Mac OS myself, As a workaround for installation, I would otherwise suggest you use
Indeed, regardless having this report up will be helpful to other Mac users, so thanks again for the write up. Please do let us know here if you find a way to get it working with Mac OS, or a workaround that can be applied without |
I have this working on apple silicon ... but I can't remember what I did! Which isn't much help right now. ... I do have another Mac which I know doesn't have cf-python on it, so I'll have a go on that and see if I can a) recreate your problem, and b) work out what I must have done. Meanwhile, is the issue that you can't even |
@davidhassell I vaguely remember something about installing it from the GitHub version, can you recall what we did? I remember that I was stymied about something in the cf-python install, asked you to come in, and more or less instantly we got it going ... it was so instant that I never thought to document it :-( |
@sadielbartholomew Thanks for chiming in. Installing through Solution code for those looking for it:
|
@bnlawrence Thanks for taking a look. This prevents me from importing the package at all. |
@wknoben The memory archaeology I've done so far suggests that I probably ended up using mamba and the problem went away ... can you not install |
Possibly, I haven't tried that yet. In my experience that can get messy but it may be worth it if it's the only way to make things work. |
Should it be useful, I got around this by setting the DYLD_LIBRARY_PATH envar from inside python before trying to import the package. import os
os.environ["DYLD_LIBRARY_PATH"] = "/opt/homebrew/Cellar/udunits/2.2.28/lib/"
from cfunits import Units I think this is SIP that is sanitizing the |
I'm having some trouble getting cfunits to work on my M2 Macbook Pro. Installing
cfunits
3.3.6 reports no errors, but trying to import the package returns a library not found error:udunits
is present on the system:I (sequentially) tried setting paths and reinstalling
cfunits
to no avail:and
Further digging brings up to this related issue: https://github.com/orgs/Homebrew/discussions/3424.
Summary:
ctypes.util.find_library()
will look in/usr/lib
and/usr/local/lib
to findudunits2
but on newer Apple hardware libraries will be installed in/opt/homebrew
insteadcfunits/cfunits/units.py
Line 39 in fac74a5
The linked thread suggest setting a symlink will solve this, but on institutional machines (like mine), I wasn't able to make this work.
I don't know if this is solvable on
cfunits
's side of things, but it seemed good to at least document this in case anyone else runs into this.The text was updated successfully, but these errors were encountered: