Skip to content
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

Issue running buildingmotif on mac #342

Open
lazlop opened this issue Aug 27, 2024 · 13 comments
Open

Issue running buildingmotif on mac #342

lazlop opened this issue Aug 27, 2024 · 13 comments

Comments

@lazlop
Copy link

lazlop commented Aug 27, 2024

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?

@NREL NREL deleted a comment Aug 27, 2024
@NREL NREL deleted a comment Aug 27, 2024
@NREL NREL deleted a comment Aug 27, 2024
@TShapinsky
Copy link
Member

@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
Copy link
Author

lazlop commented Aug 27, 2024

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
Copy link
Member

@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
Copy link
Author

lazlop commented Aug 27, 2024

Yes! I have done that

@TShapinsky
Copy link
Member

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
Copy link
Member

@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
Copy link
Author

lazlop commented Aug 27, 2024

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
Copy link
Member

TShapinsky commented Aug 27, 2024

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

@lazlop
Copy link
Author

lazlop commented Aug 27, 2024

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

@lazlop
Copy link
Author

lazlop commented Aug 27, 2024

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

@TShapinsky
Copy link
Member

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

@lazlop
Copy link
Author

lazlop commented Aug 27, 2024

Yes confirmed, I have the libxml header files

@TShapinsky
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@TShapinsky @lazlop and others