Python ImportError: No module named ext - python-2.7

When i running my code I am getting following error saying ImportError: No module named ext
Code sample causing error
import module.model
module.model.dropdb(input)
module.model.createdb(input)
The trace back as follows
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "module/models/__init__.py", line 54, in drop_db
drop_db_with_migrations(quiet)
File "module/models/__init__.py", line 31, in drop_db_with_migrations
from module.app import db
File "module/app.py", line 42, in <module>
app.jinja_env.add_extension('hamlpy.ext.HamlPyExtension')
File "/vagrant-dev/opt/dev_virtualenv/local/lib/python2.7/site-packages/Jinja2
-2.6-py2.7.egg/jinja2/environment.py", line 288, in add_extension
self.extensions.update(load_extensions(self, [extension]))
File "/vagrant-dev/opt/dev_virtualenv/local/lib/python2.7/site-packages/Jinja2
-2.6-py2.7.egg/jinja2/environment.py", line 75, in load_extensions
extension = import_string(extension)
File "/vagrant-dev/opt/dev_virtualenv/local/lib/python2.7/site-packages/Jinja2
-2.6-py2.7.egg/jinja2/utils.py", line 213, in import_string
return getattr(__import__(module, None, None, [obj]), obj)
ImportError: No module named ext

Your problem is in your Traceback:
Traceback (most recent call last):
-- SNIP --
File "module/app.py", line 42, in <module>
app.jinja_env.add_extension('hamlpy.ext.HamlPyExtension')
-- SNIP --
ImportError: No module named ext
Jinja2 uses the dunder import mechanism __import__(some_package_name_string). It's unable to find a subpackage ext in your hamlpy package.

Related

ImportError: libblas.so.3

After installation of turicreate, when I am importing it
import turicreate
I am getting the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/papun/anaconda2/lib/python2.7/site-packages/turicreate/__init__.py", line 19, in <module>
from turicreate.data_structures.sgraph import Vertex, Edge
File "/home/papun/anaconda2/lib/python2.7/site-packages/turicreate/data_structures/__init__.py", line 18, in <module>
from . import sframe
File "/home/papun/anaconda2/lib/python2.7/site-packages/turicreate/data_structures/sframe.py", line 16, in <module>
from ..connect import main as glconnect
File "/home/papun/anaconda2/lib/python2.7/site-packages/turicreate/connect/main.py", line 13, in <module>
from ..cython.cy_unity import UnityGlobalProxy
ImportError: libblas.so.3: cannot open shared object file: No such file or directory
It will helpful, if I can get a suggestion on this. I have also tried
re installing scipy.
You need to install Blas.
Follow instruction details in this blog: libblas and liblapack issues and speed, with SciPy and Ubuntu

undefined symbol: cuDevicePrimaryCtxGetState when importing tensorflow

everyone!
I'm trying to install and run tensorflow (GPU-support). I followed the guide and installed cudnn 7 and cuda 9.0.
However, when trying to import tensorflow, I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint:
disable=unused-import
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
<module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in
swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname,
description)
ImportError: /home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/../libtensorflow_framework.so: undefined
symbol: cuDevicePrimaryCtxGetState
How can I fix it?
I had the same problem - I had already installed the required NVIDIA drivers on my Ubuntu machine, but when I tried to import Tensorflow I got the same error.
So for me the problem was that I was using the Nouveau driver instead of the NVIDIA driver. In order to fix the issue you need to go to System Settings->Software & Updates->Additional Drivers and select the option Using NVIDIA binary driver ... and then click at the Apply Changes button. Then just reboot and you're done.

Error message after installing fontmake: "No module named py23"

I've installed, uninstalled, reinstalled FontTools and Fontmake via pip.
However, whenever I try to call Fontmake in terminal I get the following error. Py23 appears to be a Fonttools dependency, which is also installed.
Thanks in advance for any help!
Traceback (most recent call last):
File "/usr/local/bin/fontmake", line 9, in
load_entry_point('fontmake==1.3.1.dev0', 'console_scripts', 'fontmake')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
entry = import(self.module_name, globals(),globals(), ['name'])
File "/Library/Python/2.7/site-packages/fontmake/main.py", line 18, in
from fontmake.font_project import FontProject
File "/Library/Python/2.7/site-packages/fontmake/font_project.py", line 37, in
from defcon import Font
File "/Library/Python/2.7/site-packages/defcon/init.py", line 10, in
from defcon.objects.font import Font
File "/Library/Python/2.7/site-packages/defcon/objects/font.py", line 6, in
from ufoLib import UFOReader, UFOWriter
File "/Library/Python/2.7/site-packages/ufoLib/init.py", line 6, in
from fontTools.misc.py23 import basestring, unicode
ImportError: No module named py23
I fixed this by installing Fonttools from the source files, instead of installing with pip.

