Import Pymol into Python Script
Entering edit mode
7 days ago
jdrohan • 0

Hey everyone!

I want to import pymol so that I can run the pymol "align" function on two sequences but I am struggling to import the pymol module into my python script. I tried adding the path to my python script so that it could locate the function but I am still unable to import the module. Whenever I run the program I get the following error message: ModuleNotFoundError: No module named 'pymol'.

Path to Pymol: "/home/user/Downloads/pymol"

Append Pymol Path: sys.path.insert(0, '/home/user/Downloads/pymol')

"whereis pymol" Returned two paths: /home/user/Downloads/pymol/pymol & /home/user/miniconda3/bin/pymol

Neither path above could be added to the path to import the module.

Thanks in advance for your help and I will try to respond as quickly as I see them!

Pymol python • 164 views
Entering edit mode

I have several examples you can mine for some guidance in my pymol-binder.
Go here and choose links under 'Available Notebooks' to look them over as static documents.

If the MyBinder service had not lost it's major supporter so that it is now struggling to meet the needs of users, making for a rock experience at time, I'd suggest clicking on the 'launch binder' badge featured near the top of my my pymol-binder and work through active Jupyter sessions with pymol already installed there where you can step through running the code and see results generated directly. You are welcome to click on it; it may eventually start if you are patient.

Oh wait, I sort of missed that your questions isn't so much as how to import it, but that you haven't installed it properly in the environment in which you want to work and so you are seeing ModuleNotFoundError: No module named 'pymol'. It's hard to advise you because beyond where it is in your system, you haven't shared how you are actually working with Python and/or miniconda. I would suggest you look into creating environments in your conda, activating those environments (see here to get a sense maybe), so that you are inside that environment, and then install pymol via conda in that environment with the following command:

conda install -c schrodinger pymol

That is actually how my environment is doing it f you use the active Jupyter session I suggested above. Every dependency listed under 'dependencies' in this environment.yml file gets run with conda install before the session opens.


Login before adding your answer.

Traffic: 2296 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6