Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Molecule' object has no attribute '__values__' from python or KeyError: 'loop' in Jupyter notebook #5

Open
AssoliLan opened this issue Jan 29, 2023 · 2 comments

Comments

@AssoliLan
Copy link

Hi,

I installed MultiPredict as https://multirefpredict.readthedocs.io/en/latest/installation.html (cd dev_tools/conda_envs is cd dev_tools/condaenvs in my installation)

If I install jupyter nootbook from multiref enviroment and use it to open Example.ipynb, it leads to Kernel error. If I click Kernel error it lead to KeyError: 'loop'.

If I created a python file

import MultirefPredict
import qcelemental

mol = qcelemental.models.Molecule.from_data("""
O                 0.000000000000     0.000000000000    -0.068516245955
H                 0.000000000000    -0.790689888800     0.543701278274
H                 0.000000000000     0.790689888800     0.543701278274
""")

b1 = MultirefPredict.diagnostic_factory("B1",molecule=mol, molname="water", record=False).computeDiagnostic()

I got

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    """)
  File "/home/.../intel/oneapi/intelpython/latest/envs/multiref/lib/python3.6/site-packages/qcelemental/models/molecule.py", line 559, in from_data
    return cls(orient=orient, validate=validate, **input_dict)
  File "/home/.../intel/oneapi/intelpython/latest/envs/multiref/lib/python3.6/site-packages/qcelemental/models/molecule.py", line 126, in __init__
    values = self.__values__
AttributeError: 'Molecule' object has no attribute '__values__'

what would be the reason for it and how to fix it?

@ffangliu
Copy link
Contributor

ffangliu commented Jul 10, 2024

I tested the python script you posted on issues, and it worked for me. The output is attached for you reference.

b1_out.txt

Here are some possible reasons for the error you met.

(1) Have you installed Psi4? Multirefpredict can use several quantum chemistry packages. By default, if you don't specify, it uses Psi4 and you need to install it.

(2) By installing from the conda_env file, qcelemental is guaranteed to be exactly the same version as I installed. Hence I don't think it's caused by qcelemental.

(3) Maybe it's because of the different version of openbabel? The conda_env file didn't specify the openbabel version. In my output file, it says " UserWarning: "import openbabel" is deprecated, instead use "from openbabel import openbabel"
warnings.warn('"import openbabel" is deprecated, instead use "from openbabel import openbabel"')'

I may be using an older version of openbabel than you. Here's the version I use:

Name | Version | Build | Channel

openbabel | 3.1.1 | py36he0ca515_2 | conda-forge

Hope these can help you fix the error.

@sevkel
Copy link

sevkel commented Jul 10, 2024

The solution that worked for me was changing the test.yaml for building the environment like:

test.txt (note the .type has to be .yaml)

Afterwards it solves the AttributeError but will lead to an KeyError: 'cpu-brand'

To solve this issue you must try

conda install -c conda-forge py-cpuinfo=5

Afterwards the code was running properly and the result value from the example code was reproducable.

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants