{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\\rightarrow$Run All).\n", "\n", "Make sure you fill in any place that says `YOUR CODE HERE` or \"YOUR ANSWER HERE\", as well as your name and collaborators below:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "NAME = \"\"\n", "COLLABORATORS = \"\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "*This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta.notebooks);\n", "content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "| [Contents](toc.ipynb) | [Index](index.ipynb) | [PyRosetta Google Drive Setup](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/01.01-PyRosetta-Google-Drive-Setup.ipynb) >

\"Open" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# How to Get Started" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Students" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Step 1:** Sign in to Google Drive.\n", "\n", "**Step 2:** Make a new folder called “PyRosetta” in your top level directory on Google Drive.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from IPython.display import Image\n", "Image('./Media/PyRosetta-folder.png',width='600')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Step 3:** Get your PyRosetta license.\n", "\n", "**Step 4:** Download the Linux [PyRosetta package](http://www.pyrosetta.org/dow) that is called \"Python-3.6.MinSizeRel\".\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Image('./Media/linux-download.png',width='400')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Step 5:** Upload the Linux PyRosetta package (.tar file) to the PyRosetta folder in your Google Drive.\n", "\n", "**Step 6:** Upload the PyRosetta notebooks folder to the top-level directory of your Google Drive." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Image('./Media/google-drive.png',width='600')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Step 7:** Open up “01.01-PyRosetta-Google-Drive-Setup.ipynb” in Google Colab by right-clicking, going under “Open With…” and clicking Google Colaboratory.\n", "\n", "**Step 8:** Follow steps to install PyRosetta. Note: You only need to do this once since this installation will be associated with your Google Drive account.\n", "\n", "**Step 9:** In “01.01-PyRosetta-Google-Drive-Setup.ipynb”, follow the steps to install third-party external packages, using `pip`:\n", "\n", "`pip install biopython blosc dask dask-jobqueue distributed graphviz jupyter matplotlib numpy pandas py3Dmol scipy seaborn traitlets --user`\n", "\n", "**Step 9.1:**\n", "\n", "**For Chapter 16, Running PyRosetta in Parallel (and a few other notebooks), you will need to use a specific version of PyRosetta that is built for parallelization.** This is the serialization build. Besides manually building it from the Rosetta C++ source code, the general way to obtain this is through the use of a `conda` environment. \n", "\n", "A `conda` environment is a way to run code that has specific versions of required packages, that instead of being installed globally, will be installed as a local virtual environment that you may run whenever you wish. This is extremely useful when some packages require specific versions of other packages, as is the case for some rosetta distributed code. \n", "\n", "You will need to pass the username and password of PyRosetta to conda. \n", "In order to do this, we will create a file in your home directory called `.condarc`. If you already have this file, please edit it instead of overriding it below. \n", "\n", "**Here, instead of USERNAME and PASSWORD, enter the USERNAME and PASSWORD you were given while gaining access to PyRosetta.**\n", "\n", "```\n", "echo \"channels:\" >> $HOME/.condarc\n", "echo \" - https://USERNAME:PASSWORD@conda.graylab.jhu.edu\" >> $HOME/.condarc\n", "echo \" - defaults\" >> $HOME/.condarc\n", "conda env create -f environment.yml\n", "conda activate PyRosetta.notebooks\n", "```\n", "\n", "Each time you wish to run this environment, use `conda activate PyRosetta.notebooks` to create the local virtual environment BEFORE running the jupyter notebook. You may wish to put this in your system configuration on startup. It is recommended to activate conda before you run the notebooks in general. The correct kernel is set for them. \n", "\n", "**NOTE:**\n", "When using a notebook with this environment - the python **Kernel** must be set to this env. *In Chapter 16 and other parellel notebooks, this is done for you*, but if you wish to use this environment in other notebooks, make sure to run conda manually change this! \n", "\n", "You can do this by looking at the jupyter menu - `Kernel` is after `Cell` and before `Widgets`. The option is 'Change Kernel`. This is how you would run python2 vs python3 or run a kernal with other conda environments you have installed on your computer. \n", "\n", "**Step 10:** Open up “01.02-PyRosetta-Google-Drive-Usage-Example.ipynb” in Colab to make sure that PyRosetta was installed properly. You are now ready to move on to the other notebooks!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Known Limitations:**\n", "\n", "- If you receive the error `AttributeError: module 'pyrosetta.rosetta' has no attribute '__path__'` or `TypeError: int returned non-int (type str)` then serialized functions need to locally import libraries (specifically, add `import pyrosetta`, `import pyrosetta.distributed` and other `pyrosetta` imports to the serialized functions, i.e. any functions passed to `client.submit` or `dask.delayed`).\n", "\n", "Example:\n", "\n", "```\n", "def my_function(packed_pose): \n", " import pyrosetta\n", " pyrosetta.MoveMap()\n", " return packed_pose\n", "client.submit(my_function, packed_pose)\n", "```\n", "\n", "\n", "- If running dask's `LocalCluster(n_workers=2, threads_per_worker=2)`, you may need to adjust to `n_workers=1` and `threads_per_worker=1` if you encounter errors on some systems.\n", "\n", "\n", "- If running dask's `LocalCluster(n_workers=2, threads_per_worker=2)` in a standalone python script, the `LocalCluster` instance must be called within the `if __name__ == \"__main__\"` block.\n", "\n", "\n", "- If using `Jupyter Lab`, the `pyrosetta.distributed.viewer` visualizer with `py3Dmol` bindings may not function correctly (i.e. the interactive scrollbar widget may not work or the visualizer doesn't appear). To fix this, you may have to install the following Jupyter Lab extensions:\n", "\n", "`jupyter labextension install jupyterlab_3dmol`\n", "\n", "`jupyter labextension install @jupyter-widgets/jupyterlab-manager`\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Instructors" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Step 1:** Please install extensions nbgrader and nbpages.\n", "\n", "**Step 2:** Make any changes to the workshops in the \"notebooks\" folder. (You can follow the directions for students and edit them in Google Colab or on your own computer using a Jupyter Notebooks browser.)\n", "\n", "**Step 3:** When you are done making changes, run make-student-nb.bash to automatically generate the student notebooks in a separate folder, the table of contents, and the keyword index. The student notebooks are copies of the instructor's version that have omitted solutions." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Chapter contributors:**\n", "\n", "- Kathy Le (Johns Hopkins University)\n", "- Sergey Lyskov (Johns Hopkins University)\n", "- Jason C. Klima (University of Washington; Lyell Immunopharma)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "| [Contents](toc.ipynb) | [Index](index.ipynb) | [PyRosetta Google Drive Setup](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/01.01-PyRosetta-Google-Drive-Setup.ipynb) >

\"Open" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }