Instructions for Installing PyRosetta on Windows 10

Instructions for Installing PyRosetta on Windows 10 with Anniversary Update

Page created 10/2016 using Windows 10 Home, version 1607

This article is intended to guide a user through the process of updating Windows 10 with the Anniversary Update, enabling BASH, and installing PyRosetta.  The process will require at least one reboot of the computer.  If the Anniversary Update is not installed, plan for a longer window of time, in order to install the update.  If it is already installed, skip to step 2.

Installing BASH

Windows update

Make sure Windows is up to date on your computer.

    a.      Open Settings.  This can be done by clicking the gear symbol in the bottom left when you tap the Windows key or click the bottom left icon.  Alternatively, you can type ‘Settings’ into the search.

    b. Go to Update & Security

    c.       Select the Windows Update tab on the left sidebar

    d.      Select Check for updates

    e.      If the Anniversary Update has not been installed, there will be updates listed to install.  Install them. This may require some time and several reboots.

 

Change to Developer mode

Windows must be in Developer mode to use BASH.

    a.       Again under Settings, go to Update & Security (see above)

    

    b.      Select the For developers tab on the left sidebar

    

    c.       Select Developer mode 

 

Activating Linux

    a.       Open the Control Panel.  This can be done with a search, or by scrolling down the apps list to Windows System > Control Panel 

  

    b.       Go to Programs 

    

    c.       Go to Programs and Features 

  

    d.      Go to Turn Windows features on or off, on the left sidebar

  

    e.      Check the box for Windows Subsystem for Linux.  Note: This option is not available if the Anniversary Update has not been installed. 

  

    f.      At this point, one needs to open the Windows store and install one of the Linux flavors.  Go to https://aka.ms/wslstore, choose Ubuntu, install.  Then open bash.  Then it forces you to make a new user with a password.  Implementing this change will require a reboot of your computer.

Accessing BASH

After the restart, BASH should be available.  It can be accessed either with a search or by scrolling down the apps list to Bash on Ubuntu on Windows.  There are several install options.

Option 1: Set up a BASH user account

This approach is safer, but will require the use of that password and ‘sudo’ for subsequent steps.  It reduces the risk of a casual user accidentally messing things up.

Open a BASH window and create a username and password. 

Option 2: Set up a root account

With this approach, you are always the super user, so ‘sudo’ and a password input will not be necessary when using BASH from this account.

Open a Windows terminal (not BASH).  A terminal can be opened either with a search, or by scrolling down the apps list to Windows System > Command Prompt 

           In the terminal window, enter the following:

                             

    lxrun /install /y

 

Installing and running PyRosetta

Installing BASH functions

The following functions will be needed to properly set up PyRosetta4

Open a BASH window (see above) and type the following commands. Note that the 'sudo' may be omitted if the second BASH installation option was chosen. Otherwise, the first 'sudo' command will prompt you to put in the password you created.

sudo apt-get update

sudo apt-get install ipython3 python3-setuptools python3-pip

Download PyRosetta

There are several options for this.  In either case, you should make or choose a directory for PyRosetta.  

Option 1, install using pyrosetta-installer package. In bash shell do:

pip install pyrosetta-installer 

python -c 'import pyrosetta_installer; pyrosetta_installer.install_pyrosetta()'

Option 2: Installing by direct download

Preferred method

    A.  Go to the PyRosetta 4 downloads page.

    B.  Download the appropriate Linux Release wheel, based on your Python version

    C.  Move the downloaded file to the desired directory.  

    D.  In BASH, move to the PyRosetta directory

cd [your PyRosetta directory, ex: /mnt/c/Users/jhlubin/PyRosetta/]

    E.  install PyRosetta

pip3 install pyrosetta-2022.5+release.b3365a1-cp36-cp36m-linux_x86_64.whl


Running PyRosetta

If above steps have worked without errors then you can try it with the following command, first start iPython shell:

ipython3

And in iPython shell:

In [1]: import pyrosetta; pyrosetta.init()

And if everything working as expected then you should see output similar to:

PyRosetta-4 2022 [Rosetta PyRosetta4.Release.python36.ubuntu 2022.5+release.b3365a1319825b9107d34b49c5510e321cfb9385 2022-02-24T15:12:22] retrieved from: http://www.pyrosetta.org

(C) Copyright Rosetta Commons Member Institutions. Created in JHU by Sergey Lyskov and PyRosetta Team.

core.init: Checking for fconfig files in pwd and ./rosetta/flags

core.init: Rosetta version: PyRosetta4.MinSizeRel.python36.ubuntu r312 2022.08+release.b3365a13198 b3365a1319825b9107d34b49c5510e321cfb9385 http://www.pyrosetta.org 2022-02-24T15:12:22

core.init: command: PyRosetta -ex1 -ex2aro -database

...


Congratulations, you now have working PyRosetta install! 


Few more examples:

from rosetta import * 

from pyrosetta import * 

init()

p=pose_from_sequence("ACDEFGHIKLMNPQRSTVWY")

print p

PDB file name: ACDEFGHI

Total residues:20

Sequence: ACDEFGHIKLMNPQRSTVWY

Fold tree:

FOLD_TREE  EDGE 1 20 -1

print p.residue(4)

Residue 4: GLU (GLU, E):

Base: GLU

 Properties: POLYMER PROTEIN CANONICAL_AA SC_ORBITALS POLAR CHARGED NEGATIVE_CHARGE METALBINDING ALPHA_AA L_AA

 Variant types:

 Main-chain atoms:  N    CA   C

 Backbone atoms:    N    CA   C    O    H    HA

 Side-chain atoms:  CB   CG   CD   OE1  OE2 1HB  2HB  1HG  2HG

Atom Coordinates:

   N  : 9.53449, 5.35894, 5.86727e-16

   CA : 10.1896, 6.66148, -2.44225e-17

   C  : 11.7058, 6.51548, 9.3584e-16

   O  : 12.2319, 5.40254, 2.76825e-07

   CB : 9.74645, 7.48145, 1.21373

   CG : 8.75059, 6.7733, 2.12125

   CD : 8.39724, 5.39412, 1.63846

   OE1: 8.91075, 4.9912, 0.622485

   OE2: 7.61256, 4.74245, 2.28668

   H  : 10.1015, 4.5231, 1.53279e-15

   HA : 9.89999, 7.19446, -0.906235

  1HB : 10.6181, 7.74355, 1.81372

  2HB : 9.28915, 8.41188, 0.876963

  1HG : 9.17642, 6.69754, 3.12143

  2HG : 7.84419, 7.37357, 2.1867

Note that when you are done with ipython, you can exit the session and return to where you left off in BASH by typing control + d and entering y.

Running the PyMol Mover

For instructions on installing PyMOL, see https://www.pymol.org/install

For tips using the PyMOL_Mover, see http://www.pyrosetta.org/pymol_mover-tutorial

Ideally, having PyMOL and PyRosetta installed, and running PyMOLPyRosettaServer.py in PyMOL should work properly.  However, there are several issues that have been noted, and their solutions follow.

PyMOLPyRosettaServer.py missing 

If PyMOLPyRosettaServer.py is not present in the PyRosetta 4 download, it can be copied and pasted from an older PyRosetta 3 installation.

Port listing issues 

On some computers, the default port for the PyMOL_Mover, 65000, is used by other programs.  (DropBox and NVidia stream service have been identified so far.)  In this case, PyMOL will return something like the following when told to run PyMOLPyRosettaServer.py, and it will be necessary to change the port usage.

PyMOL <---> PyRosetta link started!

at 127.0.0.1 port 65000

Exception in thread Thread-5:

Traceback (most recent call last):

  File "C:\Program Files\PyMOL\PyMOL\py27\lib\threading.py", line 810, in __bootstrap_inner

    self.run()

  File "C:\Program Files\PyMOL\PyMOL\py27\lib\threading.py", line 763, in run

    self.__target(*self.__args, **self.__kwargs)

  File "PyMOLPyRosettaServer.py", line 1141, in main

    udp_serv = PR_UDPServer(ip, port)

  File "PyMOLPyRosettaServer.py", line 247, in __init__

    raise StartUpError()

StartUpError: FAILED TO START PyRosetta-PyMOL server.

Do you already have another instance of it running?

a.       To see what ports are in use, open the Resource Monitor.  This can be done with a search, or by scrolling down the apps list to Windows Administrative Tools > Resource Monitor

b.      Go to the Network tab and open the Listening Ports dropdown.  The used ports will all be listed in the Port column.

c.       Select a port number that is not in use.  This can be any number between 1024 and 65536.  In the above example, 65002 was used.

d.      Open PyMOLPyRosettaServer.py in a text editor.

e.      Find the line, usually 1186 near the end of the file, that says

 start_rosetta_server('127.0.0.1', 65000)

Change the port from 65000 to the new port number

 

f.        In the future, when running PyRosetta and initiating the PyMOL_Mover, instead of using the command

pmm = PyMOL_Mover()

                                use the following

                                           

pmm = PyMOL_Mover('127.0.0.1', port=[new port number, ex: 65002])

g.       If desired, this change can be made to the following files in the PyRosetta 4 test folder to view  the tests in PyMOL:

·         C001_Carbohydrates_Demo01.py

·         Workshop3test.py

·         Workshop4test.py

·         Workshop5test.py

·         Workshop8test.py

All tests except 'C001_Carbohydrates_Demo01' should pass.

Tips and suggestions

Copying and Pasting in BASH on Windows

You may have noted that control + shift + c and control + shift + v do not work in the Windows BASH as they do on Linux.  The best solution we have found so far is to do the following:

Now, copying and pasting is possible.  To copy text from the BASH window, highlight it and right click.  Pasting can be done similarly; if you have copied text from elsewhere, right clicking into the command line will past the text into the BASH terminal.

Alternatively, copying and pasting can be made by right clicking the BASH icon and going to Edit.

We hope you have found this guide helpful.

For further questions, we encourage you to go to https://www.rosettacommons.org/forum