Open kidconan opened 5 years ago
The message you're showing seems to be a warning, not an error. Did you run python setup.py install
? The steps are
cd soft-dtw
make cython
python setup.py build
sudo python setup.py install
The message you're showing seems to be a warning, not an error. Did you run
python setup.py install
? The steps arecd soft-dtw make cython python setup.py build sudo python setup.py install
The message you're showing seems to be a warning, not an error. Did you run
python setup.py install
? The steps arecd soft-dtw make cython python setup.py build sudo python setup.py install
as a matter of fact, I cannot import that package after finishing the above steps, even though I change the path.
When I use "from soft_dtw import SoftDTW", it just raises "No module named soft_dtw". I find there is just a "soft_dtw_fast.pyx" rather than "soft_dtw_fast.py" in the folder. Could you tell me what should I do? Thank you very much!
When I use "from soft_dtw import SoftDTW", it just raises "No module named soft_dtw". I find there is just a "soft_dtw_fast.pyx" rather than "soft_dtw_fast.py" in the folder. Could you tell me what should I do? Thank you very much!
Hi @wang-zm18, I also encounter the same problem. Maybe we can firstly check two things:
.pyx
file:
import pyximport
pyximport.install()
Hope these comment can help you.
I also had a hard time installing this. I am using python 3.8 and a conda environment.
Here is what helped me:
Add # cython: language_level=3
to soft_dtw_fast.pyx
run:
cd soft-dtw
make cython
python setup.py build_ext --inplace
sudo /path/to/env/python setup.py install
First # cython: language_level=3
removes a warning and makes it clear for cython that you are using python 3
Next python setup.py build_ext --inplace
allows to import sdtw
from outside.
See also https://stackoverflow.com/questions/26574533/python-setup-py-build-ext-inplace.
Last sudo /path/to/env/python setup.py install
is necessary when you are using a conda environment. Else the default python interpreter of your machine will be used.
The /path/to/env/python
can be found with the which python
command.
See also https://stackoverflow.com/questions/36659448/how-to-run-anaconda-python-on-sudo.
Actually I am bit confused why python setup.py build_ext --inplace
is necessary. Shouldn't this behavior already be defined in the Makefile
? (There is a inplace option.)
If you want an implementation that doesn't require any compilation / install, you can also try this project.
Thank you. This is great. The UMAP project was in need of a differentiable implementation of DTW. I am going to link the numba version, since the UMAP implementation is also based on numba.
When I run "python setup.py build " , it return the following statesment and I cannot import sdtw normally : "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
warning "Using deprecated NumPy API, disable it by " \
^ gcc -pthread -shared -B /home/gkb/anaconda3/envs/py3_7/compiler_compat -L/home/gkb/anaconda3/envs/py3_7/lib -Wl,-rpath=/home/gkb/anaconda3/envs/py3_7/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/sdtw/soft_dtw_fast.o -o build/lib.linux-x86_64-3.7/sdtw/soft_dtw_fast.cpython-37m-x86_64-linux-gnu.so creating build/bdist.linux-x86_64 creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/init.py -> build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/barycenter.py -> build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/chainer_func.py -> build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/dataset.py -> build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/distance.py -> build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/path.py -> build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/setup.py -> build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/soft_dtw.py -> build/bdist.linux-x86_64/egg/sdtw copying build/lib.linux-x86_64-3.7/sdtw/soft_dtw_fast.cpython-37m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg/sdtw byte-compiling build/bdist.linux-x86_64/egg/sdtw/init.py to init.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sdtw/barycenter.py to barycenter.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sdtw/chainer_func.py to chainer_func.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sdtw/dataset.py to dataset.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sdtw/distance.py to distance.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sdtw/path.py to path.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sdtw/setup.py to setup.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/sdtw/soft_dtw.py to soft_dtw.cpython-37.pyc creating stub loader for sdtw/soft_dtw_fast.cpython-37m-x86_64-linux-gnu.so byte-compiling build/bdist.linux-x86_64/egg/sdtw/soft_dtw_fast.py to soft_dtw_fast.cpython-37.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO copying soft_dtw.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying soft_dtw.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying soft_dtw.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying soft_dtw.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO copying soft_dtw.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt creating dist creating 'dist/soft_dtw-0.1.dev0-py3.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing soft_dtw-0.1.dev0-py3.7-linux-x86_64.egg creating /home/gkb/anaconda3/envs/py3_7/lib/python3.7/site-packages/soft_dtw-0.1.dev0-py3.7-linux-x86_64.egg Extracting soft_dtw-0.1.dev0-py3.7-linux-x86_64.egg to /home/gkb/anaconda3/envs/py3_7/lib/python3.7/site-packages Adding soft-dtw 0.1.dev0 to easy-install.pth file
Installed /home/gkb/anaconda3/envs/py3_7/lib/python3.7/site-packages/soft_dtw-0.1.dev0-py3.7-linux-x86_64.egg Processing dependencies for soft-dtw==0.1.dev0 Finished processing dependencies for soft-dtw==0.1.dev0 Warning: Assuming default configuration (sdtw/tests/{setup_tests,setup}.py was not found)(py3_7) [gkb@localhost soft-dtw]$ python setup.build python: can't open file 'setup.build': [Errno 2] No such file or directory (py3_7) [gkb@localhost soft-dtw]$ python setup.py build Appending sdtw.tests configuration to sdtw Ignoring attempt to set 'name' (from 'sdtw' to 'sdtw.tests') Appending sdtw configuration to Ignoring attempt to set 'name' (from '' to 'sdtw') running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src building extension "sdtw.soft_dtw_fast" sources build_src: building npy-pkg config files running build_py running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext Warning: Assuming default configuration (sdtw/tests/{setup_tests,setup}.py was not found)