Code Monkey home page Code Monkey logo

rdkit-pypi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdkit-pypi's Issues

installation error on python 3.8.8 rdkit

ERROR: Could not find a version that satisfies the requirement rdkit-pypi
ERROR: No matching distribution found for rdkit-pypi

Have been getting this type of error while trying to install rdkit with pip install rdkit-pypi on windows with python3.8.8 installed

Update repo about

About
⚛️ RDKit Python Wheels on PyPi. 💻 pip install rdkit-pypi

cannot use rdkit.Chem.MolStandardize.rdMolStandardize.Normalize

rdkit.Chem.MolStandardize.rdMolStandardize.Normalize needs RDKit/Data/MolStandardize/normalizations.txt, but it is not contained in wheel.

>>> from rdkit.Chem.MolStandardize.rdMolStandardize import Normalize
>>> from rdkit import Chem
>>> Normalize(Chem.MolFromSmiles('c1ccccc1'))
[01:23:44] Initializing Normalizer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: File error: Bad input file /path/to/build/temp.macosx-10.9-x86_64-3.9/rdkit_install/share/RDKit/Data/MolStandardize/normalizations.txt

Thanks,

Missing/invalid X11 libraries dependencies for libcairo on GNU/Linux

The packaged 3rd party library libcairo has dependencies which are not included (or refer to an unmodified name).
In particular libXau and libXdmcp are not found unless they are installed by the OS. In most installations, this is not a problem, but a vanilla container image might not include any X11 libraries.

RDKit-PyPi Numpy >= 1.19 Dependency

Hello,

I noticed rdkit-pypi requires numpy >= 1.19. This is the case even with older versions of the package. However, since I have a project that uses tensorflow 2.3 and that version of tensorflow is compatible with numpy < 1.19, I ignored the dependency and it worked fine. So, my question is how to lower the dependency to numpy to version 1.18 or is there at least an older version of rdkit-pypi that supports numpy < 1.19? In general, is numpy version 1.19 really required?
The reason behind this request is that I'm building a container that installs every package in 'requirements.txt' automatically and such dependency errors stops the whole process. So, it's not just a one time installation for which the error can be ignored.
Thanks in advance for your help!

no YAeHMOP support on Mac ARM for rdkit 2023.05

Version 2023.5 seems to be compiled without YAeHMOP support, 2022.05 has it on same machine.
Error message comes from

from rdkit import Chem
from rdkit.Chem import rdDetermineBonds
mol = Chem.MolFromXYZBlock("2\n\nH 0.0 0.0 0.0\nH 0.74 0.0 0.0\n")
rdDetermineBonds.DetermineConnectivity(mol,useHueckel=True)

Rename rdkit-pypi to rdkit; avoid conflicts with conda

Hi there, thanks for building such a great package!

It's currently possible to install rdkit from both conda and pip simultaneously. I understand that you may not have access to rdkit in PyPI (so simply changing name in setup.py may be off the table), but I'm wondering if there's any way to rename the package so it replaces instead of sits alongside the conda version?

Note that I don't think there are import conflicts here; the package still gets installed to the same place. But the package managers could show different things and cause uncertainty about what is actually imported. For example, I installed rdkit-pypi (2021.9.5.1) and then conda rdkit (2021.03.5).

pip list shows:

rdkit-pypi                        2021.9.5.1

while conda list has two entries:

rdkit                     2021.03.5        py39h88273a1_0    conda-forge
rdkit-pypi                2021.9.5.1               pypi_0    pypi

and rdkit.__version__ is '2021.03.5'

Version mismatch due to setuptools cutting trailing zeros?

Hi,

This is very minor, but I noticed it yesterday when it was relevant for a project I was working on.

I noticed that the metadata version from pip does not have the trailing zero on the minor. E.g., pip will report 2022.9.5, while rdkit.__version__ reports 2022.09.5.

From what I see on your setup.py, the version metadata does not seem to have any bug, so my current idea is that setuptools is cutting the trailing zero. Any other idea?

Ensure that the RDKit's data directory and supporting files are installed

I keep getting pinged by people who are using rdkit-pypi reporting that RDKit scripts or examples don't work. The common thread through these problems is that the PyPi packages of the RDKit don't include the RDKit's Data directory or configure the installation to know where to find that. This breaks some RDKit functionality.

Here's one example of the consequences of that.
Using rdkit-pypi

In [2]: from rdkit.Chem import Descriptors

In [3]: len(Descriptors._descList)
Out[3]: 115

Using the conda-forge package:

In [2]: from rdkit.Chem import Descriptors

In [3]: len(Descriptors._descList)
Out[3]: 208

This particular failure is because the file containing fragment definitions (which lives in the data directory) can't be found.

Here's another example: the SaltRemover doesn't work because it can't find the salt list:

In [1]: from rdkit.Chem.SaltRemover import SaltRemover

In [2]: rm = SaltRemover()
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-2-db353f6533c0> in <module>
----> 1 rm = SaltRemover()

~/miniconda3/envs/py38_pypi/lib/python3.8/site-packages/rdkit/Chem/SaltRemover.py in __init__(self, defnFilename, defnData, defnFormat)
     90         self.salts = None
     91         self.defnFormat = defnFormat
---> 92         self._initPatterns()
     93 
     94     def _initPatterns(self):

~/miniconda3/envs/py38_pypi/lib/python3.8/site-packages/rdkit/Chem/SaltRemover.py in _initPatterns(self)
    135         else:
    136             if self.defnFormat == InputFormat.SMARTS:
--> 137                 self.salts = [mol for mol in _getSmartsSaltsFromFile(self.defnFilename)]
    138             elif self.defnFormat == InputFormat.MOL:
    139                 self.salts = [mol for mol in SDMolSupplier(self.defnFilename)]

~/miniconda3/envs/py38_pypi/lib/python3.8/site-packages/rdkit/Chem/SaltRemover.py in _getSmartsSaltsFromFile(filename)
     78     Extracts SMARTS salts from given file object.
     79     """
---> 80     return _getSmartsSaltsFromStream(open(filename, 'r'))
     81 
     82 

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-vnsiyh88/build/temp.linux-x86_64-3.8/rdkit_install/share/RDKit/Data/Salts.txt'

The conda packages create a directory in the environment's share directory which holds this stuff:

In [2]: RDConfig.RDDataDir
Out[2]: '/home/glandrum/miniconda3/envs/py38_rdkit/share/RDKit/Data'

But there's no such thing being done for rdkit-pypi.

We had a thread about this at some point, but it looks like nothing has been done to fix the problem. Please do something about this... I think it's great that you are making these packages available, but the packages being provided are broken and are increasing the support burden on me (and, I assume, other RDKit devs).

Use rdkit Chemical Features

Cannot use the Chemical Features of rdkit

>>> from rdkit import Chem
>>> from rdkit.Chem import ChemicalFeatures
>>> from rdkit import RDConfig
>>> import os
>>> fdefName = os.path.join(RDConfig.RDDataDir,'BaseFeatures.fdef')
>>> factory = ChemicalFeatures.BuildFeatureFactory(fdefName)

Gives the error OSError: File: /tmp/pip-req-build-w2hdrjg9/build/temp.linux-x86_64-3.7/rdkit_install/share/RDKit/Data/BaseFeatures.fdef could not be opened

No Mac M1 wheels for `<2021.9.4`

I'm trying to use rdkit-pypi version 2021.3.5.1, but when I try to install that in a python 3.9 Docker image I get the following error:

 ❯ docker run -it python:3.9-slim bash                                                                                                                             1 ↵ 
Unable to find image 'python:3.9-slim' locally
3.9-slim: Pulling from library/python
Digest: sha256:ba3b77ddbc953cdb8d998b2052088d4af4b8805805e5b01975a05af4e19855ea
Status: Downloaded newer image for python:3.9-slim
root@252ed403df93:/# pip install rdkit-pypi==2021.3.5.1
ERROR: Could not find a version that satisfies the requirement rdkit-pypi==2021.3.5.1 (from versions: 2021.9.4, 2021.9.5.1, 2022.3.1b1, 2022.3.1, 2022.3.1.1, 2022.3.2)
ERROR: No matching distribution found for rdkit-pypi==2021.3.5.1

Any suggestions on how to get around this? I need this specific version because the RDKit cartridge in Postgres 12 is incompatible with version 2021.9.4

MacOS support

Hello!

I see that you intend these wheels to be used on linux, but I'd still like to know, could you give advise on how to make this work on a macOS?

ImportError: No module named rdkit

After I seemed to have successfully installed rdkit by running

python -m pip install rdkit-pypi --user

and

python -c "from rdkit import Chem; print(Chem.MolToMolBlock(Chem.MolFromSmiles('C1CCC1')))"

with no issues,

I am getting the following error:
"ImportError: No module named rdkit"

when I try to run a pytest on a tool I am trying to use called e3fp.

Could you provide any advice?

Thank you for your help!

PyPI Release for 3.11 support

Hiya, thanks for maintaining this!

Just curious if there's an ETA for releasing the 3.11 compatible package on PyPI :)

Segmentation fault due to corrupt Cairo

I installed RDKit via pip like this.

pip install rdkit-pypi

and whenever I import a rdkit module e.g.

from rdkit.Chem.Draw import IPythonConsole

I get this in VSCode.

Error

The kernel '.pyvenv (Python 3.9.7)' died. View Jupyter [log](command:jupyter.viewOutput) for further details.

Log

Visual Studio Code (1.65.0, undefined, desktop)
Jupyter Extension Version: 2022.2.1030672458.
Python Extension Version: 2022.0.1814523869.
User belongs to experiment group 'jupyterTestcf'
User belongs to experiment group 'jupyterEnhancedDataViewer'
Info 20:50:29: ZMQ install verified.
Info 20:50:30: Preferred kernel connection found in cache .jvsc74a57bd0224dc0f14b595f635f86ac70d4b9b15df6150e6ef32625bab47f4fa7a4f3e7b1./home/shahzad/.pyvenv/python./home/shahzad/.pyvenv/python.-m#ipykernel_launcher
Info 20:50:30: PreferredConnection: .jvsc74a57bd0224dc0f14b595f635f86ac70d4b9b15df6150e6ef32625bab47f4fa7a4f3e7b1./home/shahzad/.pyvenv/python./home/shahzad/.pyvenv/python.-m#ipykernel_launcher found for NotebookDocument: ~/Projects/Personal/Python/sentdex_pytorch.ipynb
Info 20:50:30: Early registration of controller for Kernel connection .jvsc74a57bd0224dc0f14b595f635f86ac70d4b9b15df6150e6ef32625bab47f4fa7a4f3e7b1./home/shahzad/.pyvenv/python./home/shahzad/.pyvenv/python.-m#ipykernel_launcher
Info 20:50:30: TargetController found ID: .jvsc74a57bd0224dc0f14b595f635f86ac70d4b9b15df6150e6ef32625bab47f4fa7a4f3e7b1./home/shahzad/.pyvenv/python./home/shahzad/.pyvenv/python.-m#ipykernel_launcher for document ~/Projects/Personal/Python/sentdex_pytorch.ipynb
Info 20:50:30: Setting controller affinity for ~/Projects/Personal/Python/sentdex_pytorch.ipynb .jvsc74a57bd0224dc0f14b595f635f86ac70d4b9b15df6150e6ef32625bab47f4fa7a4f3e7b1./home/shahzad/.pyvenv/python./home/shahzad/.pyvenv/python.-m#ipykernel_launcher
Info 20:50:30: Experiment status for python is {"enabled":true,"optInto":[],"optOutFrom":[]}
Info 20:50:30: Interrupt requested & no kernel.
Info 20:50:30: Setting setActiveController for ~/Projects/Personal/Python/sentdex_pytorch.ipynb
Info 20:50:30: KernelProvider switched kernel to id = .jvsc74a57bd0224dc0f14b595f635f86ac70d4b9b15df6150e6ef32625bab47f4fa7a4f3e7b1./home/shahzad/.pyvenv/python./home/shahzad/.pyvenv/python.-m#ipykernel_launcher
Info 20:50:30: Starting Notebook in kernel.ts id = .jvsc74a57bd0224dc0f14b595f635f86ac70d4b9b15df6150e6ef32625bab47f4fa7a4f3e7b1./home/shahzad/.pyvenv/python./home/shahzad/.pyvenv/python.-m#ipykernel_launcher
Info 20:50:30: Creating raw notebook for ~/Projects/Personal/Python/sentdex_pytorch.ipynb
Info 20:50:30: Getting preferred kernel for ~/Projects/Personal/Python/sentdex_pytorch.ipynb
Info 20:50:30: Computing working directory ~/Projects/Personal/Python/sentdex_pytorch.ipynb
Info 20:50:30: Starting raw kernel .pyvenv (Python 3.9.7) for interpreter ~/.pyvenv/bin/python
Info 20:50:30: installMissingDependencies ~/.pyvenv/bin/python
Info 20:50:30: IPyKernel found previously in this environment ~/.pyvenv/bin/python
Info 20:50:30: Kernel launching with ports 9000,9001,9002,9003,9004. Start port is 9000
Info 20:50:30: Process Execution: > ~/.pyvenv/bin/python -m pip list
> ~/.pyvenv/bin/python -m pip list
Info 20:50:30: Process Execution: > ~/.pyvenv/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
> ~/.pyvenv/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
Info 20:50:30: Adding env Variable PYTHONNOUSERSITE to ~/.pyvenv/bin/python
Info 20:50:30: Process Execution: > ~/.pyvenv/bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"5de861de-2c02-44fb-b111-520515629a30" --shell=9002 --transport="tcp" --iopub=9004 --f=/tmp/tmp-6345dU61mWzzHZx8.json
> ~/.pyvenv/bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"5de861de-2c02-44fb-b111-520515629a30" --shell=9002 --transport="tcp" --iopub=9004 --f=/tmp/tmp-6345dU61mWzzHZx8.json
Info 20:50:30: Process Execution: cwd: ~/Projects/Personal/Python
cwd: ~/Projects/Personal/Python
Info 20:50:30: Creating controller for jupyter-notebook with interpreter ~/.pyvenv/bin/python3.9
Info 20:50:30: ipykernel version 6.9.1 for ~/.pyvenv/bin/python
Info 20:50:30: ipykernel location ~/.pyvenv/lib/python3.9/site-packages/ipykernel/__init__.py for ~/.pyvenv/bin/python
Info 20:50:30: Process Execution: > ~/.pyvenv/bin/python3.9 -m pip list
> ~/.pyvenv/bin/python3.9 -m pip list
Info 20:50:31: Registering dummy command feature
Warn 20:50:31: StdErr from Kernel Process /home/shahzad/.pyvenv/lib/python3.9/site-packages/traitlets/traitlets.py:2202: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
  warn(
/home/shahzad/.pyvenv/lib/python3.9/site-packages/traitlets/traitlets.py:2157: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '5de861de-2c02-44fb-b111-520515629a30' instead of 'b"5de861de-2c02-44fb-b111-520515629a30"'.
  warn(

Info 20:50:31: Kernel Output: NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049


To connect another client to this kernel, use:
    --existing /tmp/tmp-6345dU61mWzzHZx8.json

Info 20:50:31: Raw session started and connected
Started kernel .pyvenv (Python 3.9.7)
Info 20:50:31: Finished connecting 0cb9bd04-94f4-41b9-9b36-ad666d453aa5
Info 20:50:31: Executing silently Code (idle) = import sys\nprint(sys.executable)
Info 20:50:31: Registering dummy command feature
Info 20:50:31: Executing silently Code (completed) = import sys\nprint(sys.executable)
Info 20:50:31: UpdateWorkingDirectoryAndPath in Kernel
Info 20:50:31: Executing silently Code (idle) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/home/shahzad/Proj
Info 20:50:31: Executing silently Code (completed) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/home/shahzad/Proj
Info 20:50:31: Waiting for idle on (kernel): 994505ac-0057-4705-924a-62e9b5836ad0 -> idle
Info 20:50:31: Finished waiting for idle on (kernel): 994505ac-0057-4705-924a-62e9b5836ad0 -> idle
Info 20:50:33: Execute Cells request 1
Info 20:50:33: Execute Cell 1 ~/Projects/Personal/Python/sentdex_pytorch.ipynb
Info 20:50:34: Cell 1 executed with state Success
Info 20:53:40: Execute Cells request 8
Info 20:53:40: Execute Cell 8 ~/Projects/Personal/Python/sentdex_pytorch.ipynb
Info 20:53:41: Cancel all remaining cells true || Error
Info 20:53:41: Cancel pending cells
Info 20:53:41: Cell 8 executed with state Error
Info 20:53:51: Creating controller for jupyter-notebook with interpreter ~/.pyvenv/bin/python3.9
Info 20:53:51: Find preferred kernel for ~/Projects/Personal/Python/esol.ipynb with metadata {"orig_nbformat":4,"language_info":{"name":"python"}} & preferred interpreter ~/.pyvenv/bin/python3.9
Info 20:53:51: findKernel found .pyvenv (Python 3.9.7)
Info 20:53:51: PreferredConnection: .jvsc74a57bd01d8f747c75f7a74e15a606d9612deec7108dabb112d8816f978043aee9b36c17./home/shahzad/.pyvenv/bin/python3.9./home/shahzad/.pyvenv/bin/python3.9.-m#ipykernel_launcher found for NotebookDocument: ~/Projects/Personal/Python/esol.ipynb
Info 20:53:51: TargetController found ID: .jvsc74a57bd01d8f747c75f7a74e15a606d9612deec7108dabb112d8816f978043aee9b36c17./home/shahzad/.pyvenv/bin/python3.9./home/shahzad/.pyvenv/bin/python3.9.-m#ipykernel_launcher for document ~/Projects/Personal/Python/esol.ipynb
Info 20:53:51: Setting controller affinity for ~/Projects/Personal/Python/esol.ipynb .jvsc74a57bd01d8f747c75f7a74e15a606d9612deec7108dabb112d8816f978043aee9b36c17./home/shahzad/.pyvenv/bin/python3.9./home/shahzad/.pyvenv/bin/python3.9.-m#ipykernel_launcher
Error 20:53:57: Live Notebook not available for ~/Projects/Personal/Python/esol.ipynb
Error 20:53:58: Live Notebook not available for ~/Projects/Personal/Python/esol.ipynb
Info 20:54:07: Setting setActiveController for ~/Projects/Personal/Python/esol.ipynb
Info 20:54:07: Interrupt requested & no kernel.
Info 20:54:07: Execute Cells request 0
Info 20:54:07: Execute Cell 0 ~/Projects/Personal/Python/esol.ipynb
Info 20:54:07: Starting Notebook in kernel.ts id = .jvsc74a57bd01d8f747c75f7a74e15a606d9612deec7108dabb112d8816f978043aee9b36c17./home/shahzad/.pyvenv/bin/python3.9./home/shahzad/.pyvenv/bin/python3.9.-m#ipykernel_launcher
Info 20:54:07: Creating raw notebook for ~/Projects/Personal/Python/esol.ipynb
Info 20:54:07: Getting preferred kernel for ~/Projects/Personal/Python/esol.ipynb
Info 20:54:07: Computing working directory ~/Projects/Personal/Python/esol.ipynb
Info 20:54:07: Starting raw kernel .pyvenv (Python 3.9.7) for interpreter ~/.pyvenv/bin/python3.9
Info 20:54:07: installMissingDependencies ~/.pyvenv/bin/python3.9
Info 20:54:07: KernelProvider switched kernel to id = .jvsc74a57bd01d8f747c75f7a74e15a606d9612deec7108dabb112d8816f978043aee9b36c17./home/shahzad/.pyvenv/bin/python3.9./home/shahzad/.pyvenv/bin/python3.9.-m#ipykernel_launcher
Info 20:54:07: Process Execution: > ~/.pyvenv/bin/python3.9 -c "import ipykernel"
> ~/.pyvenv/bin/python3.9 -c "import ipykernel"
Info 20:54:07: Kernel launching with ports 9005,9006,9007,9008,9009. Start port is 9000
Info 20:54:07: Process Execution: > ~/.pyvenv/bin/python3.9 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
> ~/.pyvenv/bin/python3.9 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
Info 20:54:07: Adding env Variable PYTHONNOUSERSITE to ~/.pyvenv/bin/python3.9
Info 20:54:07: Process Execution: > ~/.pyvenv/bin/python3.9 -m ipykernel_launcher --ip=127.0.0.1 --stdin=9008 --control=9006 --hb=9005 --Session.signature_scheme="hmac-sha256" --Session.key=b"a2b5ca94-4372-468e-8eb6-7ec8b3c7c7c5" --shell=9007 --transport="tcp" --iopub=9009 --f=/tmp/tmp-6345I6jezU7f6ygz.json
> ~/.pyvenv/bin/python3.9 -m ipykernel_launcher --ip=127.0.0.1 --stdin=9008 --control=9006 --hb=9005 --Session.signature_scheme="hmac-sha256" --Session.key=b"a2b5ca94-4372-468e-8eb6-7ec8b3c7c7c5" --shell=9007 --transport="tcp" --iopub=9009 --f=/tmp/tmp-6345I6jezU7f6ygz.json
Info 20:54:07: Process Execution: cwd: ~/Projects/Personal/Python
cwd: ~/Projects/Personal/Python
Info 20:54:07: ipykernel version 6.9.1 for ~/.pyvenv/bin/python3.9
Info 20:54:07: ipykernel location ~/.pyvenv/lib/python3.9/site-packages/ipykernel/__init__.py for ~/.pyvenv/bin/python3.9
Warn 20:54:08: StdErr from Kernel Process /home/shahzad/.pyvenv/lib/python3.9/site-packages/traitlets/traitlets.py:2202: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
  warn(

Warn 20:54:08: StdErr from Kernel Process /home/shahzad/.pyvenv/lib/python3.9/site-packages/traitlets/traitlets.py:2157: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use 'a2b5ca94-4372-468e-8eb6-7ec8b3c7c7c5' instead of 'b"a2b5ca94-4372-468e-8eb6-7ec8b3c7c7c5"'.
  warn(

Info 20:54:08: Kernel Output: NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049


To connect another client to this kernel, use:
    --existing /tmp/tmp-6345I6jezU7f6ygz.json

Info 20:54:08: Raw session started and connected
Started kernel .pyvenv (Python 3.9.7)
Info 20:54:08: Finished connecting 0cb9bd04-94f4-41b9-9b36-ad666d453aa5
Info 20:54:08: Executing silently Code (idle) = import sys\nprint(sys.executable)
Info 20:54:08: Executing silently Code (completed) = import sys\nprint(sys.executable)
Info 20:54:08: UpdateWorkingDirectoryAndPath in Kernel
Info 20:54:08: Executing silently Code (idle) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/home/shahzad/Proj
Info 20:54:08: Executing silently Code (completed) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/home/shahzad/Proj
Info 20:54:08: Waiting for idle on (kernel): a60186ad-c85c-40d0-9c3b-d32f43526f3e -> idle
Info 20:54:08: Finished waiting for idle on (kernel): a60186ad-c85c-40d0-9c3b-d32f43526f3e -> idle
Error 20:54:08: Disposing session as kernel process died ExitCode: undefined, Reason: /home/shahzad/.pyvenv/lib/python3.9/site-packages/traitlets/traitlets.py:2202: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
  warn(
/home/shahzad/.pyvenv/lib/python3.9/site-packages/traitlets/traitlets.py:2157: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use 'a2b5ca94-4372-468e-8eb6-7ec8b3c7c7c5' instead of 'b"a2b5ca94-4372-468e-8eb6-7ec8b3c7c7c5"'.
  warn(

Info 20:54:08: Dispose Kernel process
Error 20:54:08: Raw kernel process exited code: undefined
Info 20:54:08: Cancel all remaining cells due to dead kernel
Info 20:54:08: Cancel pending cells
Info 20:54:08: Cell 0 executed with state Success


The same is happening in Google Colab. It seems it's an issue with rdkit.

cibuildwheel fails on dev laptop due to use of CIBW_BUILD in setup.py

Hello @kuelumbus ! Thanks for your work on this project.

I'm evaluating rdkit-pypi for use at my company and I think I've noticed an issue. I tried running the cibuildwheel --platform linux --output-dir wheelhouse as described in the docs, which should build the linux wheels on my local machine using Docker. Unfortunately, the build failed with an error in setup.py. It seems that in checking for the macOS arm64 platform, we run the following line

if "macosx_arm64" in os.environ["CIBW_BUILD"]:

which breaks in local mode since CIBW_BUILD never gets defined. I am now testing the build with the following patches:

@@ -91,8 +91,8 @@ class BuildRDKit(build_ext_orig):
             cmd += [f"--build=b2"]
 
         # for arm 64 on MacOS
-        if "macosx_arm64" in os.environ["CIBW_BUILD"]:
-            cmd += ["-s", "arch=armv8", "-s", "arch_build=armv8"]
+        #if "macosx_arm64" in os.environ["CIBW_BUILD"]:
+        #    cmd += ["-s", "arch=armv8", "-s", "arch_build=armv8"]
 
         check_call(cmd)

@@ -187,13 +187,13 @@ class BuildRDKit(build_ext_orig):
             ]
 
         vars = {}
-        if "macosx_arm64" in os.environ["CIBW_BUILD"]:
-            options += [
-                "-DCMAKE_OSX_ARCHITECTURES=arm64",
-                "-DRDK_OPTIMIZE_POPCNT=OFF",
-            ]
-            # also export it to compile yaehmop for arm64 too
-            vars["CMAKE_OSX_ARCHITECTURES"] = "arm64"
+        #if "macosx_arm64" in os.environ["CIBW_BUILD"]:
+        #    options += [
+        #        "-DCMAKE_OSX_ARCHITECTURES=arm64",
+        #        "-DRDK_OPTIMIZE_POPCNT=OFF",
+        #    ]
+        #    # also export it to compile yaehmop for arm64 too
+        #    vars["CMAKE_OSX_ARCHITECTURES"] = "arm64"
 
         cmds = [
             f"cmake -S . -B build {' '.join(options)}",

Obviously this will break the arm64 mac builds, but it should restore local build functionality. Maybe there's an alternative way to detect the macOS arm64 platform?

rdEHTTools missing

are rdEHTTools missing?

ImportError                               Traceback (most recent call last)
<ipython-input-1-d549850dd09d> in <module>
      7 
      8 # this is the package including the connection to YAeHMOP
----> 9 from rdkit.Chem import rdEHTTools
     10 from rdkit.Chem import AllChem
     11 import numpy as np

ImportError: cannot import name 'rdEHTTools' from 'rdkit.Chem' (.../lib/python3.9/site-packages/rdkit/Chem/__init__.py)

`Contrib` folder missing

Hello, awesome work making our lives easy with this library! I am struggled trying to use RDConfig.RDContribDir in my project.

I create this function to import sascorer (it is no so nice, I know :-) )

def import_sascorer():
    # In order to import sascorer from RDConfig.RDContribDir
    from rdkit.Chem import RDConfig
    import os, importlib.util as importlib_util
    spec=importlib_util.spec_from_file_location('sascorer', os.path.join(RDConfig.RDContribDir, 'SA_Score', 'sascorer.py'))
    sascorer = importlib_util.module_from_spec(spec)
    spec.loader.exec_module(sascorer)
    return sascorer

When I use conda install rdkit, everything works fine. But when I use python -m pip install rdkit (as recomended in PyPi). I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 7, in import_sascorer
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1016, in get_code
  File "<frozen importlib._bootstrap_external>", line 1073, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/home/ale/anaconda3/envs/test/lib/python3.10/site-packages/rdkit/Contrib/SA_Score/sascorer.py'

And indeed the file doesn’t exist. So, how could I install the contribute directory via pip? A lot of thanks in advance!

libXrender.so.1 not available

Hi. Thanks for putting a pip install of rdkit together.

When I went to run my code i observed

Traceback (most recent call last): File "./app.py", line 12, in <module> from rdkit.Chem import Draw File "/var/lang/lib/python3.8/site-packages/rdkit/Chem/Draw/__init__.py", line 21, in <module> from rdkit.Chem.Draw import rdMolDraw2D ImportError: libXrender.so.1: cannot open shared object file: No such file or directory

normally this could be treated (i think) with
sudo apt-get install libxrender1

based on
albumentations-team/albumentations#415

however, if one wanted to use a docker build (as I do) from some public image such as
FROM public.ecr.aws/sam/build-python3.8:1.71.0-20230124190835

I dont think this is possible.

This thread
https://sourceforge.net/p/rdkit/mailman/rdkit-discuss/thread/CAEmzeFe9Kn6FNeOXmwZqxcdbm7LV1Vz-J9rTw_CJJJRAHgkKfQ@mail.gmail.com/
recommends using a specific conda forge channel.

My plan is to rebuild the docker image using the miniconda base image. I suspect that this might not play well with AWS Lambda/Serverless approaches to app deployment.

I will report back with my workaround. Please let me know if I have missed something.

Thanks.

ValueError: BitVects must be same length (rdkit)

I am calculating the structure similarity profile between 2 moles using rdkit. When I am running the program in google colab (rdkit=2020.09.2 python=3.7) the program is working fine.

I am getting an error when I am running on my PC (rdkit=2021.03.2 python=3.8.5). The error is a bit strange. The dataframe contains 500 rows and the code is working only for the first 10 rows (0-9) and for later rows, I am getting an error

 s = DataStructs.BulkTanimotoSimilarity(fps_2[n], fps_2[n+1:]) 
    ValueError: BitVects must be same length

The block of code is given below

# compare all fp pairwise without duplicates
      for n in range(len(fps_2)): 
          s = DataStructs.BulkTanimotoSimilarity(fps_2[n], fps_2[n+1:]) 
          # collect the SMILES and values
          for m in range(len(s)):
              qu.append(c_smiles2[n])
              ta.append(c_smiles2[n+1:][m])
              sim.append(s[m])

Can you tell me why I am getting this error on my PC while the code is working fine in Google Colab? How can I solve the issue? Is there anyway to install rdkit=2020.09.2?

Configuration (please complete the following information):

RDKit version: 2021.03.2
OS (not relevant): Ubuntu 20.04
Python version (not relevant):3.8.5
Are you using conda? No / pip install rdkit-pypi from this link

SystemError: initialization of rdchem raised unreported exception

Hi,
I'm using Python 3.8.10, and trying to import rdchem using from rdkit.Chem import rdchem, with rdkit 2022.9.1, on Ubuntu 20.04.5.

It fails with SystemError: initialization of rdchem raised unreported exception and no other indication.
The command python -c "from rdkit import Chem; print(Chem.MolToMolBlock(Chem.MolFromSmiles('C1CCC1')))", on the other hand, works fine.

Musl linux wheels are missing

/code # pip --version
pip 23.0 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
/code # python --version
Python 3.9.16
/code # pip install rdkit
ERROR: Could not find a version that satisfies the requirement rdkit (from versions: none)
ERROR: No matching distribution found for rdkit

The docker image used is python:3.9-alpine. Not using conda.

Set upper bound for numpy version

Hiya,

I run into an error with newer numpy versions (1.24.0):

File ~/work/graphein/graphein/graphein/molecule/features/graph/molecule.py:67, in <dictcomp>(.0)
     62     descriptors = {
     63         k: v for k, v in descriptors.items() if k in descriptor_list
     64     }
     66 # Compute descriptors
---> 67 desc = {d: descriptors[d](mol) for d in descriptors}
     69 # Process Outformat
     70 if return_array:

File /usr/share/miniconda/envs/__setup_conda/lib/python3.8/site-packages/rdkit/Chem/GraphDescriptors.py:124, in Ipc(mol, avg, dMat, forceDMat)
    121       mol._adjMat = dMat
    123 adjMat = numpy.equal(dMat, 1)
--> 124 cPoly = abs(Graphs.CharacteristicPolynomial(mol,adjMat))
    125 if avg:
    126   return entropy.InfoEntropy(cPoly)

File /usr/share/miniconda/envs/__setup_conda/lib/python3.8/site-packages/rdkit/Chem/Graphs.py:43, in CharacteristicPolynomial(mol, mat)
     41 I = 1. * numpy.identity(nAtoms)
     42 An = A
---> 43 res = numpy.zeros(nAtoms + 1, numpy.float)
     44 res[0] = 1.0
     45 for n in range(1, nAtoms + 1):

File /usr/share/miniconda/envs/__setup_conda/lib/python3.8/site-packages/numpy/__init__.py:284, in __getattr__(attr)
    2[81](https://github.com/a-r-j/graphein/actions/runs/3680239676/jobs/6320741907#step:8:82)     from .testing import Tester
    2[82](https://github.com/a-r-j/graphein/actions/runs/3680239676/jobs/6320741907#step:8:83)     return Tester
--> 284 raise AttributeError("module {!r} has no attribute "
    285                      "{!r}".format(__name__, attr))

AttributeError: module 'numpy' has no attribute 'float'

From this article it appears some aliases (like np.float) have been deprecated. As a result, I think the supported NumPy versions should be constrained or the underlying code refactored to support new versions.

Ask for Windows support

Hello, this is amazing ❤️ . I just knew this repo from Stackoverflow. I intend to use this as the dependency rather than the one from conda-forge so it gives the flexibility to the user (who is not familiar with anaconda). But unfortunately there is still no support for Windows. Is it possible to add this? I've seen that pypa/cibuildwheel GHA supports Windows too.

Thank you.

installation error on python 3.8.8 rdkit

ERROR: Could not find a version that satisfies the requirement rdkit-pypi
ERROR: No matching distribution found for rdkit-pypi

Have been getting this type of error while trying to install rdkit with pip install rdkit-pypi on windows with python3.8.8 installed

cannot import name 'rdFreeSASA' from 'rdkit.Chem'

Hi, I've installed the latest version of RDKit using rdkit-pypi, but it seems this does not install rdFreeSASA.
from rdkit.Chem import rdFreeSASA
I get the error:
ImportError: cannot import name 'rdFreeSASA' from 'rdkit.Chem' (/[...]/rdkit/Chem/init.py)
Is there a way to install rdFreeSASA using pip install rdkit-pypi?
Thank you
Stijn

Wheels for pyodide/pyscript

Hi!

I'm curious, is it possible to create wheels that would target pyodide in order to use rdkit as python package through pyscript? And if it is, do you think that it's a good idea to invest into that?

I know that there is rdkit.js as a fall back option, but still I want to ask this question as I think for python users would be more intuitive to install pypi package instead of setting up JS object.

Here is a code snippet to try to install rdkit

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Add rdkit to pyscript</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/style.css" rel="stylesheet">
<!-- Add pyscript link -->
    <link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
    <script defer src="https://pyscript.net/latest/pyscript.js"></script> 
    <py-config>
      terminal = false
      docked = false
      packages = ["rdkit"]

      [splashscreen]
      autoclose = true

      [[interpreters]]
      src = "https://cdn.jsdelivr.net/pyodide/v0.23.4/full/pyodide.js"
      name = "pyodide-0.23.4"
      lang = "python"

    </py-config>
  </head>
  <body>
  
  </body>
</html>

ERROR: 132

Configuration :

RDKit version: 2021.9.5.1
OS: Ubuntu 18.04.3 LTS
Python version (if relevant): 3.9
Are you using conda? No
If you are not using conda: how did you install the RDKit? Both via pip install rdkit-pypi and from source code.

Hello, i am having trouble running rdkit in python.
In particular i get ERROR: 132 by running this minimal code from the pip install tutorial, without any explanation : from rdkit import Chem;print(Chem.MolToMolBlock(Chem.MolFromSmiles('C1CCC1')))
I installed rdkit also from git and i get the same error.

Thanks for the support.
Best regards.

Additional context
Creating parametersdistributions-ml_app_run ... done
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.

from rdkit import Chem; print(Chem.MolToMolBlock(Chem.MolFromSmiles('C1CCC1')))
ERROR: 132

`rdkit.rdBase.boostVersion` is empty string in latest release installed from PyPI using pip

I consult rdkit.rdBase.boostVersion to determine what version of boost any given version of rdkit has been built with like so: python -c "import rdkit; print(rdkit.rdBase.boostVersion)". With the latest release, I get back an empty string ('')

I initially raised this issue in the rdkit repo but Greg indicated that this is an issue with the packaging for pip.

Configuration

  • RDKit version: 2023.09.3
  • OS: Ubuntu 22.04.2 LTS (under WSL2)
  • Python version: 3.10.12
  • Are you using conda? No
  • If you are not using conda: how did you install the RDKit? pip install rdkit

Incompatible with NumPy 2

Importing rdkit with numpy 2.0.0 will throw the following errors:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/dist-packages/colab_kernel_launcher.py", line 37, in <module>
    ColabKernelApp.launch_instance()
  File "/usr/local/lib/python3.10/dist-packages/traitlets/config/application.py", line 992, in launch_instance
    app.start()
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/kernelapp.py", line 619, in start
    self.io_loop.start()
  File "/usr/local/lib/python3.10/dist-packages/tornado/platform/asyncio.py", line 195, in start
    self.asyncio_loop.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.10/dist-packages/tornado/ioloop.py", line 685, in <lambda>
    lambda f: self._run_callback(functools.partial(callback, future))
  File "/usr/local/lib/python3.10/dist-packages/tornado/ioloop.py", line 738, in _run_callback
    ret = callback()
  File "/usr/local/lib/python3.10/dist-packages/tornado/gen.py", line 825, in inner
    self.ctx_run(self.run)
  File "/usr/local/lib/python3.10/dist-packages/tornado/gen.py", line 786, in run
    yielded = self.gen.send(value)
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/kernelbase.py", line 361, in process_one
    yield gen.maybe_future(dispatch(*args))
  File "/usr/local/lib/python3.10/dist-packages/tornado/gen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/kernelbase.py", line 261, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "/usr/local/lib/python3.10/dist-packages/tornado/gen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/kernelbase.py", line 539, in execute_request
    self.do_execute(
  File "/usr/local/lib/python3.10/dist-packages/tornado/gen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py", line 302, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/usr/local/lib/python3.10/dist-packages/ipykernel/zmqshell.py", line 539, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py", line 2975, in run_cell
    result = self._run_cell(
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py", line 3030, in _run_cell
    return runner(coro)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/async_helpers.py", line 78, in _pseudo_sync_runner
    coro.send(None)
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py", line 3257, in run_cell_async
    has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py", line 3473, in run_ast_nodes
    if (await self.run_code(code, result,  async_=asy)):
  File "/usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py", line 3553, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-0f218e1a7d3d>", line 1, in <cell line: 1>
    import rdkit.Chem as Chem
  File "/usr/local/lib/python3.10/dist-packages/rdkit/__init__.py", line 23, in <module>
    from rdkit.Chem.Draw import IPythonConsole
  File "/usr/local/lib/python3.10/dist-packages/rdkit/Chem/__init__.py", line 15, in <module>
    from rdkit import DataStructs, RDConfig, rdBase
  File "/usr/local/lib/python3.10/dist-packages/rdkit/DataStructs/__init__.py", line 13, in <module>
    from rdkit.DataStructs import cDataStructs
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
AttributeError: _ARRAY_API not found

See https://gist.github.com/njzjz/4b299ce4f38ff304051ec38c0f49f3ba for details.

See https://numpy.org/devdocs/dev/depending_on_numpy.html, numpy>=2.0.0rc1 should be used in the build dependency.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.