lacava / few

a feature engineering wrapper for sklearn
https://lacava.github.io/few
GNU General Public License v3.0
50 stars 22 forks source link

installing few with pip #13

Closed eyadsibai closed 7 years ago

eyadsibai commented 7 years ago

it cannot be installed with pip since you are importing eigency inside setup.py and the requirements are not installed (yet)!

lacava commented 7 years ago

yes, i've noticed that hiccup. of course you can pip install eigency pip install few

but i'll have to look into how to get around that.

lacava commented 7 years ago

commit 2369992451035e6f177124b914bfc07756e7b88b updates the README to suggest the installation order above.

eyadsibai commented 7 years ago

that's not enough ... when I am creating a new environment or installing packages with pip ... it will download all packages that are mentioned inside my requirements.txt ... why do I have to install eigency manually then install the packages that are mentioned in requirements.txt ?... that will make ppl question using ur package with this setup for sure

lacava commented 7 years ago

there does not appear to be a simpler solution at the moment, as noted here and discussed here. the extension modules require eigency to locate paths during setup, and including eigency as a dependency under install_requires (the equivalent of requirements.txt for setuptools) or even setup_requires does not fix the issue. there may be a way to subclass the import in setup.py that i am not sure how to do, which i have opened as an issue on the eigency page.

therefore adding one line to the install process, pip install eigency, is the most straightforward solution at the moment. you are welcome to submit a pull request if you have a better option.

eyadsibai commented 7 years ago

You can add it in the setup.py before importing it. Add a call to let pip to install it.. Also if the installation didn't work raise an exception

lacava commented 7 years ago

reopening this til we find a better solution

lacava commented 7 years ago

commit b4b97d0dd43192848407bce4aa3eb8f6779b456f adds code to try to manually install eigency in setup.py using pip, reporting an error if it fails:

# the setup file relies on eigency to import its include paths for the
# extension modules. however eigency isn't known as a dependency until after
# setup is parsed; so we need to check for and install eigency before setup.
import importlib
try:
    importlib.import_module('eigency')
except ImportError:
    try:
        import pip
        pip.main(['install', 'eigency'])
    except ImportError:
        raise ImportError('The eigency library must be installed before FEW. '
                          'Automatic install with pip failed.')
finally:
    globals()['eigency'] = importlib.import_module('eigency')