-
Notifications
You must be signed in to change notification settings - Fork 81
Fix velox dylib loading paths for conda build on macos #355
Conversation
packaging/torcharrow/meta.yaml
Outdated
| - libsodium | ||
| {{ environ.get('CONDA_PYTORCH_CONSTRAINT') }} | ||
| - pytorch | ||
| # {{ environ.get('CONDA_PYTORCH_CONSTRAINT') }} |
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.
shall we just remove this?
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.
yeah I'm experimenting with this, sometimes having the pytorch nightly build as a dependency can make conda confused when installing. Previously I thought it was solved by only leaving pytorch in the "run" section, but it actually didn't solve the problem. Just having pytorch here seems to be simpler.
| - BUILD_VERSION | ||
| - CPU_TARGET | ||
|
|
||
| #GitHub Actions usually provide Mac without AVX2 support, for now just skip the test until Velox can be run without AVX2 |
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.
so the test is already enabled now, 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.
yep, that's why I'm removing the stale comment here.
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.
You might need to add command pytest --no-header -v torcharrow/test back the test
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.
yeah here I'm only running an import test for now. For some reason the last time I ran the tests, there were some ones failing on some path comparison issues (don't remember the details, but something like comparing './abc' to 'abc failed). This will go into another PR to investigate.
packaging/torcharrow/meta.yaml
Outdated
| - glog==0.4.0 | ||
| - libsodium | ||
| {{ environ.get('CONDA_PYTORCH_CONSTRAINT') }} | ||
| - pytorch |
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.
curious: why do we need to build with pytorch? (since we don't build text UDFs by default)
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.
this is in the run section, which specifies the dependencies needed to use torcharrow. I think torcharrow still imports pytorch right?
|
Ok after a million times of trial-and-error, I finally found a way to adjust the recipe to
The most tricky part is perhaps in step 2, because conda build doesn't provide a good entry point to do a final change before it packages everything into a .tar.bz2 file. Adding stuff after Since the conda package is just a .tar.bz2 file, the approach I ended up taking was to unpack it, install_name_tool, pack it again using the Now you should be able to run |
|
@bearzx has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
2 similar comments
|
@bearzx has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@bearzx has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| - typing | ||
| - tabulate | ||
| - pyarrow | ||
| - arrow |
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.
btw arrow on conda is a completely different lib ...
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.
right , or pyarrow i guess? https://arrow.apache.org/docs/python/install.html
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.
and arrow-cpp
| - arrow-cpp==8.0.0 | ||
| - cffi | ||
| - glog==0.4.0 | ||
| - glog==0.6.0 |
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.
anything changed on Velox side?
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 think velox always uses the glog installed from brew, which was recently updated from 0.5.0 to 0.6.0. Building with glog0.6.0 and running with glog0.4.0 will not work (some symbol not found error when running). However, the conda default channel hasn't updated to 0.6.0 yet, it only exists on conda-forge, hence this change.
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.
This is also why we need to specify -c conda-forge when installing.
wenleix
left a comment
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.
LGTM.
| @@ -0,0 +1,33 @@ | |||
| function fix_velox_dylib_paths() { | |||
| velox_so=$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.
nit: can we check there is exactly one parameter ?
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.
can you elaborate?
.github/workflows/nightly-conda.yml
Outdated
| rm ./${pkg_name}.tar.bz2 | ||
| cd ./${pkg_name} | ||
| source ../../../packaging/fix_conda_dylib_paths.sh |
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.
can we just use ${GITHUB_WORKSPACE}/packging/...?
Summary: In this PR I'm attempting to introduce a temporary workaround to fix the velox dylib issue, via a post-build hack. This is to make `conda install torcharrow` work out of the box. Currently, you will encounter an error of dylibs not found when velox is dlopen-ing them. This is because the location of those dylibs were determined at compile time. For example: `/usr/local/opt/gflags/lib/libgflags.2.2.dylib` was installed to a default location by `brew install`. We can specify the dylib dependencies in the conda recipe, but they will be installed to the conda environment locations, rather than the system ones (`/user/local/...`). As a result, the velox dylib (`_torcharrow.*.so`) won't be able to find those libraries. On macos there is a tool called `install_name_tool` that can change the dylib paths, my plan is to modify those dylib paths from absolute ones to `loader_path/...` so that the velox .so can find the dylibs installed by conda. Pull Request resolved: #355 Reviewed By: wenleix Differential Revision: D36956804 Pulled By: bearzx fbshipit-source-id: 2551910eaec0c52b59b769de67c52aae633bbbc6
|
This pull request was exported from Phabricator. Differential Revision: D36956804 |
Summary: In this PR I'm attempting to introduce a temporary workaround to fix the velox dylib issue, via a post-build hack. This is to make `conda install torcharrow` work out of the box. Currently, you will encounter an error of dylibs not found when velox is dlopen-ing them. This is because the location of those dylibs were determined at compile time. For example: `/usr/local/opt/gflags/lib/libgflags.2.2.dylib` was installed to a default location by `brew install`. We can specify the dylib dependencies in the conda recipe, but they will be installed to the conda environment locations, rather than the system ones (`/user/local/...`). As a result, the velox dylib (`_torcharrow.*.so`) won't be able to find those libraries. On macos there is a tool called `install_name_tool` that can change the dylib paths, my plan is to modify those dylib paths from absolute ones to `loader_path/...` so that the velox .so can find the dylibs installed by conda. Pull Request resolved: #355 Reviewed By: wenleix Differential Revision: D36956804 Pulled By: bearzx fbshipit-source-id: 0bf133a8cd9b63466706e355c7ac18004b807609
|
This pull request was exported from Phabricator. Differential Revision: D36956804 |
Summary: In this PR I'm attempting to introduce a temporary workaround to fix the velox dylib issue, via a post-build hack. This is to make `conda install torcharrow` work out of the box. Currently, you will encounter an error of dylibs not found when velox is dlopen-ing them. This is because the location of those dylibs were determined at compile time. For example: `/usr/local/opt/gflags/lib/libgflags.2.2.dylib` was installed to a default location by `brew install`. We can specify the dylib dependencies in the conda recipe, but they will be installed to the conda environment locations, rather than the system ones (`/user/local/...`). As a result, the velox dylib (`_torcharrow.*.so`) won't be able to find those libraries. On macos there is a tool called `install_name_tool` that can change the dylib paths, my plan is to modify those dylib paths from absolute ones to `loader_path/...` so that the velox .so can find the dylibs installed by conda. X-link: #355 Reviewed By: wenleix Differential Revision: D36956804 Pulled By: bearzx fbshipit-source-id: 720ce2fcc7815fdb0211f8b5d9d72f9d817f6080
In this PR I'm attempting to introduce a temporary workaround to fix the velox dylib issue, via a post-build hack. This is to make
conda install torcharrowwork out of the box.Currently, you will encounter an error of dylibs not found when velox is dlopen-ing them. This is because the location of those dylibs were determined at compile time. For example:
/usr/local/opt/gflags/lib/libgflags.2.2.dylibwas installed to a default location bybrew install.We can specify the dylib dependencies in the conda recipe, but they will be installed to the conda environment locations, rather than the system ones (
/user/local/...). As a result, the velox dylib (_torcharrow.*.so) won't be able to find those libraries.On macos there is a tool called
install_name_toolthat can change the dylib paths, my plan is to modify those dylib paths from absolute ones to@loader_path/...so that the velox .so can find the dylibs installed by conda.