%23%20%2F%2F%2F%20script%0A%23%20requires-python%20%3D%20%22%3E%3D3.11%22%0A%23%20dependencies%20%3D%20%5B%22marimo%3E%3D0.23.9%22%5D%0A%23%20%2F%2F%2F%0A%0Aimport%20marimo%0A%0A__generated_with%20%3D%20%220.25.2%22%0Aapp%20%3D%20marimo.App()%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20How%20to%20install%20Python%20for%20scientific%20computing%0A%0A%20%20%20%20%3E%20Marcos%20Duarte%2C%20Renato%20Naville%20Watanabe%3Cbr%3E%0A%20%20%20%20%3E%20%5BLaboratory%20of%20Biomechanics%20and%20Motor%20Control%5D(https%3A%2F%2Fbmclab.pesquisa.ufabc.edu.br%2F)%3Cbr%3E%0A%20%20%20%20%3E%20Federal%20University%20of%20ABC%2C%20Brazil%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20How%20to%20use%20this%20guide%0A%0A%20%20%20%20You%20should%20be%20able%20to%20reopen%20a%20scientific%20analysis%20months%20later%20and%20know%20which%20software%20produced%20it.%20This%20guide%20gets%20you%20from%20a%20terminal%20to%20a%20reproducible%20notebook%20environment%2C%20then%20distinguishes%20local%20and%20hosted%20execution.%20No%20previous%20Python%20knowledge%20is%20needed.%0A%0A%20%20%20%20Read%20the%20examples%20in%20order%2C%20predict%20each%20result%2C%20and%20then%20run%20the%20cell.%20Try%20the%20distributed%20Exercises%20before%20opening%20their%20worked%20solutions.%20Finish%20with%20the%20checkpoint%20questions%20and%20independent%20Problems%3B%20their%20panels%20contain%20final%20answers%20only.%0A%0A%20%20%20%20**Challenge%200.**%20Two%20computers%20both%20report%20%E2%80%9CPython%203%E2%80%9D%20but%20only%20one%20can%20import%20NumPy.%20What%20is%20missing%20from%20that%20description%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Python%20setup%0A%0A%20%20%20%20This%20reading%20guide%20needs%20only%20Marimo.%20Commands%20shown%20in%20fenced%20blocks%20are%20instructions%20for%20your%20terminal%3B%20reading%20the%20notebook%20does%20not%20install%20software%20or%20change%20your%20system.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Install%20an%20environment%20for%20this%20collection%0A%0A%20%20%20%20The%20first%20question%20is%20not%20%E2%80%9Cwhere%20is%20Python%20installed%3F%E2%80%9D%20but%20%E2%80%9Cwhich%20Python%20runs%20this%20notebook%2C%20and%20which%20packages%20belong%20to%20it%3F%E2%80%9D%20An%20environment%20keeps%20those%20answers%20together.%20Do%20not%20rely%20on%20a%20system%20Python%20being%20present%20on%20macOS%2C%20Linux%2C%20or%20Windows%3B%20installations%20differ.%0A%0A%20%20%20%20For%20this%20repository%2C%20install%20%5Buv%20using%20its%20official%20instructions%5D(https%3A%2F%2Fdocs.astral.sh%2Fuv%2Fgetting-started%2Finstallation%2F)%2C%20obtain%20the%20BMC%20repository%2C%20and%20open%20a%20terminal%20in%20its%20root%20folder.%20The%20checked-in%20%60pyproject.toml%60%20and%20%60uv.lock%60%20specify%20the%20environment.%20Run%3A%0A%0A%20%20%20%20%60%60%60sh%0A%20%20%20%20uv%20sync%20--locked%0A%20%20%20%20uv%20run%20python%20--version%0A%20%20%20%20uv%20run%20marimo%20edit%20notebooks%2Fpython_installation.py%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20The%20project%20requires%20Python%203.14%20or%20newer.%20%60uv%60%20can%20obtain%20a%20compatible%20interpreter%3B%20allow%20network%20access%20on%20the%20first%20setup.%20Later%20runs%20use%20the%20project%20environment%20in%20%60.venv%60.%20A%20shell%20prompt%20is%20not%20Python's%20%60%3E%3E%3E%60%20prompt%3A%20the%20commands%20above%20belong%20in%20the%20terminal.%0A%0A%20%20%20%20NumPy%20handles%20arrays%3B%20SciPy%20supplies%20numerical%20algorithms%3B%20Matplotlib%20draws%20figures%3B%20SymPy%20works%20symbolically%3B%20pandas%20organizes%20tables.%20Statsmodels%20and%20scikit-learn%20cover%20statistical%20modeling%20and%20machine%20learning.%20IPython%2C%20Jupyter%2C%20Spyder%2C%20and%20Qt-based%20interfaces%20are%20useful%20alternatives%20in%20the%20broader%20ecosystem%2C%20but%20you%20do%20not%20need%20to%20install%20every%20tool%20to%20read%20one%20guide.%20The%20notebook's%20inline%20dependency%20block%20describes%20its%20standalone%20needs.%0A%0A%20%20%20%20%23%23%23%20Historical%20terminal%20examples%0A%0A%20%20%20%20These%20original%20screenshots%20show%20older%20macOS%2C%20Ubuntu%2C%20and%20Windows%207%20environments.%20Keep%20them%20as%20illustrations%20of%20a%20terminal%20and%20interpreter%20prompt%2C%20not%20as%20instructions%20for%20a%20current%20operating%20system.%0A%0A%20%20%20%20!%5BHistorical%20macOS%20terminal%5D(https%3A%2F%2Fraw.githubusercontent.com%2FBMClab%2FBMC%2Fmaster%2Fimages%2Fterminal_mac_osx.png)%0A%20%20%20%20!%5BHistorical%20Ubuntu%20terminal%5D(https%3A%2F%2Fraw.githubusercontent.com%2FBMClab%2FBMC%2Fmaster%2Fimages%2Fterminal_linux_ubuntu.png)%0A%20%20%20%20!%5BHistorical%20Windows%20command%20prompt%5D(https%3A%2F%2Fraw.githubusercontent.com%2FBMClab%2FBMC%2Fmaster%2Fimages%2Fcommand_prompt.png)%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%201.**%20You%20typed%20%60uv%20sync%20--locked%60%20at%20the%20Python%20%60%3E%3E%3E%60%20prompt%20and%20received%20a%20syntax%20error.%20What%20happened%3F%0A%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%201%0A%20%20%20%20The%20Python%20interpreter%20expects%20Python%20expressions%2C%20while%20%60uv%60%20is%20a%20terminal%20command.%20Exit%20the%20interpreter%20and%20run%20the%20command%20from%20your%20shell%20in%20the%20repository%20root.%20The%20error%20does%20not%20mean%20the%20project%20is%20broken.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Python%203%20and%20reproducibility%0A%0A%20%20%20%20Use%20Python%203.%20Python%202%20reached%20end%20of%20life%20in%202020%3B%20compatibility%20shims%20and%20Python-2%20installers%20are%20no%20longer%20part%20of%20this%20guide.%20A%20notebook%20that%20runs%20under%20one%20Python%20version%20can%20still%20depend%20on%20package%20versions%2C%20so%20save%20both%20the%20source%20and%20its%20environment%20specification.%0A%0A%20%20%20%20%60uv%20run%60%20selects%20the%20project%20environment%20when%20you%20run%20the%20commands%20from%20the%20repository%20root.%20To%20diagnose%20an%20unexpected%20interpreter%2C%20run%20%60uv%20run%20python%20-c%20%22import%20sys%3B%20print(sys.executable)%22%60.%20If%20an%20import%20fails%2C%20first%20check%20which%20environment%20is%20running%3B%20installing%20the%20package%20into%20an%20unrelated%20interpreter%20will%20not%20solve%20it.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%202.**%20A%20package%20imports%20in%20one%20terminal%20but%20not%20in%20your%20notebook.%20What%20two%20facts%20would%20you%20compare%20before%20reinstalling%20anything%3F%0A%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%202%0A%20%20%20%20Compare%20%60sys.executable%60%20and%20the%20active%20environment%2Fpackage%20set.%20A%20notebook%20server%20and%20a%20terminal%20can%20run%20different%20Python%20installations.%20Launching%20the%20editor%20through%20%60uv%20run%60%20from%20the%20project%20root%20connects%20it%20to%20the%20declared%20project%20environment.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Other%20ways%20to%20obtain%20scientific%20Python%0A%0A%20%20%20%20%5BAnaconda%20Distribution%20and%20Miniconda%5D(https%3A%2F%2Fwww.anaconda.com%2Fdocs%2Fgetting-started%2Finstallation)%20remain%20alternatives%20for%20managing%20Python%20environments.%20Follow%20the%20current%20instructions%20for%20your%20operating%20system%20and%20processor%20architecture%20instead%20of%20copying%20an%20old%20installer%20filename.%20Check%20the%20provider's%20terms%20for%20your%20use.%20Miniconda%20starts%20with%20a%20smaller%20environment%3B%20the%20distribution%20bundles%20more%20tools.%20These%20are%20alternatives%20to%20the%20repository's%20uv%20workflow%2C%20not%20additional%20requirements.%0A%0A%20%20%20%20For%20a%20notebook%20without%20a%20local%20installation%2C%20use%20%5Bmarimo.app%5D(https%3A%2F%2Fmarimo.app%2F)%20or%20%5Bmolab%5D(https%3A%2F%2Fmolab.marimo.io%2Fnotebooks).%20The%20first%20runs%20Python%20in%20the%20browser%20through%20WebAssembly%3B%20molab%20runs%20a%20hosted%20Python%20environment.%20Browser-supported%20packages%20and%20available%20files%20still%20matter.%20Uploading%20a%20notebook%20does%20not%20upload%20every%20file%20on%20your%20computer.%20Consult%20%5BMarimo's%20WebAssembly%20guide%5D(https%3A%2F%2Fdocs.marimo.io%2Fguides%2Fwasm%2F)%20when%20a%20native%20dependency%20or%20file%20access%20behaves%20differently.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%203.**%20Will%20uploading%20only%20a%20%60.py%60%20notebook%20also%20upload%20a%20CSV%20stored%20next%20to%20it%3F%20Explain%20what%20dependency%20metadata%20does%20and%20does%20not%20cover.%0A%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%203%0A%20%20%20%20No.%20Inline%20metadata%20declares%20Python%20packages%2C%20not%20your%20private%20local%20data.%20Upload%20required%20files%20separately%20or%20use%20the%20notebook%E2%80%99s%20explicit%20public-data%20loader.%20A%20successful%20package%20installation%20cannot%20repair%20a%20missing%20dataset.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Launching%20and%20checking%20your%20tools%0A%0A%20%20%20%20Start%20the%20editor%20with%20%60uv%20run%20marimo%20edit%20notebooks%2Fpython_installation.py%60.%20Run%20the%20cells%20and%20inspect%20their%20outputs.%20A%20command%20that%20prints%20a%20version%20proves%20that%20a%20program%20can%20start%3B%20it%20does%20not%20prove%20that%20every%20notebook%20dependency%20and%20dataset%20is%20available.%20Open%20a%20computational%20guide%20next%20and%20run%20all%20its%20cells.%0A%0A%20%20%20%20The%20original%20material%20compared%20IPython%20notebooks%2C%20the%20Spyder%20IDE%2C%20and%20a%20hosted%20service%20called%20Wakari.%20The%20screenshots%20below%20preserve%20that%20history.%20Wakari%20is%20no%20longer%20an%20active%20recommendation%3B%20use%20the%20Marimo%20services%20linked%20above%20for%20this%20collection.%20Jupyter%20and%20Spyder%20remain%20separate%20tools%20with%20their%20own%20workflows.%0A%0A%20%20%20%20!%5BHistorical%20Anaconda%20launcher%5D(https%3A%2F%2Fraw.githubusercontent.com%2FBMClab%2FBMC%2Fmaster%2Fimages%2Fanaconda_launcher_win7.png)%0A%20%20%20%20!%5BHistorical%20IPython%20notebook%5D(https%3A%2F%2Fraw.githubusercontent.com%2FBMClab%2FBMC%2Fmaster%2Fimages%2Fipython_notebook_win7.png)%0A%20%20%20%20!%5BHistorical%20Spyder%20IDE%5D(https%3A%2F%2Fraw.githubusercontent.com%2FBMClab%2FBMC%2Fmaster%2Fimages%2Fspyder_win7.png)%0A%20%20%20%20!%5BHistorical%20Wakari%20service%5D(https%3A%2F%2Fraw.githubusercontent.com%2FBMClab%2FBMC%2Fmaster%2Fimages%2Fwakari.png)%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Checkpoint%20questions%0A%0A%20%20%20%201.%20What%20does%20the%20lockfile%20add%20to%20a%20list%20of%20package%20names%3F%0A%20%20%20%202.%20Must%20your%20operating%20system%20provide%20Python%3F%0A%20%20%20%203.%20Are%20a%20terminal%20command%20and%20Python%20code%20interchangeable%3F%0A%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Checkpoint%20answers%0A%20%20%20%201.%20A%20resolved%20dependency%20specification%20for%20reproducible%20project%20setup.%0A%20%20%20%202.%20No.%0A%20%20%20%203.%20No%3B%20run%20each%20in%20its%20appropriate%20interpreter.%0A%20%20%20%20%2F%2F%2F%0A%0A%20%20%20%20%23%23%20Problems%0A%0A%20%20%20%201.%20State%20the%20command%20that%20opens%20this%20guide%20in%20the%20repository%20environment.%0A%20%20%20%202.%20Name%20the%20two%20project%20files%20to%20inspect%20when%20dependency%20requirements%20disagree.%0A%20%20%20%203.%20A%20browser%20notebook%20needs%20a%20native-only%20package.%20What%20environment%20is%20the%20practical%20next%20choice%3F%0A%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Final%20answers%0A%20%20%20%201.%20%60uv%20run%20marimo%20edit%20notebooks%2Fpython_installation.py%60.%0A%20%20%20%202.%20%60pyproject.toml%60%20and%20%60uv.lock%60.%0A%20%20%20%203.%20A%20compatible%20local%20or%20hosted%20CPython%20environment%2C%20such%20as%20molab%2C%20with%20that%20package%20installed.%0A%20%20%20%20%2F%2F%2F%0A%0A%20%20%20%20%23%23%20Go%20deeper%0A%0A%20%20%20%20%5Buv%20project%20guide%5D(https%3A%2F%2Fdocs.astral.sh%2Fuv%2Fguides%2Fprojects%2F)%20%E2%80%94%20environment%20and%20lockfile%20workflow.%20Continue%20with%20%5BPython%20tutorial%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fpython_tutorial.py)%20to%20run%20real%20calculations.%0A%0A%20%20%20%20%23%23%23%20Video%20lectures%20on%20the%20Internet%0A%0A%20%20%20%20%5BMIT%3A%20Introduction%20to%20Computer%20Science%20and%20Programming%20in%20Python%5D(https%3A%2F%2Focw.mit.edu%2Fcourses%2F6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016%2Fvideo_galleries%2Flecture-videos%2F)%20%E2%80%94%20start%20with%20computation%2C%20branching%2C%20and%20iteration%3B%20the%20videos%20explain%20how%20to%20reason%20about%20code%20before%20running%20it.%0A%0A%20%20%20%20%23%23%20References%0A%0A%20%20%20%20-%20%5Buv%20installation%5D(https%3A%2F%2Fdocs.astral.sh%2Fuv%2Fgetting-started%2Finstallation%2F)%3B%20%5BPython%202%20sunset%5D(https%3A%2F%2Fwww.python.org%2Fdoc%2Fsunset-python-2%2F)%3B%20%5BMarimo%20WebAssembly%5D(https%3A%2F%2Fdocs.marimo.io%2Fguides%2Fwasm%2F).%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
733a59424b65697f1d04fbb747f7be88