py2exe no module named lgamma

I am trying to create an exe file for a python file. py2exe creates the executable, but when I run the executable, I get the following traceback:
C:\Users\gkumar7\Desktop\AL_gui-master\AL_gui-master\dist>app.exe
Traceback (most recent call last):
File "app.py", line 5, in <module>
File "learning_curve.pyc", line 13, in <module>
File "sklearn\metrics\__init__.pyc", line 34, in <module>
File "sklearn\metrics\scorer.pyc", line 30, in <module>
File "sklearn\metrics\cluster\__init__.pyc", line 8, in <module>
File "sklearn\metrics\cluster\supervised.pyc", line 18, in <module>
File "sklearn\metrics\cluster\expected_mutual_info_fast.pyc", line 12, in <mod
ule>
File "sklearn\metrics\cluster\expected_mutual_info_fast.pyc", line 10, in __lo
ad
File "expected_mutual_info_fast.pyx", line 1, in init sklearn.metrics.cluster.
expected_mutual_info_fast (sklearn\metrics\cluster\expected_mutual_info_fast.c:5
007)
ImportError: No module named lgamma
Here is my setup.py file:
dll_excludes = ['MSVCP90.dll', 'OLEAUT32.dll', 'USER32.dll', 'IMM32.dll', 'SHELL32.dll',
'ole32.dll', 'COMDLG32.dll', 'COMCTL32.dll', 'ADVAPI32.dll', 'mfc90.dll', 'msvcrt.dll',
'WS2_32.dll', 'WINSPOOL.DRV', 'GDI32.dll', 'VERSION.dll', 'KERNEL32.dll', 'ntdll.dll']
from distutils.core import setup
import py2exe, matplotlib, numpy
setup(console=['app.py'],
data_files=matplotlib.get_py2exe_datafiles(),
options = {"py2exe": {
"dll_excludes": dll_excludes,
"includes": ['scipy.sparse.csgraph._validation',
'scipy.special._ufuncs_cxx']
}
}, )
I have also tried cx_freeze, but kept receiving similar errors. Any help would be much appreciated.
Include sklearn.utils.lgamma in your py2exe setup file.

How can I resolve the "import multiarray" error in parallel python?

I am trying to run a python 2.7 script which uses parallel python (version 1.6.1) to excute a function which uses numpy arrays (numpy version 1.6.1) on a Ubuntu Voyager (Ubuntu 12.04 derivative) system. It gives me the following error message (actually, it's still longer, repeated 12 times I guess):
Starting pp with 12 workers
* An error has occured during the module import
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/ppworker.py", line 49, in preprocess
exec module
File "<string>", line 1, in <module>
File "/usr/share/pyshared/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/usr/share/pyshared/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/usr/share/pyshared/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/usr/share/pyshared/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/usr/share/pyshared/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: No module named multiarray
A fatal error has occured during the function execution
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/ppworker.py", line 86, in run
__args = pickle.loads(__sargs)
File "/usr/share/pyshared/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/usr/share/pyshared/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/usr/share/pyshared/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/usr/share/pyshared/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/usr/share/pyshared/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: No module named multiarray
Exception in thread run_local:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/pymodules/python2.7/pp.py", line 719, in _run_local
job.finalize(sresult)
UnboundLocalError: local variable 'sresult' referenced before assignment
Exception in thread run_local:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/pymodules/python2.7/pp.py", line 719, in _run_local
job.finalize(sresult)
UnboundLocalError: local variable 'sresult' referenced before assignment
From other threads (e.g. importing NumPy in Parallel Python) I have seen that it's probably an issue with the communication of pp and numpy, so I have tried these:
updating pp and numpy
reinstalling numpy (I'm using the anaconda package)
running the code directly from the shell (not from spyder)
submitting multiarray (which otherwise imports just fine) directly to the workers with the job (and I'm sure I have the correct syntax ...)
but to no avail. Do you have any other suggestions? Is there a simple workaround other than, erm, "de-numpying" my function (which would be sad, it's a matrix multiplication)? My colleague who uses a more recent version of the same operating system, but otherwise the same python setup, does not seem to have this problem, but since time is an issue updating my system or hijacking his slower computer are both not the best options.
If necessary, feel free to ask for more details & thank you in advance.