This is a read-only mirror of pymolwiki.org

Difference between revisions of "Git install scripts"

From PyMOL Wiki
Jump to navigation Jump to search
(→‎For Windows users: Removed "python" text - not necessary)
m (1 revision)
 
(19 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
== Manual download of scripts ==
 
== Manual download of scripts ==
If you don't have the option or want't to install git on your system, then go to
+
If you don't have the option or don't feel like installing git on your system, then go to:
 
  https://github.com/Pymol-Scripts/Pymol-script-repo
 
  https://github.com/Pymol-Scripts/Pymol-script-repo
 
Click the "ZIP" button, near the top left corner.
 
Click the "ZIP" button, near the top left corner.
 
Now unpack the files to a directory. For example:
 
Now unpack the files to a directory. For example:
  C:/Users/YOURNAME/Documents/Pymol-script-repo
+
  C:/Users/YOURNAME/Pymol-script-repo
or
+
  /home/YOURNAME/Pymol-script-repo
  /home/YOURNAME/Software/pymol
 
  
Now go to: '''Adding Pymol-script-repo to PyMOL search path''' [http://www.pymolwiki.org/index.php/Git_install#Adding_Pymol-script-repo_to_PyMOL_search_path]
+
Continue with [[#Adding Pymol-script-repo to PyMOL search path]]
  
 
== Git install instructions ==
 
== Git install instructions ==
Line 18: Line 17:
 
* Checkout Windows style, commit Unix-style endings
 
* Checkout Windows style, commit Unix-style endings
  
# Navigate to: '''C:\Users\YOURNAME\Documents\pymol'''
+
# Navigate to: '''C:\Users\YOURNAME'''
 
# Right click in folder -> Select: Git Gui -> Clone Existing Repository
 
# Right click in folder -> Select: Git Gui -> Clone Existing Repository
 
# Source Location: git://github.com/Pymol-Scripts/Pymol-script-repo.git
 
# Source Location: git://github.com/Pymol-Scripts/Pymol-script-repo.git
# Target Directory: C:\\Users\\YOURNAME\\Documents\\pymol\Pymol-script-repo
+
# Target Directory: C:\\Users\\YOURNAME\\Pymol-script-repo
 
#: A backslash "\" in a string is [http://effbot.org/pyref/string-literals.htm is used for escape sequences]. To get a real backslash in a string, use double backslash "\\"   
 
#: A backslash "\" in a string is [http://effbot.org/pyref/string-literals.htm is used for escape sequences]. To get a real backslash in a string, use double backslash "\\"   
 
You now have all the scripts available in your directory.
 
You now have all the scripts available in your directory.
Line 35: Line 34:
  
 
# Navigate to desired folder:  
 
# Navigate to desired folder:  
  cd /home/YOURNAME/Software/pymol
+
  cd /home/YOURNAME/
 
  git clone git://github.com/Pymol-Scripts/Pymol-script-repo.git
 
  git clone git://github.com/Pymol-Scripts/Pymol-script-repo.git
You now have all the scripts available in: /home/YOURNAME/Software/pymol/Pymol-script-repo
+
You now have all the scripts available in: /home/YOURNAME/Pymol-script-repo
  
 
== Adding Pymol-script-repo to PyMOL search path ==
 
== Adding Pymol-script-repo to PyMOL search path ==
 
You now have to add the "Pymol-script-repo" directory to the PyMOL search path.  
 
You now have to add the "Pymol-script-repo" directory to the PyMOL search path.  
  
The project also have automatically plugin installer: http://www.pymolwiki.org/index.php/plugindirectory <br>
+
=== Making a personal "pymolrc" file - for personal use ===
This is activated with: '''import plugins'''. <br>
+
# Open notepad/gedit and save under:
'''You have to remove old installations of plugins first, to get the automatic plugin installation to work.'''
+
## Win: '''C:\Users\YOURNAME\pymolrc.pym''' (Set: "Save as type" to "All files")
=== For Windows users ===
+
## Linux: '''~/.pymolrc'''
# Open notepad
+
<syntaxhighlight lang="python">
# Write (Remember double backslashes)
+
# Add paths to sys.path so PyMOL can find modules and scripts
import sys,os
+
import sys, os
sys.path.append('C:\\Users\\YOURNAME\\Documents\\pymol\\Pymol-script-repo')
+
pymol_script_repo = os.path.abspath(os.path.join(os.path.expanduser('~'), 'Pymol-script-repo'))
os.environ['PYMOL_GIT_MOD']='C:\\Users\\YOURNAME\\Documents\\pymol\\Pymol-script-repo\\modules'
+
pymol_script_repo_plugins = os.path.join(pymol_script_repo, "plugins")
import plugins
+
pymol_script_repo_modules = os.path.join(pymol_script_repo, "modules")
os.chdir('C:\\Users\\YOURNAME\\Documents\\pymol')                                # Your standard working dir
+
sys.path.append(pymol_script_repo)
Save under: '''C:\Users\YOURNAME\pymolrc.pym''' (Set: "Save as type" to "All files")
+
sys.path.append(pymol_script_repo_modules)
 +
os.environ['PYMOL_GIT_MOD'] = pymol_script_repo_modules
 +
</syntaxhighlight>
 +
 
 +
Then open PyMOL. Go to top menu: Plugin->Plugin Manager
 +
# Installed plugins: Unclick "apbs_tools" as "load on startup". (The Pymol-script-repo has a fine-tuned version, "apbsplugin")
 +
# Settings->Add new directory: Point to: /custom/path/Pymol-script-repo/plugins
 +
# Restart PyMOL
 +
 
 +
=== Making a general "run_on_startup.py" - for all users ===
 +
 
 +
If you have a shared PyMOL installation for several linux computers, you can make general wide changes for the startup of PyMOL.<br>
 +
First locate your PYMOL_PATH. Start PyMOL, and write:
  
=== For Linux users ===
 
gedit ~/.pymolrc
 
Write
 
 
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
import sys,os
+
import os
sys.path.append('/home/YOU/Software/pymol/Pymol-script-repo')
+
print(os.environ['PYMOL_PATH'])
os.environ['PYMOL_GIT_MOD']='/home/YOU/Software/pymol/Pymol-script-repo/modules'
 
import plugins
 
os.chdir('/home/YOU/Software/pymol/')                             # Your standard working dir
 
 
</syntaxhighlight>
 
</syntaxhighlight>
Save and exit
 
  
==== Alternative ====
+
In this folder, you place "run_on_startup.py" and the Pymol-script-repo directory.<br>
Or perhaps insert the following code instead (no need to insert USERNAME, so more generic) <!-- this works for me, but please edit if this is wrong -->
+
Write in "run_on_startup.py" :
 
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# eventually add ~/Software/pymol/Pymol-script-repo to sys.path
+
# Add paths to sys.path so PyMOL can find modules and scripts
 
import sys, os
 
import sys, os
sys.path.append(os.path.expanduser('~/Software/pymol/Pymol-script-repo'))
+
pymol_script_repo = os.path.abspath(os.path.join(os.environ['PYMOL_PATH'], 'Pymol-script-repo'))
os.environ['PYMOL_GIT_MOD']=os.path.expanduser('~/Software/pymol/Pymol-script-repo/modules')
+
pymol_script_repo_plugins = os.path.join(pymol_script_repo, "plugins")
+
pymol_script_repo_modules = os.path.join(pymol_script_repo, "modules")
# load the module
+
sys.path.append(pymol_script_repo)
import plugins
+
sys.path.append(pymol_script_repo_modules)
 +
os.environ['PYMOL_GIT_MOD'] = pymol_script_repo_modules
 +
 
 +
# Make setting changes to Plugin Manager
 +
import pymol.plugins
 +
pymol.plugins.autoload['apbs_tools'] = False
 +
pymol.plugins.preferences['verbose'] = False
 +
_plugin_search_path = pymol.plugins.get_startup_path()
 +
if pymol_script_repo_plugins not in _plugin_search_path: pymol.plugins.set_startup_path([pymol_script_repo_plugins] + _plugin_search_path)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Test the Scripts ==
 
== Test the Scripts ==
 
Now start PyMOL, and test in PyMOL.
 
Now start PyMOL, and test in PyMOL.
print sys.path
+
 
import colorbydisplacement
+
<syntaxhighlight lang="python">
help(colorbydisplacement)
+
print(sys.path)
 +
import colorbydisplacement
 +
help(colorbydisplacement)
 +
</syntaxhighlight>
  
 
== Get latest changes to scripts ==
 
== Get latest changes to scripts ==
 
If new scripts are available or changes have been made, then:
 
If new scripts are available or changes have been made, then:
 
=== For windows users ===
 
=== For windows users ===
# Navigate to '''C:\Users\YOURNAME\Documents\Pymol-script-repo'''
+
# Navigate to '''C:\Users\YOURNAME\Pymol-script-repo'''
 
# Right click in folder -> Select: Git Bash
 
# Right click in folder -> Select: Git Bash
 
# Write in terminal
 
# Write in terminal
Line 94: Line 109:
  
 
=== For Ubuntu/Mint users ===
 
=== For Ubuntu/Mint users ===
# Navigate to '''/home/YOURNAME/Software/pymol/Pymol-script-repo'''
+
# Navigate to '''/home/YOURNAME/Pymol-script-repo'''
 
# Write in terminal.
 
# Write in terminal.
 
  git pull origin master
 
  git pull origin master
Line 100: Line 115:
 
= Do you want to contribute with a script? =
 
= Do you want to contribute with a script? =
 
Information how to contribute scripts to the repository. It's easy! <br>
 
Information how to contribute scripts to the repository. It's easy! <br>
http://www.pymolwiki.org/index.php/git_authors
+
[git authors]

Latest revision as of 03:24, 10 December 2018

Manual download of scripts

If you don't have the option or don't feel like installing git on your system, then go to:

https://github.com/Pymol-Scripts/Pymol-script-repo

Click the "ZIP" button, near the top left corner. Now unpack the files to a directory. For example:

C:/Users/YOURNAME/Pymol-script-repo
/home/YOURNAME/Pymol-script-repo

Continue with #Adding Pymol-script-repo to PyMOL search path

Git install instructions

For Windows users

  1. Install Git for Windows.

Use following settings in options, (You can read more here).

  • Windows Explorer Integration -> Context Menu Entries -> Git Bash Here + Git GUI here
  • Run Git and included Unix tools from Windows Command prompts
  • Checkout Windows style, commit Unix-style endings
  1. Navigate to: C:\Users\YOURNAME
  2. Right click in folder -> Select: Git Gui -> Clone Existing Repository
  3. Source Location: git://github.com/Pymol-Scripts/Pymol-script-repo.git
  4. Target Directory: C:\\Users\\YOURNAME\\Pymol-script-repo
    A backslash "\" in a string is is used for escape sequences. To get a real backslash in a string, use double backslash "\\"

You now have all the scripts available in your directory.

For Linux users

  1. Install git
# Debian/Ubuntu/Mint
sudo apt-get install git
# Fedora
su -c 'yum install git'
# openSUSE
sudo zypper in git
  1. Navigate to desired folder:
cd /home/YOURNAME/
git clone git://github.com/Pymol-Scripts/Pymol-script-repo.git

You now have all the scripts available in: /home/YOURNAME/Pymol-script-repo

Adding Pymol-script-repo to PyMOL search path

You now have to add the "Pymol-script-repo" directory to the PyMOL search path.

Making a personal "pymolrc" file - for personal use

  1. Open notepad/gedit and save under:
    1. Win: C:\Users\YOURNAME\pymolrc.pym (Set: "Save as type" to "All files")
    2. Linux: ~/.pymolrc
# Add paths to sys.path so PyMOL can find modules and scripts
import sys, os
pymol_script_repo = os.path.abspath(os.path.join(os.path.expanduser('~'), 'Pymol-script-repo'))
pymol_script_repo_plugins = os.path.join(pymol_script_repo, "plugins")
pymol_script_repo_modules = os.path.join(pymol_script_repo, "modules")
sys.path.append(pymol_script_repo)
sys.path.append(pymol_script_repo_modules)
os.environ['PYMOL_GIT_MOD'] = pymol_script_repo_modules

Then open PyMOL. Go to top menu: Plugin->Plugin Manager

  1. Installed plugins: Unclick "apbs_tools" as "load on startup". (The Pymol-script-repo has a fine-tuned version, "apbsplugin")
  2. Settings->Add new directory: Point to: /custom/path/Pymol-script-repo/plugins
  3. Restart PyMOL

Making a general "run_on_startup.py" - for all users

If you have a shared PyMOL installation for several linux computers, you can make general wide changes for the startup of PyMOL.
First locate your PYMOL_PATH. Start PyMOL, and write:

import os
print(os.environ['PYMOL_PATH'])

In this folder, you place "run_on_startup.py" and the Pymol-script-repo directory.
Write in "run_on_startup.py" :

# Add paths to sys.path so PyMOL can find modules and scripts
import sys, os
pymol_script_repo = os.path.abspath(os.path.join(os.environ['PYMOL_PATH'], 'Pymol-script-repo'))
pymol_script_repo_plugins = os.path.join(pymol_script_repo, "plugins")
pymol_script_repo_modules = os.path.join(pymol_script_repo, "modules")
sys.path.append(pymol_script_repo)
sys.path.append(pymol_script_repo_modules)
os.environ['PYMOL_GIT_MOD'] = pymol_script_repo_modules

# Make setting changes to Plugin Manager
import pymol.plugins
pymol.plugins.autoload['apbs_tools'] = False
pymol.plugins.preferences['verbose'] = False
_plugin_search_path = pymol.plugins.get_startup_path()
if pymol_script_repo_plugins not in _plugin_search_path: pymol.plugins.set_startup_path([pymol_script_repo_plugins] + _plugin_search_path)

Test the Scripts

Now start PyMOL, and test in PyMOL.

print(sys.path)
import colorbydisplacement
help(colorbydisplacement)

Get latest changes to scripts

If new scripts are available or changes have been made, then:

For windows users

  1. Navigate to C:\Users\YOURNAME\Pymol-script-repo
  2. Right click in folder -> Select: Git Bash
  3. Write in terminal
git pull origin master

For Ubuntu/Mint users

  1. Navigate to /home/YOURNAME/Pymol-script-repo
  2. Write in terminal.
git pull origin master

Do you want to contribute with a script?

Information how to contribute scripts to the repository. It's easy!
[git authors]