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

ERROR: Could not find a version that satisfies the requirement tensorflow_text (from versions: none) #823

Open
yuyuan20 opened this issue Feb 1, 2022 · 49 comments
Labels
duplicate This issue or pull request already exists

Comments

@yuyuan20
Copy link

yuyuan20 commented Feb 1, 2022

I am using macOS version Monterey on my MI Air and for some reasons I can't install tensorflow text even though I installed tensorflow. When I run pip3 install tensorflow_text on terminal it says:

ERROR: Could not find a version that satisfies the requirement tensorflow_text (from versions: none)
ERROR: No matching distribution found for tensorflow_text

I have also tried using pip3 install tensorflow-text but the result is same. Is there any other way I can install this? Please help as I am very new to python. Regards.

@broken
Copy link
Member

broken commented Feb 1, 2022

We currently do not have a prebuilt pip package for M1s. Our release infra is tied to core tensorflow, so it will remain this way until they provide an option too. See #654

@broken broken added the duplicate This issue or pull request already exists label Feb 1, 2022
@broken
Copy link
Member

broken commented Feb 1, 2022

That said, we do have targets for building it yourself. View #756 for a healthy discussion on getting this working.

@broken
Copy link
Member

broken commented Feb 2, 2022

Regarding your failure:

++ sed -i 's/project_version = '\''REPLACE_ME'\''/project_version = '\''2.6.0'\''/' oss_scripts/pip_package/setup.nightly.py
sed: 1: "oss_scripts/pip_package ...": invalid command code o

The command looks different from what is checked in. The double quotes have been translated to single quotes, etc. Did you run some replacement utility over the files?

@yuyuan20
Copy link
Author

yuyuan20 commented Feb 2, 2022

Regarding your failure:

++ sed -i 's/project_version = '\''REPLACE_ME'\''/project_version = '\''2.6.0'\''/' oss_scripts/pip_package/setup.nightly.py
sed: 1: "oss_scripts/pip_package ...": invalid command code o

The command looks different from what is checked in. The double quotes have been translated to single quotes, etc. Did you run some replacement utility over the files?

No, I did this as per the Installation section. I cloned the repo and when I run this command ./oss_scripts/run_build.sh after, this output is what I get. There are no .whl files generated.

@broken
Copy link
Member

broken commented Feb 2, 2022

Can you look at that file and make sure it mirrors what is here? https://github.com/tensorflow/text/blob/master/oss_scripts/prepare_tf_dep.sh

In particular, look at the types of quotes used. Maybe replace the file manually if possible. The point of this script is to make certain that tf text is building against the version of tensorflow you have installed.

@yulsa
Copy link

yulsa commented Feb 4, 2022

moving discussion here from #756

so far:
script stalls at sed (can potentially be fixed with -e or ' ')

next fail is at grep -> issue is grep version AND not seeing git version for tensorflow python -c 'import tensorflow as tf; print(tf.__git_version__)' returns unknown

@broken
Copy link
Member

broken commented Feb 4, 2022

@yulsa @yuyuan20 it looks like there are two issues.

  1. sed commands are not running correctly
  2. tf.git_version is not displaying

The point of this file is to make certain you are building tf text against the same version of tf that you have installed. However, it looks like tensorflow-macos does not populate the git_version variable, and since you are not doing a custom build of TF and building against nightly, you should be able to use the default that is set in the branch.

Thus, you can simply remove the prepare_tf_dep.sh line from the build script and I expect you will be fine.

@yulsa
Copy link

yulsa commented Feb 4, 2022

@yulsa @yuyuan20 it looks like there are two issues.

  1. sed commands are not running correctly
  2. tf.git_version is not displaying

The point of this file is to make certain you are building tf text against the same version of tf that you have installed. However, it looks like tensorflow-macos does not populate the git_version variable, and since you are not doing a custom build of TF and building against nightly, you should be able to use the default that is set in the branch.

