Error importing numpy in python 2.7 - python

I am having trouble importing numpy into my project. I am using python 2.7.10 and when i try to run the script i get the error :
Traceback (most recent call last):
File "test.py", line 2, in <module>
import numpy as np
File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/site-packages/numpy/core/__init__.py", line 58, in <module>
from numpy.testing import Tester
File "/usr/local/lib/python2.7/site-packages/numpy/testing/__init__.py", line 14, in <module>
from .utils import *
File "/usr/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 15, in <module>
from tempfile import mkdtemp
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 32, in <module>
import io as _io
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions /2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/li b/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/li b/python2.7/lib-dynload/_io.so
Any ideas on whats causing the issue?

Related

Receiving error messages while importing nltk

I was successfully able to install nltk and I have all the prerequisites installed as well.
Nonetheless I have been receiving error messages like these while importing nltk.
>>> import nltk
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
import nltk
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\nltk\__init__.py", line 128, in <module>
from nltk.chunk import *
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\nltk\chunk\__init__.py", line 157, in <module>
from nltk.chunk.api import ChunkParserI
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\nltk\chunk\api.py", line 13, in <module>
from nltk.parse import ParserI
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\nltk\parse\__init__.py", line 79, in <module>
from nltk.parse.transitionparser import TransitionParser
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\nltk\parse\transitionparser.py", line 21, in <module>
from sklearn.datasets import load_svmlight_file
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\sklearn\datasets\__init__.py", line 6, in <module>
from .base import load_breast_cancer
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\sklearn\datasets\base.py", line 20, in <module>
from ..utils import Bunch
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\sklearn\utils\__init__.py", line 11, in <module>
from .validation import (as_float_array,
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\sklearn\utils\validation.py", line 23, in <module>
from ..externals.joblib import Memory
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\sklearn\externals\joblib\__init__.py", line 127, in <module>
from .parallel import Parallel
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\sklearn\externals\joblib\parallel.py", line 25, in <module>
from ._multiprocessing_helpers import mp
File "C:\Users\Saurav\AppData\Local\Programs\Python\Python36-32\lib\site-
packages\sklearn\externals\joblib\_multiprocessing_helpers.py", line 24, in
<module>
_sem = mp.Semaphore()
AttributeError: module 'multiprocessing' has no attribute 'Semaphore'

Why caffe raises this error? ImportError: cannot import name _remove_dead_weakref

I have written a Python layer that puts bottom into an array (im), squeezes the dimension and prints the shape of array (im_shape).
caffe is raising the following error, even after recompiling it again, I am getting this error. Could someone please help me why this error is shown?
I
1222 01:37:59.268040 3566 layer_factory.hpp:77] Creating layer print_shape
Traceback (most recent call last):
File "/home/user/caffe/python/print_layer.py", line 1, in <module>
import caffe
File "/home/user/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File "/home/user/caffe/python/caffe/pycaffe.py", line 11, in <module>
import numpy as np
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/site-packages/numpy/core/__init__.py", line 74, in <module>
from numpy.testing.nosetester import _numpy_tester
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/site-packages/numpy/testing/__init__.py", line 10, in <module>
from unittest import TestCase
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/unittest/__init__.py", line 64, in <module>
from .main import TestProgram, main
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/unittest/main.py", line 7, in <module>
from . import loader, runner
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/unittest/runner.py", line 7, in <module>
from .signals import registerResult
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/unittest/signals.py", line 2, in <module>
import weakref
File "/home/user/anaconda2/envs/testcaffe/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref

ImportError: cannot import name 'multiarray' [New Edit this are good]

I have this error and I do not know how to fix it I have tried many meneras and I do not know how I created new post because the other was badly
Traceback (most recent call last):
File "run.py", line 9, in <module>
from layer import MacLayer
File "/root/MacBot/layer.py", line 5, in <module>
from app import main
File "/root/MacBot/app/main.py", line 8, in <module>
from app.yesno.yesno import YesNo
File "/root/MacBot/app/yesno/yesno.py", line 2, in <module>
import moviepy.editor as mp
File "/usr/local/lib/python3.5/dist-packages/moviepy-0.2.2.11-py3.5.egg/moviepy/editor.py", line 22, in <module>
from .video.io.VideoFileClip import VideoFileClip
File "/usr/local/lib/python3.5/dist-packages/moviepy-0.2.2.11-py3.5.egg/moviepy/video/io/VideoFileClip.py", line 3, in <module>
from moviepy.video.VideoClip import VideoClip
File "/usr/local/lib/python3.5/dist-packages/moviepy-0.2.2.11-py3.5.egg/moviepy/video/VideoClip.py", line 15, in <module>
import numpy as np
File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 153, in <module>
from . import add_newdocs
File "/usr/lib/python3/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python3/dist-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/lib/python3/dist-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 6, in <module>
from . import multiarray
ImportError: cannot import name 'multiarray'
Easiest solution is to use anaconda available from continuum.io/downloads
then you aren't messing with compiling this yourself.

importing numpy in Webots simulator run out environment variable

I have try to import numpy in simulator Webots(7.0.3), it's successful to be used until several times that supervisor revert the simulation. It comes out these error message:
Traceback (most recent call last):
File "PyController.py", line 39, in <module>
from numpy import *
File "C:\Python27\lib\site-packages\numpy\__init__.py", line 170, in <module>
from . import add_newdocs
File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 11, in <module>
from . import numeric
File "C:\Python27\lib\site-packages\numpy\core\numeric.py", line 1103, in <module>
os.environ.update(envbak)
File "C:\Python27\lib\os.py", line 461, in update
self[k] = dict[k]
File "C:\Python27\lib\os.py", line 422, in __setitem__
putenv(key, item)
ValueError: the environment variable is longer than 32767 bytes
The revert function is an original function for supervisor robot which can be called in Webots simulator:
supervisor.simulationRevert()
Can any body help me with this problem? Thanks!

Cannot import name ProtocolError [RaspberryPi, Jasper]

I had installed sphinx and Jasper on my RPI. When I'm trying to start Jasper - i got this:
Traceback (most recent call last):
File "/home/pi/jasper/jasper.py", line 14, in <module>
from client import vocabcompiler, stt, jasperpath
File "/home/pi/jasper/client/stt.py", line 6, in <module>
import requests
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 58, in <module>
from . import utils
File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 25, in <module>
from .compat import parse_http_list as _parse_list_header
File "/usr/local/lib/python2.7/dist-packages/requests/compat.py", line 7, in <module>
from .packages import charade as chardet
File "/usr/local/lib/python2.7/dist-packages/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/__init__.py", line 16, in <module>
from .connectionpool import (
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 33, in <module>
from .connection import (
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connection.py", line 41, in <module>
from .util import (
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/__init__.py", line 18, in <module>
from .retry import Retry
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/retry.py", line 4, in <module>
from ..exceptions import (
ImportError: cannot import name ProtocolError
Who can help me with this error? Thank you
you should
pip install urllib3

Categories