BuildingMOTIF icon indicating copy to clipboard operation
BuildingMOTIF copied to clipboard

Issue running buildingmotif on mac

Open lazlop opened this issue 1 year ago • 13 comments

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?

lazlop avatar Aug 27 '24 03:08 lazlop

@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.

TShapinsky avatar Aug 27 '24 03:08 TShapinsky

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)"'.

lazlop avatar Aug 27 '24 16:08 lazlop

@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.

TShapinsky avatar Aug 27 '24 16:08 TShapinsky

Yes! I have done that

lazlop avatar Aug 27 '24 16:08 lazlop

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 avatar Aug 27 '24 16:08 TShapinsky

@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

TShapinsky avatar Aug 27 '24 16:08 TShapinsky

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).

lazlop avatar Aug 27 '24 16:08 lazlop

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

TShapinsky avatar Aug 27 '24 17:08 TShapinsky

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

lazlop avatar Aug 27 '24 17:08 lazlop

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

lazlop avatar Aug 27 '24 17:08 lazlop

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

TShapinsky avatar Aug 27 '24 17:08 TShapinsky

Yes confirmed, I have the libxml header files

lazlop avatar Aug 27 '24 17:08 lazlop

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.

TShapinsky avatar Aug 27 '24 18:08 TShapinsky