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

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
Is there a list of the datalab keyboard shortcuts?
In datalab, Is it possible to pass data into a chart from python?
What is the best way to stop execution of a cell on a Google Datalab notebook?
How do I quickly get data out of a Google Cloud Datalab notebook?
is it possible to use the discovery module from the Google apiclient in Cloud Datalab?
%%chart line graph in Datalab based on Bigquery data not rendering
Notebook - Keyboard Shortcuts: Ctrl-K, Ctrl-J (Not Working)

Categories

HOME
batch-file
phantom-dsl
polymer
jax-rs
ns-3
3d
interface
yahoo-finance
mstest
socket.io
shiro
carousel
mapbox
vert.x
odoo-8
fhir
java.util.logging
gruntfile
azure-powershell
coin3d
alpacajs
dreamweaver
libigl
visual-studio-extensions
dynamically-generated
ckfinder
dapper-extensions
google-earth
recurring-events
jmockit
jett
yowsup
zoomify
sessionstorage
ods
chef-solo
xv6
movilizer
avcapturedevice
file-sharing
x++
openresty
wcftestclient
geotiff
semantic-logging
type-theory
lsyncd
rsa-archer-grc
simplepie
mapinfo
dimension
android-wake-lock
aurora
thread-sleep
realsense
inf
dynamics-nav-2016
iokit
r-package
fiware-monitoring
django-urls
cgi-bin
dronekit-android
avahi
aspectj-maven-plugin
user-permissions
easyrtc
mobility
verold
lnk
authlogic
visual-studio-express
sphinxql
pdfviewer
cakephp-1.2
boost-signals
azman
flex-mobile
role
expression-blend-4
u2netdk
cgbitmapcontextcreate
instantiationexception
message-passing
addchild
duplex
dsoframer
netbeans6.1

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