Closed leminhnguyen closed 1 year ago
Hi, thanks for trying to build ViSQOL, sorry to hear it did not work. I couldn't repro your error - I was able to build from HEAD from a fresh clone just now. Do you know if your environment is special in some way? Are you on x86 or arm?
@mchinen Thank you for your quick response, I've tried to build bazel on another server (GCC V9.4.0 and ubuntu 20.04.1) and everything works fine. But when building the python API by bazel build -c opt //python:pyvisqol.so
as mentioned in https://github.com/google/visqol/issues/3 I got the error:
ERROR: Skipping '//python:pyvisqol.so': no such target '//python:pyvisqol.so': target 'pyvisqol.so' not declared in package 'python' defined by /home/nguyenlm/visqol/python/BUILD
WARNING: Target pattern parsing failed.
INFO: Analyzed 0 targets (0 packages loaded, 0 targets configured).
INFO: Found 0 targets...
ERROR: command succeeded, but there were errors parsing the target pattern
INFO: Elapsed time: 0.289s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
FAILED: Build did NOT complete successfully
where do pyvisqol.so
come from?
Hi, pyvisqol.so
isn't the target, that was a pull request that wasn't merged. The two targets in the python directory that are interesting are:
:visqol_lib_py_test
and :visqol_lib_py
. See the visqol_lib_py_test.py file for usage examples.
Thanks, @mchinen, I tried bazel build -c opt //python:visqol_lib_py.so
and got bazel-bin/python/visqol_lib_py.so
, but when running the visqol_lib_py_test.py
I encountered the error:
Traceback (most recent call last):
File "/home/nguyenlm/visqol/python/visqol_lib_py_test.py", line 14, in <module>
import visqol_config_pb2
ModuleNotFoundError: No module named 'visqol_config_pb2'
So, can you add more details about how to build python binding and how to run visqol_lib_py_test.py
properly in the readme?
Ah, bazel uses target names that don't typically include the extension (the .so is a special case). Here is how you can build and test this target:
bazel test -c opt //visqol_lib_py_test
The output has a log file you can inspect as well.
Hi @mchinen , I built visqol successfully and can use it via the command line with no issues.
However, I tried to run "bazel test -c opt //visqol_lib_py_test" from the base directory and from the python directory and unfortunately it didn't work, got this error on both:
ERROR:Skipping '//visqol_lib_py_test': no such package 'visqol_lib_py_test': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
Another question: once we build this, can we use "import pyvisqol" without having to run bazel every time? I apologize in advance for my ignorance in this matter. Thank you!
Hi @mchinen and @miraodasilva. The build command should be: bazel test -c opt //python:visqol_lib_py_test
. And everything works fine.
Ah, yes, sorry for my typo. Glad you figured it out.
@miraodasilva Once you build with bazel, you can run it as a binary without bazel (the binaries are in the bazel-bin directory). If you want to take the .so and use it outside of bazel, this should be possible, but I don't know exactly how that works.
many thanks @mchinen
Hello, I got the following error when building visqol with bazel, how can I solve it
ERROR: An error occurred during the fetch of repository 'local_execution_config_python':
Traceback (most recent call last):
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/py/python_configure.bzl", line 212, column 22, in _create_local_python_repository
_check_python_bin(repository_ctx, python_bin)
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/py/python_configure.bzl", line 143, column 52, in _check_python_bin
result = raw_exec(repository_ctx, [get_bash_bin(repository_ctx), "-c", cmd])
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/remote_config/common.bzl", line 88, column 26, in get_bash_bin
bash_bin_path = which(repository_ctx, "bash")
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/remote_config/common.bzl", line 27, column 22, in which
out = execute(
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/remote_config/common.bzl", line 230, column 13, in execute
fail(
Error in fail: Repository command failed
INFO: Could not find files for the given pattern(s).
ERROR: C:/users/think/visqol/WORKSPACE:104:11: fetching local_python_configure rule //external:local_execution_config_python: Traceback (most recent call last):
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/py/python_configure.bzl", line 212, column 22, in _create_local_python_repository
_check_python_bin(repository_ctx, python_bin)
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/py/python_configure.bzl", line 143, column 52, in _check_python_bin
result = raw_exec(repository_ctx, [get_bash_bin(repository_ctx), "-c", cmd])
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/remote_config/common.bzl", line 88, column 26, in get_bash_bin
bash_bin_path = which(repository_ctx, "bash")
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/remote_config/common.bzl", line 27, column 22, in which
out = execute(
File "C:/users/think/_bazel_think/d4yuvxeh/external/org_tensorflow/third_party/remote_config/common.bzl", line 230, column 13, in execute
fail(
Error in fail: Repository command failed
I've tried to build the bazel as mentioned in the readme
bazel build :visqol -c opt
, but I get the following error:Any solution for this problem. (gcc version 6.5.0 & Ubuntu 19.04)