NREL / BuildingMOTIF

Building Metadata OnTology Interoperability Framework (BuildingMOTIF)
https://buildingmotif.readthedocs.io/
Other
48 stars 6 forks source link

Issue running buildingmotif on mac #342

Open lazlop opened 2 weeks ago

lazlop commented 2 weeks ago

I'm having an issue on mac running poetry to install the dependencies for buildingmotif, particularly with installing lxml. I've tried a few fixes based on comments on stack exchange, but they haven't worked. Has anyone else experienced this?

TShapinsky commented 2 weeks ago

@lazlop what are the particulars of your setup (Python version, Mac os version, etc.) and what error are you seeing?

I exclusively use Mac for my environment and haven't had lxml issues. Though occasionally Mac can have issues where there aren't always python packages with the correct os version and Python version available.

lazlop commented 2 weeks ago

Python version: 3.11.4 macOS Version: 14.6.1 Error: In file included from src/lxml/etree.c:858: src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found

include "libxml/xmlversion.h"

       ^~~~~~~~~~~~~~~~~~~~~

1 error generated. Compile failed: command '/usr/bin/clang' failed with exit code 1 creating var creating var/folders creating var/folders/ff creating var/folders/ff/05grcg517lbgzyz6gz1m5x2c0000gq creating var/folders/ff/05grcg517lbgzyz6gz1m5x2c0000gq/T cc -I/usr/include/libxml2 -c /var/folders/ff/05grcg517lbgzyz6gz1m5x2c0000gq/T/xmlXPathInitr3sfqj0g.c -o var/folders/ff/05grcg517lbgzyz6gz1m5x2c0000gq/T/xmlXPathInitr3sfqj0g.o /var/folders/ff/05grcg517lbgzyz6gz1m5x2c0000gq/T/xmlXPathInitr3sfqj0g.c:1:10: fatal error: 'libxml/xpath.h' file not found

include "libxml/xpath.h"

       ^~~~~~~~~~~~~~~~

1 error generated.


Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? Perhaps try: xcode-select --install


error: command '/usr/bin/clang' failed with exit code 1

at ~/opt/anaconda3/lib/python3.11/site-packages/poetry/installation/chef.py:147 in _prepare 143│ 144│ error = ChefBuildError("\n\n".join(message_parts)) 145│ 146│ if error is not None: → 147│ raise error from None 148│ 149│ return path 150│ 151│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with lxml (4.9.2) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "lxml (==4.9.2)"'.

TShapinsky commented 2 weeks ago

@lazlop have you tried running xcode-select --install as noted in the error? I know there are a bunch of things on mac which depend on the xcode command line tools being installed.

lazlop commented 2 weeks ago

Yes! I have done that

TShapinsky commented 2 weeks ago

On my machine the headers for libxml are on the path /Library/Developer/CommandLineTools/SDKs/MacOSX<version>.sdk/usr/include/libxml you could maybe try checking there to see if xpath.h is there?

libxml should ship standard with MacOS, but the header files don't. xcode-select --install should install them, but if not maybe you can get them with brew?

TShapinsky commented 2 weeks ago

@lazlop Are you trying to install any extras or just base buildingMOTIF? it doesn't look like lxml is a dependency for the base functionality

lazlop commented 2 weeks ago

I was looking to install it as a developer (mostly because I wanted to use the most updated branch rather than what is on pypi).

TShapinsky commented 2 weeks ago

@lazlop what is the poetry command you're using to install it? In my environment lxml isn't even getting installed by buildingmotif...

lazlop commented 2 weeks ago

The command I used was: poetry install --with dev

lazlop commented 2 weeks ago

Both poetry install and poetry install --with dev had the same lxml issue

TShapinsky commented 2 weeks ago

@lazlop have you confirmed that you have the libxml header files on your machine?

lazlop commented 2 weeks ago

Yes confirmed, I have the libxml header files

TShapinsky commented 2 weeks ago

I assume you're on an apple silicon mac. It looks like lxml 4.9.2 does not provide arm64 supports (which is why it's trying and failing to build lxml) you could try bumping the version to 4.9.4 or manually installing this wheel into your poetry environment. 4.9.4 and upward provide universal packages for macos (x86_64 and arm64). I'm still confused as to why poetry is trying to install lxml at all as it isn't a buildingmotif dependency as far as I know. It looks like rdflib has lxml as an extra, though that isn't utilized by buildingMOTIF. To test this hypothesis you could also just try installing rdflib 7 on your system and seeing if that works.