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
Use setuptools to install python library on Mac #219
base: main
Are you sure you want to change the base?
Conversation
Hmmm I ran into some problems, I rebuilt main to main (successfully) to make sure it wasn't on my end. I ran When I try to build python:
Also btw when I try to build the nodejs, because of your updates to the swig interface file:
|
Yeah, I was expecting the nodejs build to break - I'll look into that before marking this for review. I'm not able to reproduce the issue you're having, though, even after removing and reinstalling (as best I can) the Python framework. I tried using Homebrew python to match your setup (I'm using the official install from https://www.python.org/downloads/), but then straightforwardly trying to run
I tried So I'm not sure how to faithfully reproduce your build environment, sorry :( |
@spectranaut With any luck, this is now actually working. Would you be able to try running it on your Mac when you have a chance? To install, one you have
This is a separate target from the rest of the install targets because you don't necessarily want to run If it's working for you, then I think it's ready for a review! |
examples/mac/CMakeLists.txt
Outdated
@@ -45,21 +45,3 @@ if (ACACIA_NODEJS) | |||
VERBATIM | |||
) | |||
endif (ACACIA_NODEJS) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the library is now installed globally, we no longer need to make sure we copy the library next to the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about someone who wants to develop and test but not install the library -- it seems to me that the install (ninja install
) and build (ninja
) should be different commands? In the build case, we should still do this step, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm that's a good point :) I'll revert this change, but later on perhaps as part of investigating virtual environments we could see whether there's a way to set up a venv for the example script.
|
||
[project] | ||
name = 'acacia_axapi' | ||
version = '0.0.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should eventually add a top-level metadata file with version, authors, license etc. but this will do for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay, success! It works for me! Curious about a few things.
|
||
``` | ||
brew install cmake | ||
brew install ninja | ||
brew install swig | ||
``` | ||
|
||
If you encounter a python3_LIBRARIES not found, try updating python with: | ||
Ensure you have Python frameworks installed. You can install Python using `brew`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is just for the python bindings, we probably should say.
Maybe we should have a ##### Python bindings
sub header here, and nodejs below?
examples/mac/CMakeLists.txt
Outdated
@@ -45,21 +45,3 @@ if (ACACIA_NODEJS) | |||
VERBATIM | |||
) | |||
endif (ACACIA_NODEJS) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about someone who wants to develop and test but not install the library -- it seems to me that the install (ninja install
) and build (ninja
) should be different commands? In the build case, we should still do this step, right?
We should make a follow up issue to install the node module, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so I ran this with the hopes we could finally land it, but even despite your revert, when I try to run build via "ninja" then run the example, it doesn't work:
~/repos/acacia/build 2:02PM> python3 ./examples/mac/dump_tree_axapi.py
Traceback (most recent call last):
File "/Users/valerieyoung/repos/acacia/build/./examples/mac/dump_tree_axapi.py", line 5, in <module>
import acacia_axapi
ModuleNotFoundError: No module named 'acacia_axapi'
But it turns out this is failing on main to! so we need to investigate. I'll make an issue. Otherwise this is approved.
Adds a custom
install_python
target that builds and installs a python library namedacacia_axapi
.