python - Running IPython Notebook over Python3 in a VM -


i'm struggling put simple vm can use run ipython notebook on python3.

i figured best way set virtual env python , install required libraries before starting ipython server, although maybe better way separate out virtualenv creation shell script?

update: 1 major problem had incomplete paths...

##vagrantfile  vagrant.configure("2") |config|    config.vm.box = "precise64"   config.vm.box_url = "http://files.vagrantup.com/precise64.box"    config.ssh.forward_x11 = true    config.vm.provision :puppet,      :options => "--modulepath=/vagrant/modules" |puppet|     puppet.manifests_path = "."     puppet.manifest_file = "site.pp"   end    config.vm.define :python3 |python3|     python3.vm.hostname = "python3"     python3.vm.provider :virtualbox |virtualbox|       virtualbox.name = "python3"     end     python3.vm.network :forwarded_port, guest: 8888, host: 8888   end end  ###site.pp node default {   include testvm }   #in modules/testvm//manifests/box/python3.pp class testvm::box::python3 {   #i hoping require statement install python3 & virtualenv first?   require python3::base    #but doesn't seem because following exec runs first , fails?   #ssh'ing vm , base packages didn't install?   exec {     'py3-venv':       command => '/usr/bin/virtualenv --python=/usr/bin/python3 testpy3',       require => package['openssh-server','python-virtualenv'];   ##i think problem narrowed down - how run source or . ?     'py3-activate':       command => 'source testpy3/bin/activate',       require=>exec['py3-venv'];   }    #try add in dependency force package install - still doesn't work?   package['python3']->exec['py3-venv']     #install in small package check appears in python3 env   package {     [       'ipythonblocks'     ]: ensure   => latest,        provider => 'pip';   } }  #i assumed install before exec fired doesn't seem to? class testvm::box::python3::base {   package { 'python3':     ensure => latest   }   package {     [ 'ipython3',       'python-virtualenv'     ]: require => package['python3'];   } } 

if ssh in , install hand, can run source command fine commandline.

however, if try reprovision machine stuff installed hand still error?

'source testpy3/bin/activate' not qualified , no path specified. please qualify command or specify path.

solution problem: solution problem of source not being qualified can found here: https://ask.puppetlabs.com/question/2177/how-to-execute-source-command/ solution is: command => "/bin/bash -c 'source testpy3/bin/activate'"

but new problem arises: err: /stage[main]/infinite_interns::box::python3/exec[py3-venv]/returns: change notrun 0 failed: /usr/bin/virtualenv –-no-site-packages --python=/usr/bin/python3 testpy3 returned 1 instead of 1 of [0] @ /vagrant/modules/infinite_interns/manifests/box/python3.pp:14

doh - in actual script had /usr/bin/virtualenv –-no-site-packages --python=/usr/bin/python3 testpy3, should have been /usr/bin/virtualenv --python=/usr/bin/python3 testpy3`

so that's now...

update 2 - or not.. added exec['py3-venv']->package['ipythonblocks'] make sure virtualenv stuff installed , executed before trying install additional module via pip, whilst executes can't see installed library in virtualenv in vm?

so question is: can puppet pip install libraries virtualenv testpy3?m or better not using virtualenv , calling python3 , related tools directly?

answer: have given on virtualenv , settling 'just' running python3 in global scope. i'm on ubuntu, need easy_install3 pip described in https://askubuntu.com/questions/412178/how-to-install-pip-for-python-3-in-ubuntu-12-04-lts ; use pip3 provider, https://github.com/bodepd/puppet-pip/blob/master/lib/puppet/provider/package/pip3.rb

onto ps bit see if works..

ps next step notebook running via file in etc/init - following it? (i haven't got far yet!) work or ipython notebook under python 3 use different starting incantation?!

script   export home="/root"   /vagrant/notebooks/ipython3 notebook --ip 0.0.0.0 end script 

with caveat haven't quite gotten work me reliably (that is, it's worked few times & stopped, reinstalls work & don't [seems affected other packages install after, non-clean dst install, etc]), building vm based on data science toolbox, found here: http://datasciencetoolbox.org/ . in our office making package students based on python 3 , ipython.

at rate, very interested talk interaction amongst vagrant, python3, & ipython.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -