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

%%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
How to link chart and javascript cell to have the same chart object as reference
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

Categories

HOME
shell
windows
assembly
developer-tools
string
jmx
camera
r-googlesheets
ms-access-2016
rds
big-o
telegram-bot
regular-language
settings
x264
g++
categorical-data
owin
octave
startup
automatic-ref-counting
speech-synthesis
parameter-passing
package.json
html5-appcache
git-extensions
smartclient
jmp
cfml
enterprise-miner
spring-async
libigl
visual-studio-extensions
ckfinder
gpio
bulletphysics
android-sharedpreferences
ms-access-web-app
outliers
constexpr
spring-security4
xdocreport
demo
stringtokenizer
odoo-website
oracle-service-bus
user-defined-fields
trojan
headless
otp
gameplay-kit
juice-ui
visual-studio-2008-sp1
mapxtreme
actor-platform
wso2developerstudio
dimension
tracker-enabled-dbcontext
upx
yajsw
design-principles
phpgrid
jbase
vhosts
assertion
lazybones
intel-c++
opserver
wso2greg
branch-and-bound
ocra
graphics2d
mirror
omnifaces
rapidsvn
at-job
human-computer-interface
xml-dsig
grails-plugin-rabbitmq
winginx
draw2d-js
isqlquery
css-reset
font-awesome-4.0.0
chart-director
twisted.web
subgraph
winmain
umra
twitterizer
commerceserver2007
objective-j
globals
wcf-instancing
application-planning
sqlobject

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App