python - How to import this packages? Relative import in python3.3 -


i'm trying make this work on machine (arch, using gnome 3). think setup went ok (i replaced print commands) when run chemlab on terminal error telling me there no core package:

[yotam@standing chemlab-master]$ chemlab traceback (most recent call last):   file "/usr/bin/chemlab", line 5, in <module>     pkg_resources.run_script('chemlab==0.2', 'chemlab')   file "/usr/lib/python3.3/site-packages/pkg_resources.py", line 505, in run_script     self.require(requires)[0].run_script(script_name, ns)   file "/usr/lib/python3.3/site-packages/pkg_resources.py", line 1246, in run_script     exec(compile(open(script_filename).read(), script_filename, 'exec'), namespace, namespace)   file "/usr/lib/python3.3/site-packages/chemlab-0.2-py3.3-linux-i686.egg/egg-info/scripts/chemlab", line 4, in <module>     import chemlab cl   file "/usr/lib/python3.3/site-packages/chemlab-0.2-py3.3-linux-i686.egg/chemlab/__init__.py", line 1, in <module>     core.molecule import molecule, atom importerror: no module named 'core' [yotam@standing chemlab-master]$ ls /usr/lib/python3.3/site-packages/chemlab-0.2-py3.3-linux-i686.egg/chemlab/ __init__.py  contrib/     db/          io/          libs/        resources/    __pycache__/ core/        graphics/    ipython.py   molsim/      utils/        [yotam@standing chemlab-master]$ ls /usr/lib/python3.3/site-packages/chemlab-0.2-py3.3-linux-i686.egg/chemlab/ 

so tried run files locally. went appropriate folder , run python __init__.py no get

[yotam@standing chemlab]$ python __init__.py traceback (most recent call last):   file "__init__.py", line 1, in <module>     core.molecule import molecule, atom   file "/home/yotam/applications/chemlab/chemlab-master/chemlab/core/__init__.py", line 1, in <module>     .molecule import molecule, atom   file "/home/yotam/applications/chemlab/chemlab-master/chemlab/core/molecule.py", line 6, in <module>     ..libs.ckdtree import ckdtree valueerror: attempted relative import beyond top-level package [yotam@standing chemlab]$  

i searched little , found can (should?) replace ..libs.ckdtree import ckdtree chemlab.libs.ckdtree import ckdtree did

traceback (most recent call last): file "", line 1, in file "./core/init.py", line 1, in .molecule import molecule, atom file "./core/molecule.py", line 6, in chemlab.libs.ckdtree import ckdtree file "/usr/lib/python3.3/site-packages/chemlab-0.2-py3.3-linux-i686.egg/chemlab/init.py", line 1, in core.molecule import molecule, atom importerror: cannot import name molecule

which baffle me. how can import/run this?

edit: folder structure:

chemlab | | +  __init__.py +  core    |    |    +  molecule.py 

edit 2: chemlab/__init__.py line core.molecule import molecule, atom

and chelab/core/molecule/ import section looks like

import numpy np collections import counter import numpy np copy import copy  ..libs.ckdtree import ckdtree ..db import chemlabdb cdb = chemlabdb()  masses = cdb.get("data", "massdict")  .attributes import marrayattr, mfield .fields import atomicfield, fieldrequired .serialization import data_to_json, json_to_data 

you have circular dependency. it's caused chemlab.__init__.py wanting import core.molecule.molecule, should not try do. remove import line.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -