google / tf-quant-finance

High-performance TensorFlow library for quantitative finance.
Apache License 2.0
4.57k stars 581 forks source link

Issue with running Bazel tests #87

Open chinmayrane opened 1 year ago

chinmayrane commented 1 year ago

I did try run from tf_quant_finance directory as well, am I missing something here, surely seems like a path/ pythonpath issue. Did see in bazel that they remove the sys.path[0], not sure if that's the reason. https://github.com/bazelbuild/bazel/blob/master/tools/python/python_bootstrap_template.txt#L19

Tried to add it to the PYTHONPATH variable as well, but didn't have any luck.

C:\GitRepos\tf-quant-finance (master -> origin)
(tqf) λ bazel test //tf_quant_finance/math/random_ops/sobol:sobol_test
INFO: Analyzed target //tf_quant_finance/math/random_ops/sobol:sobol_test (1 packages loaded, 2 targets configured).
INFO: Found 1 test target...
FAIL: //tf_quant_finance/math/random_ops/sobol:sobol_test (see C:/users/ch/_bazel_ch/ssh2zpbu/execroot/tf_quant_finance/bazel-out/x64_windows-fastbuild/testlogs/tf_quant_finance/math/random_ops/sobol/sobol_test/test.log)
Target //tf_quant_finance/math/random_ops/sobol:sobol_test up-to-date:
  bazel-bin/tf_quant_finance/math/random_ops/sobol/sobol_test.exe
  bazel-bin/tf_quant_finance/math/random_ops/sobol/sobol_test.zip
INFO: Elapsed time: 7.009s, Critical Path: 6.66s
INFO: 2 processes: 2 local.
INFO: Build completed, 1 test FAILED, 2 total actions
//tf_quant_finance/math/random_ops/sobol:sobol_test                      FAILED in 6.6s
  C:/users/ch/_bazel_ch/ssh2zpbu/execroot/tf_quant_finance/bazel-out/x64_windows-fastbuild/testlogs/tf_quant_finance/math/random_ops/sobol/sobol_test/test.log

Executed 1 out of 1 test: 1 fails locally.

Contains of the log file

-----------------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\ch\AppData\Local\Temp\Bazel.runfiles_ue9zden8\runfiles\tf_quant_finance\tf_quant_finance\math\random_ops\sobol\sobol_test.py", line 22, in <module>
    from tf_quant_finance.math import random
ModuleNotFoundError: No module named 'tf_quant_finance.math'
cyrilchim commented 1 year ago

Sorry for the late reply. I'd need to reproduce the issue. Could you please let me know what bazel version you are using?

Could you please specify the environment you are using? Are you running it on Windows?

chinmayrane commented 1 year ago

No problem, thank you for responding.

Bazel Version - 6.0.0

λ bazel version
Starting local Bazel server and connecting to it...
Build label: 6.0.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Dec 19 15:54:13 2022 (1671465253)
Build timestamp: 1671465253
Build timestamp as int: 1671465253

And yes, running it on windows.

environment ->

# packages in environment at C:\Miniconda3\envs\tqf:
#
# Name                    Version                   Build  Channel
absl-py                   1.4.0                    pypi_0    pypi
astunparse                1.6.3                    pypi_0    pypi
attrs                     22.1.0           py38haa95532_0
blas                      1.0                         mkl
bottleneck                1.3.5            py38h080aedc_0
ca-certificates           2022.10.11           haa95532_0
cachetools                5.2.1                    pypi_0    pypi
certifi                   2022.12.7        py38haa95532_0
charset-normalizer        3.0.1                    pypi_0    pypi
cloudpickle               2.2.0                    pypi_0    pypi
decorator                 5.1.1                    pypi_0    pypi
dm-tree                   0.1.8                    pypi_0    pypi
flatbuffers               23.1.4                   pypi_0    pypi
gast                      0.4.0                    pypi_0    pypi
google-auth               2.16.0                   pypi_0    pypi
google-auth-oauthlib      0.4.6                    pypi_0    pypi
google-pasta              0.2.0                    pypi_0    pypi
grpcio                    1.51.1                   pypi_0    pypi
h5py                      3.7.0                    pypi_0    pypi
idna                      3.4                      pypi_0    pypi
importlib-metadata        6.0.0                    pypi_0    pypi
intel-openmp              2021.4.0          haa95532_3556
jax                       0.4.1                    pypi_0    pypi
keras-nightly             2.12.0.dev2023011608          pypi_0    pypi
libclang                  15.0.6.1                 pypi_0    pypi
libffi                    3.4.2                hd77b12b_6
markdown                  3.4.1                    pypi_0    pypi
markupsafe                2.1.1                    pypi_0    pypi
mkl                       2021.4.0           haa95532_640
mkl-service               2.4.0            py38h2bbff1b_0
mkl_fft                   1.3.1            py38h277e83a_0
mkl_random                1.2.2            py38hf11a4ad_0
numexpr                   2.8.4            py38h5b0cc5e_0
numpy                     1.23.5           py38h3b20f71_0
numpy-base                1.23.5           py38h4da318b_0
oauthlib                  3.2.2                    pypi_0    pypi
openssl                   1.1.1s               h2bbff1b_0
opt-einsum                3.3.0                    pypi_0    pypi
packaging                 22.0             py38haa95532_0
pandas                    1.5.2            py38hf11a4ad_0
pip                       22.3.1           py38haa95532_0
protobuf                  3.19.6                   pypi_0    pypi
pyasn1                    0.4.8                    pypi_0    pypi
pyasn1-modules            0.2.8                    pypi_0    pypi
python                    3.8.15               h6244533_2
python-dateutil           2.8.2              pyhd3eb1b0_0
pytz                      2022.7           py38haa95532_0
requests                  2.28.2                   pypi_0    pypi
requests-oauthlib         1.3.1                    pypi_0    pypi
rsa                       4.9                      pypi_0    pypi
scipy                     1.10.0                   pypi_0    pypi
setuptools                65.6.3           py38haa95532_0
six                       1.16.0             pyhd3eb1b0_1
sqlite                    3.40.1               h2bbff1b_0
tb-nightly                2.12.0a20230116          pypi_0    pypi
tensorboard-data-server   0.6.1                    pypi_0    pypi
tensorboard-plugin-wit    1.8.1                    pypi_0    pypi
tensorflow-io-gcs-filesystem 0.29.0                   pypi_0    pypi
tensorflow-probability    0.12.1                   pypi_0    pypi
termcolor                 2.2.0                    pypi_0    pypi
tf-estimator-nightly      2.12.0.dev2023010909          pypi_0    pypi
tf-nightly                2.12.0.dev20230116          pypi_0    pypi
tf-nightly-intel          2.12.0.dev20230116          pypi_0    pypi
typing-extensions         4.4.0                    pypi_0    pypi
urllib3                   1.26.14                  pypi_0    pypi
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
werkzeug                  2.2.2                    pypi_0    pypi
wheel                     0.37.1             pyhd3eb1b0_0
wincertstore              0.2              py38haa95532_2
wrapt                     1.14.1                   pypi_0    pypi
zipp                      3.11.0                   pypi_0    pypi

Conda Info

     active environment : tqf
    active env location : C:\Miniconda3\envs\tqf
            shell level : 1
       user config file : C:\Users\chinm\.condarc
 populated config files : C:\Users\chinm\.condarc
          conda version : 22.11.1
    conda-build version : not installed
         python version : 3.8.5.final.0
       virtual packages : __archspec=1=x86_64
                          __win=0=0
       base environment : C:\Miniconda3  (writable)
      conda av data dir : C:\Miniconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Miniconda3\pkgs
                          C:\Users\chinm\.conda\pkgs
                          C:\Users\chinm\AppData\Local\conda\conda\pkgs
       envs directories : C:\Miniconda3\envs
                          C:\Users\chinm\.conda\envs
                          C:\Users\chinm\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/22.11.1 requests/2.28.1 CPython/3.8.5 Windows/10 Windows/10.0.22621
          administrator : False
             netrc file : None
           offline mode : False

Attached is my environment yaml - environment.yml.txt Just change the name to ennvironment.yml from environment.yml.txt if that helps. If windows is a hard dependency, I can try to build it from WSL on Visual Studio.