Search code examples
pythonpython-3.xpymol

PyMOL to work on Python 3


I am writing a program which will need to use pymol, at the moment I have only added "import pymol" to my code. I am trying find a way to not get error "no module named pymol". So pymol (which now works with python 3) is only available to install via conda (https://pymol.org/2/support.html), although, when I follow the link, it seems that this is the same installation for python 2.7. I follow that link, install it via conda, but pymol is only showing in my python 2.7 folder. If pymol developers are saying that pymol should work on python 3, is there something I am doing wrong? I have previously had issues with vtk, where I installed it, but it was also not found because of the path where it was I think. I somehow fixed it, but no luck with pymol. Any help would be appreciated.

P.S. you can probably tell I am new to programming so please bear with me.


Solution

  • PyMOL seems to have limited support for Python 3.

    Does PyMOL support Python 3?

    We recommend Python 2.7 for production use! Python 3.6 packages for macOS and Linux are available in our Anaconda channel. Be advised that issues with PyMOL session files and third party plugins or scripts are possible.

    You probably need to familirise yourself environments, this is a ways to isolate different sets of packages. I suggest creating a separate environment with python 3 and pymol

    conda create --no-default-packages -n env1 python=3.6 pymol
    

    or without --no-default-packages flag if you wish a larger set of packages:

    conda create -n env1 python=3.6 pymol
    

    then change to that environment, if creation is successful:

    source activate myenv 
    

    import pymol should work here.

    If not - try installing pymol using channels, provided their channel.

    Hope it helps.