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

ModuleNotFoundError: No module named 'pytraj.core.topology_objects' #1637

Closed
JSurayut opened this issue Aug 7, 2023 · 15 comments
Closed

ModuleNotFoundError: No module named 'pytraj.core.topology_objects' #1637

JSurayut opened this issue Aug 7, 2023 · 15 comments

Comments

@JSurayut
Copy link

JSurayut commented Aug 7, 2023

Hello, I want to use pytraj for my research but when I run on jupyter or in terminal. It shows "ModuleNotFoundError: No module named 'pytraj.core.topology_objects'", Please advice me how to fix it. Thank you

@hainm
Copy link
Contributor

hainm commented Aug 8, 2023

hi @JSurayut, how did you install pytraj?
(e.g: you can install AmberTools that includes pytraj: https://ambermd.org/GetAmber.php)

@JSurayut
Copy link
Author

JSurayut commented Aug 8, 2023 via email

@hainm
Copy link
Contributor

hainm commented Aug 8, 2023

@JSurayut is there any chance that you have pytraj source code in your desktop and you opened jupyter in the location having pytraj?

@JSurayut
Copy link
Author

JSurayut commented Aug 9, 2023

No, I have checked in my folder that I opened jupyter, It does not have any pytraj source code.

@hainm
Copy link
Contributor

hainm commented Aug 9, 2023

um, that's odd. can you try import parmed; print(parmed) to see if that works?

@hainm
Copy link
Contributor

hainm commented Aug 9, 2023

Your issue is similar to #1565

@JSurayut
Copy link
Author

um, that's odd. can you try import parmed; print(parmed) to see if that works?

I try this and It show a message


ImportError Traceback (most recent call last)
in ()
----> 1 import parmed

/home/cadd/amber22/lib/python3.10/site-packages/parmed/init.py in ()
19
20 from . import exceptions, periodic_table, residue
---> 21 from . import unit, utils
22 from .topologyobjects import *
23 from .structure import Structure, StructureView

/home/cadd/amber22/lib/python3.10/site-packages/parmed/utils/init.py in ()
2 from ..exceptions import MoleculeError as _MoleculeError
3 from .pairlist import find_atom_pairs
----> 4 from ..topologyobjects import Atom
5 from shutil import which
6 from typing import List, Set, Tuple

/home/cadd/amber22/lib/python3.10/site-packages/parmed/topologyobjects.py in ()
7 import enum
8 import math
----> 9 from functools import cached_property
10 from typing import Optional
11 import warnings

ImportError: cannot import name 'cached_property'

@hainm
Copy link
Contributor

hainm commented Aug 11, 2023

{quote}
----> 9 from functools import cached_property
10 from typing import Optional
11 import warnings

ImportError: cannot import name 'cached_property'
{quote}

This cached_property was added to Python since 3.8 release. I bet you're mixing different python versions here.

import sys
print(sys.version_info)
print(sys.path) # check this to see any mixing. 

what does this say? (e.g: you're supposed to use python 3.10)

@freeenergylab
Copy link

I encountered the same problem. Now AmberTools22 will download and install python 3.11 version miniconda. When the pytraj module is compilered, the following error appeared:
bug
However, when I used python 3.9 in my own conda enviroment, the pytraj can be installed successfully.

@hainm
Copy link
Contributor

hainm commented Aug 16, 2023 via email

@freeenergylab
Copy link

Thanks, Hai Nguyen. I can compile ambertools23 successfully where I noticed one update.3 you patched for AmberTools23.
And I noticed that you have fixed the compatibility issue between Python 3.11 and CPython for pytraj. Nice work! Cheers!

@JSurayut
Copy link
Author

JSurayut commented Aug 17, 2023

I try it the message shows

sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)
['', '/home/cadd/amber22/lib/python3.10/site-packages', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3/dist-packages/IPython/extensions', '/home/cadd/.ipython']

@hainm
Copy link
Contributor

hainm commented Aug 17, 2023 via email

@JSurayut
Copy link
Author

Your jupyter notebook comes from python 3.6 but the one in amber is 3.10

What should I do, could you give me some advice please?

@hainm
Copy link
Contributor

hainm commented Aug 18, 2023

it's hard to tell you what do to if I don't know the detail.

Basically:

  • which python path did you use to compile ambertools? how (exactly) did you run jupyter?
  • saying you find it, source the amber.sh as the manual suggested, then run /path/to/python3 -m jupyter notebook
  • in the notebook, import sys; print(sys.version); print(sys) to make sure you are using the correct python path?

@hainm hainm closed this as completed Dec 21, 2023
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