google-cloud-datalab


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.

Related Links

How can I get the Cloud ML service account programmatically in Python?
Google datalab : how to import pickle
Is text the only content type for %%storage magic function in datalab
Do I need to update gcloud components as indicated in docker startup
How to import user-written custom modules in google datalab?
Access to Google Cloud Datalab Fails with ssh Error
Cloud Datalab permissions - 403 on VM URL when sharing access
Do I need to manually specify the project on docker Datalab?
DATALAB does not start correctly
Datalab Notebook Answer y/N in prompt
Error on deploy
How can i load my csv from google dataLab to a pandas data frame?
Recommended approach for installing and using new kernels?
How do you logout/switch accounts?
Running sklearn 0.17 in Google Cloud Datalab
Sharing the datalab notebooks

Categories

HOME
gridview
apache-flink
formal-languages
visual-studio-emulator
maxscript
boto3
mel
redis-sentinel
emoji
libc
code-generation
event-sourcing
dreamweaver
android-7.0-nougat
google-data-studio
pyramid
drive
pagespeed
roslyn
dynamically-generated
moses
has-and-belongs-to-many
soot
carrierwave
autodesk-designautomation
kudu
testbed
sendbird
arduino-ide
roblox
mongoose-schema
naming
httr
fwrite
openal
sonarlint-eclipse
serde
mongotemplate
x-ray
amq
azure-cli
excel-dna
skin
mouseleave
offline.js
pocketsphinx-android
testrail
rocks
cudd
meteor-packages
custom-lists
microstation
envi
resourcemanager
jboss-tools
i386
delta
simevents
cassia
tracker-enabled-dbcontext
user-management
inf
computer-architecture
pax-exam
visual-sourcesafe-2005
jdk1.7
omnifaces
ghcjs
jquery-slider
high-resolution
solace-mq
ui-select2
veracity
wcf-configuration
cuda-gdb
inkcanvas
infobright
urlrewriter
node-redis
http-daemon
collectionviewsource
objective-j
squishit
wcf-instancing
interop-domino
technical-debt
business-model

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App