{"id":24573,"library":"selfies","title":"SELFIES","description":"SELFIES (SELF-referencIng Embedded Strings) is a general-purpose, sequence-based, robust representation of semantically constrained graphs, primarily used for molecular structures in cheminformatics and ML. Current version 2.2.0, releases every few months.","status":"active","version":"2.2.0","language":"python","source_language":"en","source_url":"https://github.com/aspuru-guzik-group/selfies","tags":["cheminformatics","molecular representation","SMILES","generative chemistry","SELFIES"],"install":[{"cmd":"pip install selfies","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for SMILES/SELFIES conversion and validity checks","package":"rdkit","optional":true}],"imports":[{"note":"No common wrong import; just import the function.","symbol":"encoder","correct":"from selfies import encoder"},{"note":"No common wrong import; just import the function.","symbol":"decoder","correct":"from selfies import decoder"}],"quickstart":{"code":"from selfies import encoder, decoder\n\nsmiles = \"CCO\"  # ethanol\nselfies_str = encoder(smiles)\nprint(selfies_str)  # [C][C][O]\n\nsmiles_back = decoder(selfies_str)\nprint(smiles_back)  # CCO","lang":"python","description":"Basic encode/decode a SMILES string."},"warnings":[{"fix":"Use encoder(smiles, strict=False) to mimic old behavior, or ensure input SMILES are valid.","message":"In v2.0.0, the encoder now defaults to strict=True, raising errors for SMILES violating bond constraints. Previously, invalid SMILES were silently allowed.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade to Python >=3.7.","message":"Support for Python 3.5-3.6 dropped in v2.1.0.","severity":"deprecated","affected_versions":">=2.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use from selfies import encoder, decoder directly.","cause":"Wrong import style: trying to access selfies.selfies.","error":"AttributeError: module 'selfies' has no attribute 'selfies'"},{"fix":"Either fix the SMILES or pass strict=False to encoder.","cause":"SMILES violates bond constraints (e.g., hypervalent atoms) and strict=True is default.","error":"RuntimeError: The input SMILES could not be parsed due to semantic constraints."},{"fix":"Upgrade selfies: pip install --upgrade selfies","cause":"Using version <2.0.0 where strict parameter didn't exist.","error":"TypeError: encoder() got an unexpected keyword argument 'strict'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}