-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
How to install Scikitlearn Sklearn #1618
Comments
The below instructions are for installing scikitlearn on Android using the Termux app. I have Jupyter Notebook and Python 3 installed on my smartphone:
$ curl -L https://its-pointless.github.io/setup-pointless-repo.sh | sh This script essentially installs gnupg on your device and downloads and adds a public key to your apt keychain ensuring that all subsequent downloads are from the same source.
You need to have scipy installed to install scikit-learn. You also have to have about a dozen other things installed like numpy etc in order for scipy/scikit-learn to work. I would install python 3, jupyter, notebook, ipython, pyzmq, pandas, numpy, matplotlib first. As well as the latest version of pip before starting. I can send you a list of the packages with versions that I have installed on my Android if you need it.
References I found helpful for this install: |
@ginacordova |
@ginacordova "UserWarning: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.. joblib will operate in serial mode |
@ginacordova I would also be interested if you could outline the exact steps you took to get the scikit-learn installation to work I have followed the links and tried the following
But the last step produces the error recorded here #termux/termux-app#443 |
$ termux-chroot Had the same issue for days and found a way out. |
@ryan15858 I have just tried this and can confirm it also worked for me, thanks! |
After the various prerequisites, the following allows the installation portion to complete without errors: LDFLAGS=" -lm -lcompiler_rt" pip install -U scikit-learn Not sure if the LDFLAGS portion is necessary, but that's what I've been doing for pip-related things as mentioned in various places. I do get the message mentioned above after importing, i.e.: "UserWarning: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.. joblib will operate in serial mode |
Many thanks @its-pointless and @ryanyuerong , for those attempting this more recently, I found that the following works with a fresh install of termux:
0.20.x releases fail due to scikit-learn/scikit-learn#11378 for me :( |
@jrgriffiniii |
It is not possible to fix Termux doesn't implement sem_open() as this is libc/kernel thing. |
@xeffyr |
@JulianWangS the warning never prevented me from importing any modules, classes or the like from sklearn. At worst it can just be ignored in my environment. @xeffyr is this also the case for you? |
It is possible to use sklearn, just ignore warning. Only
|
Everytime I'm trying to do
As an error and it stops installing (sorry for the bad console output) Android 10 |
Finally manged to install it! |
@thebestnom Haven't verified yet, but thanks for sharing 👍 |
@sogaiu After testing it for a little bit importing the lastest version raises no sem lock, haven't managed to get rid of it... Also haven't tried older version (which had the same problem while installing) Thinking about patching joblib to add try in the |
@thebestnom i've tried:
a few times, but haven't successfully reached the end (may be due to timeouts). Will make a few more attempts. |
@sogaiu I would suggest adding -vv at the end for verbose output, and see why it's stopping, also make sure numpy, scipy and cython are already installed |
@thebestnom Thanks for the tip. I'll do that next time. What I remember ATM is something about It's been a long time since I tried this so there's a good chance I didn't fulfill the prerequisites :) |
Yes, inadequate prerequisites. Installation appears to have been successful. Thanks @thebestnom For future strugglers: the didn't exist when I tried, so I left them out. I also ended up doing |
@sogaiu have you managed to import it? |
Thank you very much @sogaiu, this worked for me with a reinstall. @thebestnom I could only get it to import with version 0.19.2:
I receive a warning, but it does actually function for me. It is not scikit-learn/scikit-learn#11378 as I suspected before (I was incorrect). |
@jrgriffiniii yeah, guessed as much, will try to make a fix for newer versions |
I have no idea what I am doing, but the timing for scikit-learn/scikit-learn#11741 looks like it confirms:
Please let me know if I can assist in any way, I have not really worked with any of these projects. |
@jrgriffiniii downgrading joblib to version 0.11 seems to work on the latest scikit learn, looks like it is an already open issue on joblib |
Thank you again @thebestnom, I can confirm that the following worked in my environment: (Do not forget to
I would recommend this to others, as I now have no warnings logged when I import from the package. |
If anyone is available to review/correct joblib/joblib#999 please, I would be most grateful. You can also test this locally with:
|
@jrgriffiniii tried installing it, importing works! Currently I have no code testing it against, soim trying to run scikit-learn pytest on it! |
@thebestnom No, I hadn't successfully imported, but with @jrgriffiniii's joblib instructions, import succeeded 👍 |
@jrgriffiniii #1618 (comment) seems to work here so far in local testing -- at least importing works :) |
@jrgriffiniii did some testing by running notebooks from https://github.com/ogrisel/notebooks, and everything looks to work fine (after updating the old code), thanks again! |
I need to still write a test for joblib/joblib#999, and then request a release. Sorry for falling behind on this, work issues arose and kept me from returning to this. |
Guys check this out https://gist.github.com/thetdg/53ed30126078a16b49a2fff9094f3524#file-install_python_termux_android-txt and @jrgriffiniii your fix works |
@jrgriffiniii Thanks, I success installed sklearn. |
@jrgriffiniii Thanks. I confirm it works! |
@its-pointless @community
How do you install scikitlearn without getting errors when importing certain modules in termux
The text was updated successfully, but these errors were encountered: