I have installed the Debian Stretch distribution of Spyder3 and the RDKit.  
Neither installation resulted in either warning or error messages.  
However, when I attempt running a cookbook Python3 script utilizing RDKit I 
get the following:

Python 3.5.3 (default, Jan 19 2017, 14:11:04)
Type "copyright", "credits" or "license" for more information.

IPython 6.1.0 -- An enhanced Interactive Python.

runfile('/home/comp/Apps/Python/untitled0.py', 
wdir='/home/comp/Apps/Python')
Traceback (most recent call last):

  File "<ipython-input-1-3842c59475d8>", line 1, in <module>
    runfile('/home/comp/Apps/Python/untitled0.py', 
wdir='/home/comp/Apps/Python')

  File 
"/usr/local/lib/python3.5/dist-packages/spyder/utils/site/sitecustomize.py", 
line 688, in runfile
    execfile(filename, namespace)

  File 
"/usr/local/lib/python3.5/dist-packages/spyder/utils/site/sitecustomize.py", 
line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/home/comp/Apps/Python/untitled0.py", line 11, in <module>
    from rdkit import Chem

ImportError: No module named 'rdkit'

The Pyhon script is attached.

I have no idea as to what the problem might be.  Any assistance will be 
appreciated.

Thanks in advance,

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 17 11:06:00 2017

@author: comp
"""

""" contribution from Andrew Dalke """
import sys
from rdkit import Chem
from rdkit.Chem import AllChem

# Download this from http://pypi.python.org/pypi/futures
from concurrent import futures

# Download this from http://pypi.python.org/pypi/progressbar
import progressbar

## On my machine, it takes 39 seconds with 1 worker and 10 seconds with 4.
## 29.055u 0.102s 0:28.68 101.6%   0+0k 0+3io 0pf+0w
#max_workers=1

## With 4 threads it takes 11 seconds.
## 34.933u 0.188s 0:10.89 322.4%   0+0k 125+1io 0pf+0w
max_workers=4

# (The "u"ser time includes time spend in the children processes.
#  The wall-clock time is 28.68 and 10.89 seconds, respectively.)

# This function is called in the subprocess.
# The parameters (molecule and number of conformers) are passed via a Python
def generateconformations(m, n):
    m = Chem.AddHs(m)
    ids=AllChem.EmbedMultipleConfs(m, numConfs=n)
    for id in ids:
        AllChem.UFFOptimizeMolecule(m, confId=id)
    # EmbedMultipleConfs returns a Boost-wrapped type which
    # cannot be pickled. Convert it to a Python list, which can.
    return m, list(ids)

smi_input_file, sdf_output_file = sys.argv[1:3]

n = int(sys.argv[3])

writer = Chem.SDWriter(sdf_output_file)

suppl = Chem.SmilesMolSupplier(smi_input_file, titleLine=False)

with futures.ProcessPoolExecutor(max_workers=max_workers) as executor:
    # Submit a set of asynchronous jobs
    jobs = []
    for mol in suppl:
        if mol:
            job = executor.submit(generateconformations, mol, n)
            jobs.append(job)

    widgets = ["Generating conformations; ", progressbar.Percentage(), " ",
               progressbar.ETA(), " ", progressbar.Bar()]
    pbar = progressbar.ProgressBar(widgets=widgets, maxval=len(jobs))
    for job in pbar(futures.as_completed(jobs)):
        mol,ids=job.result()
        for id in ids:
            writer.write(mol, confId=id)
writer.close()

Reply via email to