Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install qusetion #16

Open
kidconan opened this issue Dec 26, 2018 · 8 comments
Open

install qusetion #16

kidconan opened this issue Dec 26, 2018 · 8 comments

Comments

@kidconan
Copy link

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)

@mblondel
Copy link
Owner

mblondel commented Jan 8, 2019

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

@kidconan
Copy link
Author

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

@kidconan kidconan reopened this Jan 19, 2019
@kidconan
Copy link
Author

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

as a matter of fact, I cannot import that package after finishing the above steps, even though I change the path.

@wang-zm18
Copy link

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!

@SunnerLi
Copy link

SunnerLi commented Apr 9, 2020

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:

  1. cython is installed correctly
  2. Manually add the code before import cython .pyx file:
import pyximport
pyximport.install()

Hope these comment can help you.

@msseibel
Copy link

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.)

@mblondel
Copy link
Owner

If you want an implementation that doesn't require any compilation / install, you can also try this project.

@msseibel
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants