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

Not able to install due to libsvm #5

Open
fitzfoufou opened this issue May 21, 2019 · 4 comments
Open

Not able to install due to libsvm #5

fitzfoufou opened this issue May 21, 2019 · 4 comments

Comments

@fitzfoufou
Copy link

Hi,
Thanks for the synthetic work.
I cannot install your library because of libsvm : whether I install it (with brew) or don't install it, I get this error :
Could not find a version that satisfies the requirement libsvm (from pybrisque) (from versions: )
If you want further details on the error (-vvv):
`Collecting libsvm (from pybrisque)
1 location(s) to search for versions of libsvm:

Do you know how I can go about it ?

Thanks in advance,
Francois

@Abhishek9900
Copy link

To install it with latest pip>=19 first install libsvm separately with apt-get install libsvm-dev then install the module with pip3 install pybrisque --no-deps . Then you'll have to install libsvm for python with this command pip3 install -e git+https://github.com/Salinger/libsvm-python.git#egg=libsvm-python .

@eugine-carlos
Copy link

apt-get install libsvm-dev

does this work in python 2.7 or python 3.7 coz in my workings it is not solving any problem

@akbargumbira
Copy link
Contributor

Seems to me that your error is because you don't use process-dependency-links when installing pybrisque. But if you are using pip >= 19.0, then follow @Abhishek9900's solution..

See cjlin1/libsvm#145 for a solution that would fix this problem

@mosminer
Copy link

mosminer commented Apr 11, 2020

First, I'm baffled why people are using --no-deps. I did not need --no-deps. The problem is with a package reference to libsvm in brisque.py. If you want to pip install a clone this repo into your own then you may also want to make a small mod to setup.py. Details below...

Note - since Python 2 is no longer supported I only focus on Python 3. My steps here were done using Python 3.7.4.

On a Mac

First the import of libsvm in brisque.py is missing the libsvm package name. This would never work unless you did some weird stuff to your python environment and is why this error pops up. In brisque.py at the chop change

import svmutil

to

import libsvm.svmutil as svmutil

Second, imutils is not in the install_requires list in setup.py. You'll have to manually pip install it or you can add it to the setup.py if you want to clone and install this repo locally.

The following works for me on a Mac. I always use virtual environments to keep things tidy and avoid needing to sudo any installs. The virtual environment setup and activation are the first two lines after the cd.

$ cd <your pybrisque repo>
$ python3 -m venv --prompt pybrisque ve
(pybrisque) $ source ve/bin/activate
(pybrisque) $ pip install -e .
(pybrisque) $ python -m unittest brisque/test_brisque.py 
FF...
======================================================================
FAIL: test_from_grayscale (brisque.test_brisque.TestBRISQUE)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mosminer/Projects/python/pybrisque/brisque/test_brisque.py", line 76, in test_from_grayscale
    brisque.get_score(image), self._score[idx], places=3)
AssertionError: 51.03683492787002 != 50.2686 within 3 places (0.7682349278700187 difference)

======================================================================
FAIL: test_from_path (brisque.test_brisque.TestBRISQUE)
Test directly from the path.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mosminer/Projects/python/pybrisque/brisque/test_brisque.py", line 69, in test_from_path
    brisque.get_score(path), self._score[idx], places=3)
AssertionError: 51.03683492787002 != 50.2686 within 3 places (0.7682349278700187 difference)

----------------------------------------------------------------------
Ran 5 tests in 0.294s

FAILED (failures=2)

Given this very obvious package problem I don't know if I should trust that the unit test failures are safe to ignore or not. BUT I can tell you that this library seems to work ok in my own project. I didn't bother to see if I'm using the functionality associated with the failures though.

If I get permissions to this repo I'll gladly post my modifications on a branch for others. If you make these mods yourself on a clone of the repo you can locally install the pybrisque package using

pip install -e <directory of your pybrisque repo>

What about Linux?

I played with this on the Ubuntu sub-system on Windows 10 a bit. I found the same modifications to brisque.py and setup.py were required. I also had to manually install librender1.

$ apt-get install -y libxrender1

Then you should be able to install pybrisque on Linux identical to the Mac steps. Note I didn't test the unit test on Linux.

Hope that helps others.

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