VarIr / scikit-hubness

A Python package for hubness analysis and high-dimensional data mining
BSD 3-Clause "New" or "Revised" License
44 stars 9 forks source link

Installation problem on a windows machine #67

Closed ivan-marroquin closed 3 years ago

ivan-marroquin commented 3 years ago

Hi,

I have a windows machine with Python 3.6.5, I tried the command: pip install scikit-hubness

and I got this message:

Collecting scikit-hubness Could not find a version that satisfies the requirement scikit-hubness (from versions: ) No matching distribution found for scikit-hubness

Any suggestions?

Thanks,

Ivan

ivan-marroquin commented 3 years ago

I decided to try a manual installation. So, I downloaded the package and run command: python setup.py install

It seems that the process went well. But, I got these warning messages which I don't know if they compromised the installation:

File "build\bdist.win-amd64\egg\skhubness\reduction\dis_sim.py", line 4 from future import annotations

SyntaxError: future feature annotations is not defined

byte-compiling build\bdist.win-amd64\egg\skhubness\reduction\local_scaling.py to local_scaling.cpython-36.pyc File "build\bdist.win-amd64\egg\skhubness\reduction\local_scaling.py", line 4 from future import annotations

SyntaxError: future feature annotations is not defined

byte-compiling build\bdist.win-amd64\egg\skhubness\reduction\mutual_proximity.py to mutual_proximity.cpython-36.pyc File "build\bdist.win-amd64\egg\skhubness\reduction\mutual_proximity.py", line 4 from future import annotations

SyntaxError: future feature annotations is not defined

byte-compiling build\bdist.win-amd64\egg\skhubness\reduction\shared_neighbors.py to shared_neighbors.cpython-36.pyc File "build\bdist.win-amd64\egg\skhubness\reduction\shared_neighbors.py", line 4 from future import annotations

SyntaxError: future feature annotations is not defined

Extracting scikit_hubness-0.21.3-py3.6.egg to c:\temp\python\python3.6.5\lib\site-packages File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\analysis\estimation.py", line 15 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\neighbors\hnsw.py", line 5 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\neighbors\lof.py", line 7 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\neighbors\lsh.py", line 5 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\neighbors\nng.py", line 5 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\neighbors\random_projection_trees.py", line 6 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\reduction\dis_sim.py", line 4 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\reduction\local_scaling.py", line 4 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\reduction\mutual_proximity.py", line 4 from future import annotations

SyntaxError: future feature annotations is not defined

File "c:\temp\python\python3.6.5\lib\site-packages\scikit_hubness-0.21.3-py3.6.egg\skhubness\reduction\shared_neighbors.py", line 4 from future import annotations

SyntaxError: future feature annotations is not defined

VarIr commented 3 years ago

scikit-hubness requires Python>=3.7, which introduced from __future__ import annotation. Is creating a virtual environment or conda environment with python3.7 an option for you?

ivan-marroquin commented 3 years ago

Thanks for the information. I will keep this in mind. Unfortunately, it won't possible for me to develop code on Python 3.7 as we are still using Python 3.6.5

VarIr commented 3 years ago

It shouldn't be too hard to make a 3.6 compatible fork though. Just delete all the imports highlighted in your error message above, and remove the annotations that point to the class itself, e.g. def fit(self, X, y=None) -> HNSW would become def fit(self, X, y=None): and so on.

This does not change functionality, but only loses convenient typing hints in IDEs.

ivan-marroquin commented 3 years ago

Many thanks for sharing these tips. I will give it a try and let you know

ivan-marroquin commented 3 years ago

I gave a try. I made a change in the setup.py, so the installation makes use of scikit-learn 0.24.2. The compilation seemed to work well. However, when I tried this command:

from skhubness.data import load_dexter

gave the following error message: Traceback (most recent call last): File "", line 1, in File "C:\Users\IMarroquin\Downloads\Important_Python_Libraries_VisualBuildTools\scikit-hubness-master\skhubness__init__.py", line 8, in from . import analysis File "C:\Users\IMarroquin\Downloads\Important_Python_Libraries_VisualBuildTools\scikit-hubness-master\skhubness\analysis__init.py", line 7, in from .estimation import Hubness, VALID_HUBNESS_MEASURES File "C:\Users\IMarroquin\Downloads\Important_Python_Libraries_VisualBuildTools\scikit-hubness-master\skhubness\analysis\estimation.py", line 26, in from skhubness.neighbors import NearestNeighbors File "C:\Users\IMarroquin\Downloads\Important_Python_Libraries_VisualBuildTools\scikit-hubness-master\skhubness\neighbors\init__.py", line 8, in from .ball_tree import BallTree File "C:\Users\IMarroquin\Downloads\Important_Python_Libraries_VisualBuildTools\scikit-hubness-master\skhubness\neighbors\ball_tree.py", line 3, in from sklearn.neighbors.ball_tree import\ ModuleNotFoundError: No module named 'sklearn.neighbors.ball_tree'

To correct this issue, I did the following:

Now, I am getting this error message - I reported this error to scikit-learn package: File "C:\Users\IMarroquin\Downloads\Important_Python_Libraries_VisualBuildTools\scikit-hubness-master\skhubness\neighbors\base.py", line 29, in from sklearn.neighbors._base import UnsupervisedMixin, SupervisedFloatMixin

VarIr commented 3 years ago

Unfortunately, you cannot easily upgrade scikit-learn, as scikit-hubness is currently tightly bound to some of its internals. For new scikit-learn version, we essentially need to rewrite our tool from scratch (see the paper for some more details on that).

ivan-marroquin commented 3 years ago

Ok. I replaced the new scikit-learn by the version supported by scikit-hubness. the compilation worked