matejak / imreg_dft

Image registration using discrete Fourier transform.
Other
245 stars 68 forks source link

Error installing imreg_dft #23

Open kwankong opened 8 years ago

kwankong commented 8 years ago

I would appreciate some help on getting imreg_dft to install and work properly. The issue might be due to having different versions of python in my system (CentOs-6.1) but I am not sure. I recently installed python 2.7.12 but sudo still uses python 2.6.

So when I tried to install imreg_dft using command 'python setup.py install', I ended up with this error "ImportError: No module named numpy.distutils.core"

But when I tried to install imreg_dft using command '/usr/bin/python setup.py install', it appeared to work fine.


Installed /usr/lib/python2.6/site-packages/imreg_dft-2.0.0-py2.6.egg Processing dependencies for imreg-dft==2.0.0 Searching for Pillow==3.3.0 Best match: Pillow 3.3.0 Adding Pillow 3.3.0 to easy-install.pth file

Using /usr/lib64/python2.6/site-packages Searching for scipy==0.17.1 Best match: scipy 0.17.1 Adding scipy 0.17.1 to easy-install.pth file

Using /usr/lib64/python2.6/site-packages Searching for numpy==1.11.1 Best match: numpy 1.11.1 Adding numpy 1.11.1 to easy-install.pth file

Using /usr/lib64/python2.6/site-packages Searching for setuptools==24.0.0 Best match: setuptools 24.0.0 Adding setuptools 24.0.0 to easy-install.pth file Installing easy_install-3.5 script to /usr/bin Installing easy_install script to /usr/bin

Using /usr/lib/python2.6/site-packages

Finished processing dependencies for imreg-dft==2.0.0

But when I ran ird, I got these errors:

Traceback (most recent call last): File "/usr/local/bin/ird", line 5, in from pkg_resources import load_entry_point File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 2927, in File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 2913, in _call_aside File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 2940, in _initialize_master_working_set File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 635, in _build_master File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 943, in require File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 829, in resolve pkg_resources.DistributionNotFound: The 'scipy>=0.12' distribution was not found and is required by imreg-dft

Any help would be appreciated.

matejak commented 8 years ago

Hello, it looks like a problem of multiple Python versions. I suggest that you use 2.7, imreg_dft is not tested with 2.6. I propose these steps:

  1. Remove the installed imreg_dft (or at least search for ird* files in your $PATH and delete them - that's enough).
  2. Make sure that you have numpy, scipy etc. available in python27
  3. Install imreg_dft using python2.7 by running: sudo /path/to/python2.7 setup.py install or /path/to/python2.7 setup.py install --user
  4. It may be that ird, ird-show etc. are not available after the installation - then, you have to find out where they are and then add that directory to the PATH (in the user install, that one would be $HOME/.local/bin).

OR:

  1. Install by running pip install imreg_dft or easy_install imreg_dft.
  2. The same as 4 in the previous case.
kwankong commented 8 years ago

Hi matejak,

Thanks for your reply. I knew I installed numpy and scipy last night via 'pip' but they were likely installed using python 2.6 (because sudo uses python 2.6). Will they work with 2.7? If not, how can I make sudo use 2.7 and reinstall numpy and scipy?

kwankong commented 8 years ago

This is getting very tricky and complicated! yum in CentOS 6 needs python 2.6 to work properly. I am glad I did not try to replace it with 2.7 or "bad things" will happen. I found these blogs about this subject and I am trying to see if they work.

http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/ https://github.com/h2oai/h2o-2/wiki/installing-python-2.7-on-centos-6.3.-follow-this-sequence-exactly-for-centos-machine-only

matejak commented 8 years ago

This is a similar problem. You have to install setuptools using your Python 2.7 executable. Then, you can easy_install or pip install numpy, scipy or even imreg_dft. To be sure that you use the right pip or easy_install (i.e. 2.7, not 2.6), either call them with full paths, or try to find and use pip2.7 and easy_install-2.7 executables that should appear on your system once you install those tools with Python 2.7.

kwankong commented 8 years ago

Finally, it appears that I have installed a working version of imreg_dft. These are the steps that I used.

  1. Download and unpack the latest python version 2.7 (2.7.11).
  2. Configure with ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
  3. make && make altinstall (instead of make install).
  4. Download ez_setup.py from https://bootstrap.pypa.io/ez_setup.py
  5. Run python2.7 ez_setup.py
  6. Install pip2.7: easy_install-2.7 pip
  7. Install numpy: pip2.7 install numpy
  8. Install scipy: pip2.7 install scipy
  9. Download and unpack imreg_dft, and then install it by running python2.7 setup.py install
kwankong commented 8 years ago

However, when I ran 'make check', it terminated with an error.

python .//unittests/init.py testOdds (imreg.TestImreg) ... ok test_parse (tform.TestImreg) ... ok testClusters (utils.TestTiles) ... ok testArgmax_ext (utils.TestUtils) ... ok testExtend (utils.TestUtils) ... ok testFilter (utils.TestUtils) ... ok testUndo (utils.TestUtils) ... ok test_cut (utils.TestUtils) ... ok test_cuts (utils.TestUtils) ... ok test_decomps (utils.TestUtils) ... ok test_fftshift (utils.TestUtils) ... skipped 'The tested function is deprecated' test_select (utils.TestUtils) ... ok test_subarray (utils.TestUtils) ... ok test_subpixel (utils.TestUtils) ... ok test_subpixel_crazy (utils.TestUtils) ... ok test_subpixel_edge (utils.TestUtils) ... ok testWrapper (reporting.TestReports) ... ok


Ran 17 tests in 0.042s

OK (skipped=1) make -f regressiontests/Makefile check make[1]: Entering directory /root/Downloads/imreg_dft/tests' sh regressiontests//check_similarity.sh regressiontests//../../resources/examples/sample1.png regressiontests//../../resources/examples/sample2.png -19 79 0 1 Traceback (most recent call last): File "/usr/local/bin/ird", line 9, in <module> load_entry_point('imreg-dft==2.0.0', 'console_scripts', 'ird')() File "build/bdist.linux-x86_64/egg/imreg_dft/cli.py", line 266, in main File "build/bdist.linux-x86_64/egg/imreg_dft/cli.py", line 303, in run File "build/bdist.linux-x86_64/egg/imreg_dft/loader.py", line 268, in load2reg File "build/bdist.linux-x86_64/egg/imreg_dft/loader.py", line 380, in _load2reg AttributeError: 'module' object has no attribute 'imread' ird terminated with an error make[1]: *** [check-translation] Error 1 make[1]: Leaving directory/root/Downloads/imreg_dft/tests' make: *\ [check] Error 2

matejak commented 8 years ago

That one is easy, install pillow.

kwankong commented 8 years ago

So when I tried running 'pip2.7 install --upgrade pillow', I got Requirement already up-to-date: pillow in /usr/local/lib/python2.7/site-packages/Pillow-3.3.0-py2.7-linux-x86_64.egg

make check still gives me the same error as shown above.

matejak commented 8 years ago

OK, that's strange. AFAIK, problem of scipy.misc not having imread tends to be caused by missing pillow. The only thing I can think of now is uninstalling scipy and installing it again so pillow is available during the installation. I will try to investigate tomorrow in the evening if this does not help.

kwankong commented 8 years ago

Yep, same errors after reinstalling scipy

matejak commented 8 years ago

Well, according to my experience and http://stackoverflow.com/questions/15345790/scipy-misc-module-has-no-attribute-imread the mentioned problem (scipy.misc not having imread) is a PIL/pillow -- related. The only thing I can think of now is to try to import scipy.misc.pilutil in the python2.7interpreter and see what kind of errors you are going to get. I think that some of the pillow modules can't be imported for some reason.

kwankong commented 8 years ago

Rejoice, tests have passed successfully!


Yes, rejoice at last indeed! Your last comment gave me a hint that perhaps my copy of pillow was first installed using python 2.6 which might be the issue. So I uninstalled it and then reinstalled it with 'pip2.7 install pillow', and the test ran all the way through!