Share via

Laptop crashed after executing a certain code

Moses Haroun 0 Reputation points
2025-12-24T16:46:41.22+00:00

I have an issue in running a simple code with a dataset containing only 5 entries on a Jupyter Notebook. The execution of these lines in particular '

PandasTools.AddMoleculeColumnToFrame(mols_df,'SMILES') mols_df.head(2)

' consumes a lot RAM memory till it crashes and the laptop restarts showing me that "the device has ran into a problem". Furthermore, I have installed the latest system drivers as well as installing and uninstalling VS code but the same issue persists. Also, I checked this issue with the manufacturing company of my laptop, they advised that there is no problem with my laptop and advised the problem should be in code execution. The code used:

'

from pathlib import Path import math import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.lines import Line2D import matplotlib.patches as mpatches from rdkit import Chem from rdkit.Chem import Descriptors, Draw, PandasTools PandasTools.RenderImagesInAllDataFrames(images=True) mols = pd.read_csv('H17M000 - Copy.smi', sep='\t', header=None, names=['SMILES', 'ID']) mols_df = pd.DataFrame(data=mols)

PandasTools.AddMoleculeColumnToFrame(mols_df,'SMILES') mols_df.head(2)

'

VS Code version: Code 1.107.1 (microsoft/vscode@994fd12, 2025-12-17T14:15:14.850Z) OS version: Windows_NT x64 10.0.26200

RDKit version: 2025.09.3

OS: windows 11 - Jupyter Notebook Python version (if relevant): 3.14.2

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.

0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2025-12-24T16:47:53.32+00:00

    It seems that the issue you are experiencing with your Jupyter Notebook may be related to memory consumption during the execution of the PandasTools.AddMoleculeColumnToFrame(mols_df, 'SMILES') function. This function can be resource-intensive, especially if the dataset or the underlying libraries are not optimized for memory usage.

    Here are a few suggestions to help you troubleshoot and potentially resolve the issue:

    1. Check Memory Usage: Monitor your system's memory usage while running the code. You can use tools like Task Manager on Windows to see how much RAM is being consumed.
    2. Reduce Data Size: Although you mentioned that your dataset contains only 5 entries, ensure that the content of those entries is not excessively large or complex. Sometimes, the data itself can cause unexpected memory usage.
    3. Update Libraries: Ensure that you are using the latest versions of RDKit and Pandas, as updates may include optimizations that reduce memory usage.
    4. Use Smaller Batches: If possible, try processing your data in smaller batches instead of all at once. This can help manage memory more effectively.
    5. Check for Memory Leaks: Sometimes, libraries can have memory leaks. Ensure that you are using the libraries correctly and check their documentation for any known issues.
    6. Use a Different Environment: If the problem persists, consider running your code in a different environment, such as a different version of Python or a different IDE, to see if the issue is specific to your current setup.

    If you continue to experience crashes, it may be beneficial to look into the specific error messages or logs generated by your system for more insights into what might be causing the crashes.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.