Adam Funk <a24...@ducksburg.com> writes: > I'm trying to use the basic stuff in pynomo > > <https://github.com/dbaynard/pynomo> > > which I've installed with pip3, but I run into this problem trying to > the basic stuff in the documentation: > > #v+ > $ python3 > Python 3.6.7 (default, Oct 22 2018, 11:32:17) > [GCC 8.2.0] on linux > Type "help", "copyright", "credits" or "license" for more information. >>>> from pynomo.nomographer import * > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/adam/.local/lib/python3.6/site-packages/pynomo/nomographer.py", > line 16, in <module> > from nomo_wrapper import * > ModuleNotFoundError: No module named 'nomo_wrapper' >>>> import pynomo >>>> import pynomo.nomographer > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/adam/.local/lib/python3.6/site-packages/pynomo/nomographer.py", > line 16, in <module> > from nomo_wrapper import * > ModuleNotFoundError: No module named 'nomo_wrapper' >>>> > #v- > > Any ideas?
The "pynomo" version you have installed may have been developped for Python 2 and not run in "python3". In Python 2, you have implicit relative imports. As an example, it allows modules in the package "pynomo" to use "import nomo_wrapper" to import the submodule "nomo_wrapper". Python 3 has discarded implicit relative imports. In the example above, "import nomo_wrapper" must become "from . import nomo_wrapper" (explicit relative import) or "import pynomo.nomo_wrapper as nomo_wrapper" (absolute import). For the time being, you still find many packages which run only under Python 2. Failing relative imports or syntax errors are a frequent indication towards this. > > Thanks. -- https://mail.python.org/mailman/listinfo/python-list