magenta / note-seq

A serializable note sequence representation and utilities.
Apache License 2.0
212 stars 57 forks source link

Bazel build error when trying to run align_fine #19

Closed DerWaldi closed 4 years ago

DerWaldi commented 4 years ago

I am trying to get the alignment tool working, but am getting the following error:

/data/master-thesis/src/001_dataset/alignment/BUILD.bazel:52:10: error loading package '@com_google_protobuf//': Label '@bazel_skylib//rules:common_settings.bzl' is invalid because 'rules' is not a package; perhaps you meant to put the colon here: '@bazel_skylib//:rules/common_settings.bzl'? and referenced by '//:align'

Could you please provide me some help?

Thank you in advance, you are doing a really great job with magenta and note-seq!

System Information:

Full Output:

(ma) sebi@sebi-desktop:/data/master-thesis/src/001_dataset/alignment$ INPUT_DIR=../test/
(ma) sebi@sebi-desktop:/data/master-thesis/src/001_dataset/alignment$ OUTPUT_DIR=../test_fine_align/
(ma) sebi@sebi-desktop:/data/master-thesis/src/001_dataset/alignment$ bazel run :align_fine -- --input_dir "${INPUT_DIR}" --output_dir "${OUTPUT_DIR}"
Starting local Bazel server and connecting to it...
INFO: SHA256 (https://github.com/protocolbuffers/protobuf/archive/master.zip) = 0dd2b6f666dbe89f7e431655b7ed6b26a5e04198b72c985b725f552a0eb5f1e4
DEBUG: Rule 'com_google_protobuf' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "0dd2b6f666dbe89f7e431655b7ed6b26a5e04198b72c985b725f552a0eb5f1e4"
DEBUG: Repository com_google_protobuf instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule http_archive defined at:
  /home/sebi/.cache/bazel/_bazel_sebi/20d58b7978468f7d4694d017731bad27/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
INFO: Repository eigen_repo instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule http_archive defined at:
  /home/sebi/.cache/bazel/_bazel_sebi/20d58b7978468f7d4694d017731bad27/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
ERROR: /data/master-thesis/src/001_dataset/alignment/BUILD.bazel:52:10: error loading package '@com_google_protobuf//': Label '@bazel_skylib//rules:common_settings.bzl' is invalid because 'rules' is not a package; perhaps you meant to put the colon here: '@bazel_skylib//:rules/common_settings.bzl'? and referenced by '//:align'
ERROR: Analysis of target '//:align_fine' failed; build aborted: Analysis failed
INFO: Elapsed time: 8.804s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (19 packages loaded, 76 targets configured)
FAILED: Build did NOT complete successfully (19 packages loaded, 76 targets configured)
DerWaldi commented 4 years ago

Well, I think I figured it out.

The urls in the WORKSPACE file are obsolete for eigen and bazel_skylib. The bazel build works after I changed them to:

http_archive(
    name = "eigen_repo",
    build_file = "//:eigen.BUILD",
    strip_prefix = "eigen-3.3.7",
    urls = [
        "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip",
    ],
)

and

http_archive(
    name = "bazel_skylib",
    strip_prefix = "bazel-skylib-master",
    urls = ["https://github.com/bazelbuild/bazel-skylib/archive/master.zip"],
)
DerWaldi commented 4 years ago

After fixing bazel build I ran into this and other python3 related errors in the python code of the alignment tool:

Traceback (most recent call last):
  File "/home/sebi/.cache/bazel/_bazel_sebi/20d58b7978468f7d4694d017731bad27/execroot/magenta_alignment/bazel-out/k8-fastbuild/bin/align_fine.runfiles/magenta_alignment/align_fine.py", line 72, in <module>
    app.run(main)
  File "/home/sebi/anaconda3/envs/ma/lib/python3.7/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/sebi/anaconda3/envs/ma/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "/home/sebi/.cache/bazel/_bazel_sebi/20d58b7978468f7d4694d017731bad27/execroot/magenta_alignment/bazel-out/k8-fastbuild/bin/align_fine.runfiles/magenta_alignment/align_fine.py", line 62, in main
    penalty_mul=FLAGS.penalty_mul)
  File "/data/master-thesis/src/001_dataset/alignment/align_fine_lib.py", line 133, in align_cpp
    f.write(alignment_task.SerializeToString())
TypeError: write() argument must be str, not bytes

I fixed them in my fork own of this repository and it is now working like a charme.

If you don't mind, I would like to create a pull request containing the bazel build fix and the python3 update of the alignment tool.