Open huskyachao opened 1 week ago
Why don't you try this with OpenFst 1.8.3. and Pynini 2.1.6.post1 instead? Those are the most recent versions and I believe everything is working as expected for them.
hi, thanks a lot for your timely response. I just tried as you suggested but met with new problems. It seemed that the openfst-1.8.3 was installed successfully but there are some problems with pynini installation.
# install openfst
openfst_version=openfst-1.8.3
tar -zxvf $openfst_version.tar.gz
chmod 755 -R $PWD/$openfst_version/
cd $PWD/$openfst_version/
./configure --enable-grm --prefix=/home/ma-user/anaconda3/envs/PyTorch-2.1.0 # install openfst to venv
make -j8
make install
cd ../
# upgrade pip
python -m pip install --upgrade pip
pip install \
--config-settings="--build-option=build_ext" \
--upgrade \
--verbose \
pynini==2.1.6.post1
It seemed that the openfst-1.8.3 was installed successfully.
1776 libtool: finish: PATH="/usr/local/Ascend/ascend-toolkit/latest/bin:/usr/local/Ascend/ascend-toolkit/latest/compiler/ccec_compiler/bin:/usr/local/Ascend/ascend-toolkit/latest/tools/ccec_compiler/bin:/home/ma-user/anaconda3/envs/PyTorch-2.1.0/bin:/usr/local/mindspore-lite/mindspore-lite-2.3.0-linux-aarch64/tools/converter/converter:/usr/local/mindspore-lite/mindspore-lite-2.3.0-linux-aarch64/tools/benchmark:/usr/local/Ascend/driver/tools:/usr/local/openmpi/bin:/usr/local/ffmpeg/bin:/usr/local/Ascend/toolbox/latest/Ascend-DMI/bin:/usr/local/Ascend/ascend-toolkit/latest/bin:/usr/local/Ascend/ascend-toolkit/latest/compiler/ccec_compiler/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/ma-user/.local/bin:/sbin" ldconfig -n /home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib
1777 ----------------------------------------------------------------------
1778 Libraries have been installed in:
1779 /home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib
1780
1781 If you ever happen to want to link against installed libraries
1782 in a given directory, LIBDIR, you must either use libtool, and
1783 specify the full pathname of the library, or use the '-LLIBDIR'
1784 flag during linking and do at least one of the following:
1785 - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
1786 during execution
1787 - add LIBDIR to the 'LD_RUN_PATH' environment variable
1788 during linking
1789 - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
1790 - have your system administrator add LIBDIR to '/etc/ld.so.conf'
1791
1792 See any operating system documentation about shared libraries for
1793 more information, such as the ld(1) and ld.so(8) manual pages.
1794 ----------------------------------------------------------------------
1795 /usr/bin/mkdir -p '/home/ma-user/anaconda3/envs/PyTorch-2.1.0/bin'
1796 /bin/sh ../../../libtool --mode=install /usr/bin/install -c mpdtcompose mpdtexpand mpdtinfo mpdtreverse '/home/ma-user/anaconda3/envs/PyTorch-2.1.0/bin'
1797 libtool: install: /usr/bin/install -c .libs/mpdtcompose /home/ma-user/anaconda3/envs/PyTorch-2.1.0/bin/mpdtcompose
1798 libtool: install: /usr/bin/install -c .libs/mpdtexpand /home/ma-user/anaconda3/envs/PyTorch-2.1.0/bin/mpdtexpand
1799 libtool: install: /usr/bin/install -c .libs/mpdtinfo /home/ma-user/anaconda3/envs/PyTorch-2.1.0/bin/mpdtinfo
1800 libtool: install: /usr/bin/install -c .libs/mpdtreverse /home/ma-user/anaconda3/envs/PyTorch-2.1.0/bin/mpdtreverse
1801 make[4]: Nothing to be done for 'install-data-am'.
But the pynini installation posed errors as follows:
1958 copying pynini/export/py.typed -> build/lib.linux-aarch64-cpython-39/pynini/export
1959 copying pynini/lib/BUILD.bazel -> build/lib.linux-aarch64-cpython-39/pynini/lib
1960 copying pynini/lib/py.typed -> build/lib.linux-aarch64-cpython-39/pynini/lib
1961 copying pynini/examples/BUILD.bazel -> build/lib.linux-aarch64-cpython-39/pynini/examples
1962 copying pynini/examples/py.typed -> build/lib.linux-aarch64-cpython-39/pynini/examples
1963 running build_ext
1964 building '_pywrapfst' extension
1965 creating build/temp.linux-aarch64-cpython-39
1966 creating build/temp.linux-aarch64-cpython-39/extensions
1967 g++ -pthread -B /home/ma-user/anaconda3/envs/PyTorch-2.1.0/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /home/ma-user/anaconda3/envs/PyTorch-2.1.0/include -fPIC -O3 -isystem /home/ma-user/anaconda3/envs/PyTorch-2.1.0/include -fPIC -I/home/ma-user/anaconda3/envs/PyTorch-2.1.0/include/python3.9 -c extensions/_pywrapfst.cpp -o build/temp.linux-aarch64-cpython-39/extensions/_pywrapfst.o -std=c++17 -Wno-register -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-local-typedefs -funsigned-char
1968 g++ -pthread -B /home/ma-user/anaconda3/envs/PyTorch-2.1.0/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /home/ma-user/anaconda3/envs/PyTorch-2.1.0/include -fPIC -O3 -isystem /home/ma-user/anaconda3/envs/PyTorch-2.1.0/include -pthread -B /home/ma-user/anaconda3/envs/PyTorch-2.1.0/compiler_compat -shared build/temp.linux-aarch64-cpython-39/extensions/_pywrapfst.o -lfstfarscript -lfstfar -lfstscript -lfst -lm -ldl -o build/lib.linux-aarch64-cpython-39/_pywrapfst.cpython-39-aarch64-linux-gnu.so
1969 /home/ma-user/anaconda3/envs/PyTorch-2.1.0/compiler_compat/ld: cannot find -lfstfarscript: No such file or directory
1970 /home/ma-user/anaconda3/envs/PyTorch-2.1.0/compiler_compat/ld: cannot find -lfstfar: No such file or directory
1971 /home/ma-user/anaconda3/envs/PyTorch-2.1.0/compiler_compat/ld: cannot find -lfstscript: No such file or directory
1972 /home/ma-user/anaconda3/envs/PyTorch-2.1.0/compiler_compat/ld: cannot find -lfst: No such file or directory
1973 collect2: error: ld returned 1 exit status
1974 error: command '/usr/bin/g++' failed with exit code 1
1975 error: subprocess-exited-with-error
1976
1977 × Building wheel for pynini (pyproject.toml) did not run successfully.
1978 │ exit code: 1
1979 ╰─> See above for output.
1980
1981 note: This error originates from a subprocess, and is likely not a problem with pip.
1982 full command: /home/ma-user/anaconda3/envs/PyTorch-2.1.0/bin/python /home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpnv6es0mi
1983 cwd: /tmp/pip-install-2yg9gi81/pynini_ecd777a06d244c2fb737cba81eafb1c0
1984 Building wheel for pynini (pyproject.toml): finished with status 'error'
This is a good sign; I think you're close. It's failing at linking because it doesn't know that you put the OpenFst libraries in a non-standard prefix. There are three things you can try:
LD_LIBRARY_PATH=/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib python setup.py
. I am not sure if this will work but it's the first thing I'd try.extra_link_args
argument to the two calls to Extension
here and here./usr/local/lib
and it'll "just work".This is not a problem per se with Pynini's build system; this is a same issue with linking compiled software against libraries in non-standard locations that strikes basically every compiled UNIX library.
This is a good sign; I think you're close. It's failing at linking because it doesn't know that you put the OpenFst libraries in a non-standard prefix. There are three things you can try:
- Try passing environmental variables for LD_LIBRARY_PATH. I think it would look like
LD_LIBRARY_PATH=/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib python setup.py
. I am not sure if this will work but it's the first thing I'd try.- Add these flags to
extra_link_args
argument to the two calls toExtension
here and here.- Alternatively, don't use a prefix when you install OpenFst; it'll install to
/usr/local/lib
and it'll "just work".This is not a problem per se with Pynini's build system; this is a same issue with linking compiled software against libraries in non-standard locations that strikes basically every compiled UNIX library.
Thanks. Ok, I will have a try as you suggested.
Any luck @huskyachao ?
Any luck @huskyachao ?
Hi, kylebgorman. Thanks for your attention. It seems that there are still some problems about the installation. I will give a feedback later.
hi, I tried to compile openfst and pynini on a aarch64 machine. Although the version of openfst and pynini match, I still met with some troubles after a successful installation of openfst. BTW, I want to install pynini under a virtual environment
/home/ma-user/anaconda3/envs/PyTorch-2.1.0.
Here is the commands:The error is posed by the pynini building: