Running sklearn 0.17 in Google Cloud Datalab
I am trying to use sklearn.feature_selection in Google Datalab however, Datalab has version 0.16.1 installed by default. I tried installing version 0.17 using %%bash pip install scikit-learn==0.17 This works well, however when I run a new block of code, I'm still getting the old sklearn version but the right path. >> import sklearn >> print(sklearn.__version__) 0.16.1 >> print(sklearn.__path__) ['/usr/local/lib/python2.7/dist-packages/sklearn'] Now let's try with a new bash block: %%bash pip install scikit-learn==0.17 python -c 'import sklearn; print(sklearn.__version__);print(sklearn.__path__)' Requirement already satisfied (use --upgrade to upgrade): scikit-learn==0.17 in /usr/local/lib/python2.7/dist-packages Cleaning up... 0.17 ['/usr/local/lib/python2.7/dist-packages/sklearn'] What am I missing?
It is not recommended to update packages which are installed in Datalab by default. This is to ensure that you do not break a working Datalab environment. The recommended solution is to open an issue in the Datalab github project to request that a package be updated. In the meantime, try to work with the existing library. For scikit-learn, there is already an open issue on github (#771). Based on the response in the link, I expect that the next release of Datalab will have scikit-learn version 0.17 or newer. There should be a release soon. Check here for release information. If you want to temporarily install a newer version for testing purposes, then you could try installing it with the no dependencies option (--no-deps) in order to reduce the chance of breaking the working datalab environment. %%bash pip install scikit-learn==0.17 --ignore-installed --no-deps After running the above command, I can see scikit-learn is at version 0.17. >> sklearn.__version__ '0.17' >>!pip show scikit-learn --- Name: scikit-learn Version: 0.17 Location: /usr/local/lib/python2.7/dist-packages Requires: Please keep an eye out for any anomalies now that you have updated a package used by datalab. For example, certain sample notebooks may not work. Also, please note that this setup may not be supported. For example, you may encounter an issue which is directly related to updating a package used by datalab. In that case, the solution may be to revert the updated package and see if that resolves your issue.
%%chart line graph in Datalab based on Bigquery data not rendering
Notebook - Keyboard Shortcuts: Ctrl-K, Ctrl-J (Not Working)
Files written to disk get deleted after a while
Using persistent disks with google Datalab
How do I customize Google Cloud Datalab with extra Python modules?
How to collapse code cells in Google Cloud Datalab?
Getting large datasets into Cloud Datalab
Can't Deploy DataLab: 401 Locked Domain Expired error
Datalab “deploy” fails
Datalab: moving notebook to other folder
Unable to run a job in datalab
Why does the Table metadata show zero rows when querying the table returns rows?
Unable to deploy Google Cloud Datalab on an existing project due to RPC failure
google cloud datalab: reload set from bigquery leads to RespondNotReady
datalab gcp package vs gcloud