keiserlab / e3fp

3D molecular fingerprints
GNU Lesser General Public License v3.0
122 stars 33 forks source link

TypeError: a bytes-like object is required, not 'str' #29

Closed tomas-pluskal closed 5 years ago

tomas-pluskal commented 6 years ago

Hi, I installed rdkit and e3fp via conda. Now I am trying to run the generate.py script on a simple file with a single SMILES structure

smi.txt

C1=C(C(=NC(=N1)O)O)F 5-Fluorouracil

However, I am getting the following error:

python e3fp/conformer/generate.py -v -s smi.txt

2018-09-01 09:36:18,492|DEBUG|Logging to stdout
2018-09-01 09:36:18,493|DEBUG|Parallel modes ['mpi', 'processes', 'threads', 'serial'] are available.
2018-09-01 09:36:18,493|DEBUG|Checking if mode 'mpi' is valid.
2018-09-01 09:36:18,493|WARNING|Only 1 processes available. 'mpi' mode not available.
2018-09-01 09:36:18,493|DEBUG|Checking if mode 'processes' is valid.
2018-09-01 09:36:18,493|INFO|num_proc is not specified. 'processes' mode will use all 32 processes
2018-09-01 09:36:18,493|INFO|Parallelizer initialized with mode 'processes' and 32 processors.
2018-09-01 09:36:18,493|INFO|Input type: Detected SMILES file(s)
2018-09-01 09:36:18,493|INFO|Input file number: 1
2018-09-01 09:36:18,493|INFO|Parallel Type: processes
2018-09-01 09:36:18,494|INFO|Out Directory: conformers
2018-09-01 09:36:18,494|INFO|Overwrite Existing Files: False
2018-09-01 09:36:18,494|INFO|Target Conformer Number: auto
2018-09-01 09:36:18,494|INFO|First Conformers Number: all
2018-09-01 09:36:18,495|INFO|Pool Multiplier: 1
2018-09-01 09:36:18,495|INFO|RMSD Cutoff: 0.5
2018-09-01 09:36:18,495|INFO|Maximum Energy Difference: None
2018-09-01 09:36:18,495|INFO|Forcefield: UFF
2018-09-01 09:36:18,495|INFO|Starting.
Traceback (most recent call last):
  File "e3fp/conformer/generate.py", line 413, in <module>
    run(**kwargs)
  File "e3fp/conformer/generate.py", line 338, in run
    for result, data in results_iterator:
  File "/home/pluskal/.local/lib/python3.6/site-packages/python_utilities/parallel.py", line 304, in <genexpr>
    result_iterator = (x for x in self.concurrent_run(
  File "/home/pluskal/.local/lib/python3.6/site-packages/python_utilities/parallel.py", line 353, in concurrent_run
    for data in data_iterator:
  File "e3fp/conformer/generate.py", line 279, in <genexpr>
    data_iterator = make_data_iterator((x for x in mol_iter
  File "e3fp/conformer/generate.py", line 265, in <genexpr>
    mol_iter = (mol_from_smiles(_smiles, _name,
  File "/home/pluskal/.local/lib/python3.6/site-packages/e3fp/conformer/util.py", line 165, in smiles_generator
    values = line.rstrip('\r\n').split()
TypeError: a bytes-like object is required, not 'str'

What is wrong?

sethaxen commented 5 years ago

I think this was due to how the SMILES file was being coerced to open in binary mode. If the commit I just pushed doesn't fix this, reopen the issue, and I'll fix it.