Not able to install due to libsvm
Opened this issue · 4 comments
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:
- https://pypi.org/simple/libsvm/
Getting page https://pypi.org/simple/libsvm/
Looking up "https://pypi.org/simple/libsvm/" in the cache
Request header has "max_age" as 0, cache bypassed
https://pypi.org:443 "GET /simple/libsvm/ HTTP/1.1" 404 13
Status code 404 not in (200, 203, 300, 301)
Could not fetch URL https://pypi.org/simple/libsvm/: 404 Client Error: Not Found for url: https://pypi.org/simple/libsvm/ - skipping
Could not find a version that satisfies the requirement libsvm (from pybrisque) (from versions: )
Cleaning up...
Removed build tracker '/private/tmp/pip-req-tracker-E1ybWI'
No matching distribution found for libsvm (from pybrisque)`
Do you know how I can go about it ?
Thanks in advance,
Francois
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
.
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
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
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.