Thus, you can simply remove the prepare_tf_dep.sh line from the build script and I expect you will be fine.

@broken
just tried that. commented out # source oss_scripts/prepare_tf_dep.sh in the build script, and the result fails to build:

Screen Shot 2022-02-04 at 2 24 22 PM

maybe there is a way to find the git version manually? can't seem to find anywhere...

@yulsa
Copy link

yulsa commented Feb 4, 2022

retried everything from scratch (recloned git, only change -> comment the source oss_scripts/prepare_tf_dep.sh ub build script. still failed:

Screen Shot 2022-02-04 at 2 43 02 PM

@andrewdunkel
Copy link

andrewdunkel commented Feb 4, 2022

I'm in the same spot.

Try updating this file starting at line 48.
/private/var/tmp/_bazel_<yourname>/55d65c43790f28395233053bd8c3ccae/external/local_config_cc/BUILD

cc_toolchain_suite(
    name = "toolchain",
    toolchains = {
        "darwin|compiler": ":cc-compiler-darwin",
        "darwin_arm64|compiler": ":cc-compiler-darwin",  # <--- new
        "darwin": ":cc-compiler-darwin",
        "darwin_arm64": ":cc-compiler-darwin",           # <--- new
        "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a",
        "armeabi-v7a": ":cc-compiler-armeabi-v7a",
    },
)

This takes me past that error but onto a new one.

@broken
Copy link
Member

broken commented Feb 4, 2022

what's the new error?

@andrewdunkel
Copy link

andrewdunkel commented Feb 4, 2022

Screen Shot 2022-02-04 at 3 50 33 PM

@broken
Copy link
Member

broken commented Feb 4, 2022

A couple things to confirm:

  • Building on TF Text branch 2.7. This has the WORKSPACE set for TF v2.7.x which has worked for others, and 2.7.0 is the latest version of tensorflow-macos.
  • Using bazel version 4.2.1. Normally we used 3.7.2 for builds on that branch, but from a different thread, that version doesn't exist so you would have to build it yourself which is troublesome.

ps. FYI; I saw that legacyai shared their built wheel here on the previous PR. I have no idea of the authenticity package, so typical 'use at your own risk' disclaimer.

@yulsa
Copy link

yulsa commented Feb 4, 2022

the first time I ran the script, was prompted to use Bazel 4.2.2, not sure if makes any difference, but that's the one I configured. do you mean should change it to 3.7.2 to run the script?

@broken
Copy link
Member

broken commented Feb 4, 2022

No. 4.2.2 should be good. I must be misremembering and 3.7.2 was for tf text 2.6.x and below.

@yuyuan20
Copy link
Author

yuyuan20 commented Feb 5, 2022

@yulsa @yuyuan20 it looks like there are two issues.

  1. sed commands are not running correctly
  2. tf.git_version is not displaying

The point of this file is to make certain you are building tf text against the same version of tf that you have installed. However, it looks like tensorflow-macos does not populate the git_version variable, and since you are not doing a custom build of TF and building against nightly, you should be able to use the default that is set in the branch.

Thus, you can simply remove the prepare_tf_dep.sh line from the build script and I expect you will be fine.

Did it and now it's a new error (the complete log is a bit long so I am just stating a portion of it).

++ SHARED_LIBRARY_NAME=-ltensorflow_framework.2
++ is_macos
++ [[ darwin == \d\a\r\w\i\n ]]
++ SHARED_LIBRARY_NAME=libtensorflow_framework.dylib
++ is_windows
++ [[ darwin =~ msys_nt*|mingw*|cygwin*|uwin* ]]
++ export LD_LIBRARY_PATH=:/opt/homebrew/Caskroom/miniforge/base/envs/ml-env/lib/python3.9/site-packages/tensorflow
++ LD_LIBRARY_PATH=:/opt/homebrew/Caskroom/miniforge/base/envs/ml-env/lib/python3.9/site-packages/tensorflow
++ write_action_env_to_bazelrc TF_HEADER_DIR /opt/homebrew/Caskroom/miniforge/base/envs/ml-env/lib/python3.9/site-packages/tensorflow/include
++ write_to_bazelrc 'build --action_env TF_HEADER_DIR="/opt/homebrew/Caskroom/miniforge/base/envs/ml-env/lib/python3.9/site-packages/tensorflow/include"'
++ echo 'build --action_env TF_HEADER_DIR="/opt/homebrew/Caskroom/miniforge/base/envs/ml-env/lib/python3.9/site-packages/tensorflow/include"'
++ write_action_env_to_bazelrc TF_SHARED_LIBRARY_DIR /opt/homebrew/Caskroom/miniforge/base/envs/ml-env/lib/python3.9/site-packages/tensorflow
++ write_to_bazelrc 'build --action_env TF_SHARED_LIBRARY_DIR="/opt/homebrew/Caskroom/miniforge/base/envs/ml-env/lib/python3.9/site-packages/tensorflow"'
++ echo 'build --action_env TF_SHARED_LIBRARY_DIR="/opt/homebrew/Caskroom/miniforge/base/envs/ml-env/lib/python3.9/site-packages/tensorflow"'
++ write_action_env_to_bazelrc TF_SHARED_LIBRARY_NAME libtensorflow_framework.dylib
++ write_to_bazelrc 'build --action_env TF_SHARED_LIBRARY_NAME="libtensorflow_framework.dylib"'
++ echo 'build --action_env TF_SHARED_LIBRARY_NAME="libtensorflow_framework.dylib"'
++ write_action_env_to_bazelrc TF_CXX11_ABI_FLAG 0
++ write_to_bazelrc 'build --action_env TF_CXX11_ABI_FLAG="0"'
++ echo 'build --action_env TF_CXX11_ABI_FLAG="0"'
+ bazel build --enable_runfiles oss_scripts/pip_package:build_pip_package
Starting local Bazel server and connecting to it...
DEBUG: /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/org_tensorflow/third_party/repo.bzl:109:14: 
Warning: skipping import of repository 'icu' because it already exists.
DEBUG: /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/org_tensorflow/third_party/repo.bzl:109:14: 
Warning: skipping import of repository 'pybind11' because it already exists.
ERROR: /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/local_config_cc/BUILD:48:19: in cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'darwin_arm64'
INFO: Repository com_google_absl instantiated at:
  /Users/yuyuan/Desktop/ml-env/text/WORKSPACE:97:14: in <toplevel>
  /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/org_tensorflow/tensorflow/workspace2.bzl:1082:28: in workspace
  /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/org_tensorflow/tensorflow/workspace2.bzl:58:9: in _initialize_third_party
  /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/org_tensorflow/third_party/absl/workspace.bzl:14:20: in repo
  /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/org_tensorflow/third_party/repo.bzl:113:21: in tf_http_archive
Repository rule _tf_http_archive defined at:
  /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/org_tensorflow/third_party/repo.bzl:66:35: in <toplevel>
INFO: Repository com_google_sentencepiece instantiated at:
  /Users/yuyuan/Desktop/ml-env/text/WORKSPACE:18:13: in <toplevel>
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
INFO: Repository icu instantiated at:
  /Users/yuyuan/Desktop/ml-env/text/WORKSPACE:5:13: in <toplevel>
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_yuyuan/afe558054884c73ef4e344c4ac2630cb/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
ERROR: Analysis of target '//oss_scripts/pip_package:build_pip_package' failed; build aborted: Analysis of target '@local_config_cc//:toolchain' failed
INFO: Elapsed time: 5.088s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (39 packages loaded, 458 targets c\
onfigured)
    Fetching @local_config_tf; fetching

@broken
Copy link
Member

broken commented Feb 7, 2022

You are erroring on the bazel build command, so you are building the package. It looks like you ran across the error mentioned above about the missing toolchain. You can try the solution above (#823 (comment)) or remove mentions of using a toolchain in the .bazelrc file or configure.sh file (and rerun it to write out a new .bazelrc). Then run bazel build oss_scripts/pip_package:build_pip_package again.

@amersheikh
Copy link

I was able to build and install tensorflow_text (.whl) for my Apple Macbook Air with the M1 processor following the discussion on this issue by making the following two changes as detailed above:-

  • commented out # source oss_scripts/prepare_tf_dep.sh in the build script as above.
  • /private/var/tmp/bazel/55d65c43790f28395233053bd8c3ccae/external/local_config_cc/BUILD

cc_toolchain_suite(
name = "toolchain",
toolchains = {
"darwin|compiler": ":cc-compiler-darwin",
"darwin_arm64|compiler": ":cc-compiler-darwin", # <--- new
"darwin": ":cc-compiler-darwin",
"darwin_arm64": ":cc-compiler-darwin", # <--- new
"armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a",
"armeabi-v7a": ":cc-compiler-armeabi-v7a",
},
)

@yousifalhashmi
Copy link

Hello. Successfully installed tensorflow_text (with an underscore _ not hyphen -). Followed steps by @sun1638650145 here and @edloper here and @andrewdunkel #823 (comment).
Device is: MacBook Pro with M1 pro chip - macOS 12.2.1

@raemisch
Copy link

Hello,

following exactly the instructions above (python 3.9) I keep getting a compiler error that I don't know how to interpret/resolve.

ERROR: /private/var/tmp/_bazel_XXXXX/03c196188fbb5dc38e3a61a403354856/external/com_google_sentencepiece/BUILD.bazel:51:11: Compiling src/normalizer.cc failed: (Exit 1): cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics ... (remaining 70 arguments skipped)
external/com_google_sentencepiece/src/normalizer.cc:25:10: error: module: @com_google_sentencepiece//:sentencepiece_processor does not depend on a module exporting 'third_party/darts_clone/darts.h'
#include "third_party/darts_clone/darts.h"
         ^
1 error generated.
Target //oss_scripts/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.

Platform: M1 Pro with Monterey (12.4)

If anyone has an idea where this might come from, any help is greatly appreciated.

@broken
Copy link
Member

broken commented Jul 21, 2022

Try adding this line at the bottom of : https://github.com/tensorflow/text/blob/master/third_party/sentencepiece/BUILD

...
            "@com_google_absl//absl/strings",
            "@darts_clone",  # < --- new line here
        ],
)

@raemisch
Copy link

Thanks you very much for trying to solve this issue! However, neither adding the dependency, nor deleting the entire /private/var/tmp/_bazel_XXXX directory solved that issue.

I also observed the same error for absl/strings, which was obscured by mostly failing on the darts_clone module before reaching the other error. If I compile multiple times, either one of those errors appear.

here is the other error message:
error: module @com_google_sentencepiece//:sentencepiece_processor does not depend on a module exporting 'absl/strings/str_format.h'

P.S.
It's weird that I appear to be the only one having this issue. Did anyone else manage to compile using bazel 5.1.1 on an M1 MacBook?

@broken
Copy link
Member

broken commented Jul 22, 2022

Are you compiling using the most recent commit of branch 2.9? The most recent commit changes configure.sh to download the correct version of .bazelrc and .bazelversion from TF. For 2.9, this is bazel version 5.0.0 and not 5.1.1. The .bazelrc file may have differences as well.

@sun1638650145
Copy link
Contributor

@broken Isn't the version of bazel used by text now the same as tf? tf 2.9 uses bazel 5.1.1.

@sun1638650145
Copy link
Contributor

@raemisch I use bazel 5.1.1, but I used tensorflow-macos 2.9.0 at first, and later updated the tutorial to use 2.9.2 (the latest version of tensorflow is 2.9.1, but I feel that there should be no impact here, as long as the major version is the same).

@dlwh
Copy link

dlwh commented Jul 25, 2022

@raemisch I can confirm that this is happening to me as well on an M1. Exactly the same two imports.

@dlwh
Copy link

dlwh commented Jul 25, 2022

(I can't compile master or the tag v2.9.0)

@broken
Copy link
Member

broken commented Jul 25, 2022

@broken Isn't the version of bazel used by text now the same as tf? tf 2.9 uses bazel 5.1.1.

Yes, but for the version TF used on that branch. TF 2.9 uses 5.0.0 - https://github.com/tensorflow/tensorflow/blob/r2.9/.bazelversion

We specify those versions in our branched configure.sh now too - https://github.com/tensorflow/text/blob/2.9/oss_scripts/configure.sh#L64

If you are able to compile fine on 5.1.1 it's not that issue then. It was somewhat a shot in the dark since they were hitting the issue and nobody else.

Looking at this more, the build does seem incomplete. I think the added dep still needs to happen, and then the sp.patch should rewrite those imports to "include/darts.h" instead of third_party. I'll work on a PR for that today.

@broken
Copy link
Member

broken commented Jul 26, 2022

I believe this should fix it. #972
You can try cherry-picking it in, or wait until tomorrow and we should be able to have it tested and push it out assuming it doesn't break anything else.

@broken
Copy link
Member

broken commented Jul 27, 2022

This change has now been cherry-picked into branch 2.9

@dlwh
Copy link

dlwh commented Jul 27, 2022

as I said in the PR..., I still get errors related to absl with the change. This is latest master...

ERROR: /private/var/tmp/_bazel_dlwh/5b5343ed274731dd03bb9e218576ebef/external/com_google_sentencepiece/BUILD.bazel:51:11: Compiling src/model_interface.cc failed: (Exit 1): cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics ... (remaining 75 arguments skipped)
external/com_google_sentencepiece/src/model_interface.cc:20:10: error: module @com_google_sentencepiece//:sentencepiece_processor does not depend on a module exporting 'absl/strings/str_format.h'
#include "absl/strings/str_format.h"
         ^
1 error generated.
Target //oss_scripts/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 205.827s, Critical Path: 84.78s
INFO: 1292 processes: 13 internal, 1279 local.
FAILED: Build did NOT complete successfully

@dlwh
Copy link

dlwh commented Jul 27, 2022

(The darts error is gone though!)

@broken
Copy link
Member

broken commented Jul 28, 2022

It's difficult for me to debug completely when I'm not receiving the error. Though, the dependencies do look legitimately missing in these cases.

edit: The branch is now updated with str_format dependency change.

@Fred-Wu
Copy link

Fred-Wu commented Sep 4, 2022

I was able to build and install tensorflow_text==2.9 from the source, just following the instruction in the github introduction.
But when I tried to import tf text in python the following error occurred.

I am using python 3.10.5 on macbook M1 with tf macos and metal installed at the moment, would this the right version of python, or still the comparability issue with apple's tf build?

dlopen(/opt/homebrew/Caskroom/miniforge/base/envs/tensor/lib/python3.10/site-packages/tensorflow_text/python
/ops/_regex_split_ops.dylib, 0x0006): re-export ordinal -2 in '/opt/homebrew/Caskroom/miniforge/base/envs/tensor
/lib/python3.10/site-packages/tensorflow_text/python/ops/_regex_split_ops.dylib' out of range for 
(__ZN10tensorflow14kernel_factory17OpKernelRegistrar12InitInternalEPKNS_9KernelDefENSt3__117basic_string_viewIc
NS5_11char_traitsIcEEEENS5_10unique_ptrINS0_15OpKernelFactoryENS5_14default_deleteISB_EEEE)symbol not found 
in flat namespace 
(__ZN10tensorflow14kernel_factory17OpKernelRegistrar12InitInternalEPKNS_9KernelDefENSt3__117basic_string_viewIc
NS5_11char_traitsIcEEEENS5_10unique_ptrINS0_15OpKernelFactoryENS5_14default_deleteISB_EEEE)

@broken
Copy link
Member

broken commented Sep 6, 2022

Symbol errors like that most often occur when running TF Text with a version of TF it wasn't built with. Which intro instructions did you look at? Can you follow the ones by sun1638650145 here.

@Fred-Wu
Copy link

Fred-Wu commented Sep 8, 2022

Symbol errors like that most often occur when running TF Text with a version of TF it wasn't built with. Which intro instructions did you look at? Can you follow the ones by sun1638650145 here.

I have fixed the issue following the @sun1638650145 tutorial. Bascially TF's minor version has to match to TF text's minor version, like cannot use 2.9.2 TF with 2.9.0 TF text

@broken
Copy link
Member

broken commented Sep 8, 2022

That shouldn't be the case, but there are some fixes that happened later on the 2.9 branch to make it easier to build iirc. I'm glad you got it working.

@maparent
Copy link

maparent commented Sep 16, 2022

So, we now have tensorflow-macos 2.10.0.
I tried building tensorflow_text 2.10.0 on homebrew python 3.10.4, on a M1 MacBookPro, in a virtualenv. The build process is comparatively straightforward. (Update project_version in setup.nightly.py, disable some of prepare_tf_dep.sh because tensorflow.git_version is not defined, etc.)
One detail: I had issues with the pyext binaries in the protobuf wheel that pip downloaded, and had to compile my own (v3.19.4, with pyext and static linking.)
But once built and installed, I cannot import tensorflow without an error in loading the regex library, as described in this gist.
here is the build log
Here is the resulting broken wheel.
Any help appreciated.
(ETA: same result in python 3.9.14. Base protobuf without binary extensions. Resulting broken wheel)

Speculation: This is not a symbol not found, so though a discrepancy between symbols of tensorflow and tensorflow-macos is possible in theory, I doubt this is what's happening here. It seems there is an error in parsing the resulting library structure, though nm is happy with it. I have the absolute latest compilation tools (clang-1400.0.29.102) so I wonder if the library format changed in a way that the python import mechanism finds confusing.

@broken
Copy link
Member

broken commented Sep 19, 2022

Those symbol errors happen when a compiled binary calls out to a library, but the ABI of that library does not have the symbol in its symbol table. The symbol table can change by using a different compiler, version of the compiler, or settings for the compiler. It is unlikely there is problem reading the structure, it is most likely that the symbol doesn't exist. You can confirm this with nm.

I would recommend looking at sun's tutorial and making sure that you didn't miss any steps, because if you built tensorflow_text and are getting symbol errors, perhaps the wrong version of TF is in the bazel workspace file and you are building against a different shared TF lib than you expect.

@maparent
Copy link

Well, there is the discrepancy that tensorflow_text uses tensorflow 2.10.0 and not tensorflow_macos 2.10.0, which we do not have the source of.
But I did check that the symbol is defined in the library according to nm:

nm venv/lib/python3.10/site-packages/tensorflow_text/python/ops/_regex_split_ops.dylib |grep __ZN10tensorflow11register_op19OpDefBuilderWrapper10SetShapeFnENSt3__18functionIFNS_6StatusEPNS_15shape_inference16InferenceContextEEEE
0000000000004398 T __ZN10tensorflow11register_op19OpDefBuilderWrapper10SetShapeFnENSt3__18functionIFNS_6StatusEPNS_15shape_inference16InferenceContextEEEE
0000000000035570 t __ZN10tensorflow11register_op19OpDefBuilderWrapper10SetShapeFnENSt3__18functionIFNS_6StatusEPNS_15shape_inference16InferenceContextEEEE.cold.1

I should have been more explicit than pointing to the gist: the important line is

NotFoundError: dlopen(/[...]/lib/python3.10/site-packages/tensorflow_text/python/ops/_regex_split_ops.dylib, 0x0006): malformed trie child, cycle to nodeOffset=0x2

The symbol not found seems to be due to not being able to understand the library structure at all, from my reading of this line. But thank you for confirming that compiler version might indeed be an issue.

@sun1638650145
Copy link
Contributor

sun1638650145 commented Sep 23, 2022

@maparent I also found the same problem, all Python versions are like this, text 2.9 only has this problem with Python 3.10, which made me mistakenly thought it was a text problem. Now I plan to not use tensorflow-macos but Compile tensorflow from source, then try to build text 2.10. I looked at the build of tensorflow-decision-forests and I think this should be an idea worth trying.

@maparent
Copy link

But doesn't using tensorflow (non-macos) preclude using tensorflow-metal? Possible it's the best we can do now, of course.

@dlwh
Copy link

dlwh commented Oct 11, 2022 via email

@wijnanduu
Copy link

I've been trying to build tf text following sun's https://github.com/sun1638650145/Libraries-and-Extensions-for-TensorFlow-for-Apple-Silicon/blob/369f0c8a7801f9fa0887de1dfb40e12718e6c02a/tutorials/text/text.md but I'm running into a darts.h error similar to the one reported above:

ERROR: /private/var/tmp/_bazel_wijnand/123e38e1fbaa9d9d6d57d1c2042050f9/external/com_google_sentencepiece/BUILD.bazel:51:11: Compiling src/normalizer.cc failed: (Exit 1): cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 70 arguments skipped)
external/com_google_sentencepiece/src/normalizer.cc:25:10: error: module @com_google_sentencepiece//:sentencepiece_processor does not depend on a module exporting 'third_party/darts_clone/darts.h'
#include "third_party/darts_clone/darts.h"
^
1 error generated.

I'm running on Monterey 12.6.1 macbook pro with an m1 chip. Sun's tutorial says to use bazel 5.1.1. but when I ran the build script I got a message asking to use 5.3 instead so I switched it, now I get this. Modifying third_party/sentencepiece/BUILD with the "@darts_clone" addition didn't work. Any help is appreciated.

@broken
Copy link
Member

broken commented Nov 10, 2022

That import should be "include/darts.h". We have a patch file that runs and updates the include when including the Sentencepiece library. See:
https://github.com/tensorflow/text/blob/master/third_party/sentencepiece/sp.patch#L78

The patch file is set here:
https://github.com/tensorflow/text/blob/master/WORKSPACE#L26

I'm not sure why it didn't run for you, but I would start looking there - determine why Bazel is not applying the patch.

@wijnanduu
Copy link

I checked and the patch file differs in the version of text that I was using (which is https://github.com/tensorflow/text/archive/refs/tags/v2.9.0.zip). I then tried again with the 2.9 branch which does include the right version of sp.patch but I got other errors. This lead me to try several branches and actually the build succeeded with version 2.10! Many thanks for your help!

To anyone reading that ended up here from suns tutorial, here's what I did to make it work:

  1. Upgraded to Monterey, not sure if that is necessary but apple lists it as a requirement for metal here.
  2. Use mamba instead of conda, so install mambaforge and replace 'conda' with 'mamba' in the commands.
  3. Use version 2.10 instead of 2.9. So change "tensorflow-deps==2.9.0" to "tensorflow-deps==2.10" and "tensorflow-macos==2.9.0" to "tensorflow-macos==2.10". I also changed oss_scripts/configure.sh as per step 5 of the tutorial but I'm not sure if that is necessary. Get the zip from the github branch 2.10 and then follow the rest of the tutorial.

@vedmant
Copy link

vedmant commented Feb 23, 2023

So still no prebuilt version for MacOs? Maybe there is straight forward instruction how to do this?

@staminna
Copy link

where can we subscribe to at least a beta release? % pip3 install rasa[metal]
zsh: no matches found: rasa[metal]

@broken
Copy link
Member

broken commented Feb 28, 2023

There are instructions here: #1077 (comment)

Outside of setting up the environment, it is mostly run_build.sh. If this works for you too, we can add the additional environment settings to the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests