fairseq/scripts/check_installation.py
Guillaume Wenzek 699ab19014
run all tests (#4733)
* run all tests

* make torch a build-time dependency

* add 'dev' extra deps to install black, flake, pytest at once

* Build docs in CI

This should also help catch some import bugs, since sphinx inspect a lot of code

* CI should do the real install not "--editable"

* check installation succeeded

* add missing __init__.py file

* add check installation

* move check_installation.py to its own script

* fix pytest import mode, force recent numpy, torch

* run black before flake and tests

* torch >= 1.10.0

* use torch 1.10  for GPU tests
2022-09-23 18:40:50 +02:00

37 lines
877 B
Python

from pathlib import Path
import os
cwd = Path(".").resolve()
print("running 'check_installation.py' from:", cwd)
# Old versions of numpy/torch can prevent loading the .so files
import torch
print("torch:", torch.__version__)
import numpy
print("numpy:", numpy.__version__)
import fairseq
print("Fairseq installed at:", fairseq.__file__)
import fairseq.criterions
import fairseq.dataclass.configs
import _imp
print("Should load following .so suffixes:", _imp.extension_suffixes())
so_files = list(Path(fairseq.__file__).parent.glob("*.so"))
so_files.extend(Path(fairseq.__file__).parent.glob("data/*.so"))
print("Found following .so files:")
for so_file in so_files:
print(f"- {so_file}")
from fairseq import libbleu
print("Found libbleu at", libbleu.__file__)
from fairseq.data import data_utils_fast
print("Found data_utils_fast at", data_utils_fast.__file__)