I cannot import python modules into the terminal when I open python with a regular user (although it works for the root user):
The error I am getting is this:
import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 180, in <module> from . import add_newdocs File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in <module> from .type_check import * File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in <module> import numpy.core.numeric as _nx File "/usr/lib/python2.7/dist-packages/numpy/core/__init__.py", line 58, in <module> from numpy.testing.nosetester import _numpy_tester File "/usr/lib/python2.7/dist-packages/numpy/testing/__init__.py", line 12, in <module> from . import decorators as dec File "/usr/lib/python2.7/dist-packages/numpy/testing/decorators.py", line 21, in <module> from .utils import SkipTest File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 15, in <module> from tempfile import mkdtemp, mkstemp File "/usr/lib/python2.7/tempfile.py", line 32, in <module> import io as _io File "/home/praneeth/computervision/code/caffe-master/distribute/python/caffe/io.py", line 2, in <module> import skimage.io File "/home/praneeth/scikit-image/skimage/__init__.py", line 158, in <module> from .util.dtype import * File "/home/praneeth/scikit-image/skimage/util/__init__.py", line 1, in <module> from .dtype import (img_as_float, img_as_int, img_as_uint, img_as_ubyte, File "/home/praneeth/scikit-image/skimage/util/dtype.py", line 8, in <module> dtype_range = {np.bool_: (False, True), AttributeError: 'module' object has no attribute 'bool_'
The same with all modules is not just numpy. I tried the solutions suggested in other similar questions, but they are not developed. For example: It is not possible to import a python module that is definitely installed (mechanize)
The output of the $PYTHONPATH
command:
/home/praneeth/computervision/code/caffe-master/distribute/python/caffe:/home/praneeth/computervision/code/caffe-master/python/caffe:/usr/lib/python2.7/dist- packages /
Also, my system path without root permission:
import sys sys.path ['', '/home/praneeth/computervision/code/caffe-master/distribute/python/caffe', '/home/praneeth/computervision/code/caffe-master/python/caffe', '/usr/lib/python2.7/dist-packages', '/home/praneeth', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/home/praneeth/scikit-image', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0']
Edit1: the sys.path with the root user is the same as the root user who does not expect these caffe installation paths. Here is the result with the root user:
sudo python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/home/praneeth/scikit-image', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat']