I downloaded numpy1.8 for python 2.7
Installed fine, but when i give:
from numpy.fft import fft, fftfreq
it gives me a huge error, which ends with
from numpy.core.multiarray import (
ImportError: cannot import name datetime_data
How can i get rid of this error ?
I need numpy to perform fft functions.
Any kind of help is appreciated.
Related
I'm trying to import the following modules for a Caffe2 tutorial.
Tutorial here: https://github.com/caffe2/caffe2/blob/master/caffe2/python/tutorials/Loading_Pretrained_Models.ipynb
Modules here:
%matplotlib inline
from caffe2.proto import caffe2_pb2
import numpy as np
import skimage.io
import skimage.transform
from matplotlib import pyplot
import os
from caffe2.python import core, workspace, models
import urllib2
print("Required modules imported.")
But it's throwing the following at import.
"* Error in `python': free(): invalid size: 0x0000000000de4e80 *
Aborted (core dumped).
I deleted each line one by one and found the problem line being:
from caffe2.python import core, workspace, models
If I remove this, it will import without issue.
Now, if I import this via the python IDE it works.
Any help would be appreciated!
Thanks
I want to access wordnet from my python code. I am using the following code for this purpose:
from nltk.corpus import wordnet as wn
word=wn.synsets('dog')
print word
I get no error but no output also.The same code on python interpreter gives the correct output. can anyone suggest some method to resolve this problem.
I'm trying to compile a Python 2.7 script that imports the following packages:
import easygui as EG
import numpy as np
import pandas
from skimage import data
from skimage import measure
import cv2
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import ntpath
import os
import time
# Packages for progress bar
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT
easygui
numpy
pandas
skimage
opencv (cv2)
matplotlib
numpy
ntpath
os
time
sys
PyQt4.QtGui
PyQt4.QtCore
All of my sub-functions are in the one "GUI.py" script, and runs perfectly when I use the normal IDE, but I can't seem to get it to compile properly.
I have tried to use cx_freeze as described here, and pyInstaller through what was described here. Both did compile and a "GUI.exe" file was made, but it did not work when I tried to run it.
If anyone has any suggestions, I would greatly appreciate it.
I'm using Python 2.7 Win 64 and I use Anaconda 2.
I am trying to compile a python code with cx_freeze in Windows 7, python 2.7, but it keeps giving me trouble because of pyserial. I tried to import the pyserial tools module in many different ways but I keep getting compilation errors:
import serial
import serial.tools
from serial.tools import list_ports
#I also tried:
#import serial.tools.list_ports
#from serial import tools
#import serial.tools.list_ports
#from serial import tools
The error message varies between:
ImportError: No module named tools
and
ImportError: No module named tools.list_ports
Any ideas on how to solve this issue? Thanks.
I am trying to compile and run the snippets posted here, which basically is going to let me visualize the network internals(feature maps).
I have successfully compiled caffe and pycaffe using the caffe-windows branch, And I have copied the caffe folder, into T:\Anaconda\Lib\site-packages folder.
Yet still, when I try to run this snippet of code in jupyter notebook :
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Make sure that caffe is on the python path:
caffe_root = 'TC:/Caffe/' # this file is expected to be in {caffe_root}/examples
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
plt.rcParams['figure.figsize'] = (10, 10)
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
import os
if not os.path.isfile(caffe_root + 'models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel'):
print("Downloading pre-trained CaffeNet model...")
!../scripts/download_model_binary.py ../models/bvlc_reference_caffenet
I get the following error :
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-e7a8ec94e861> in <module>()
8 sys.path.insert(0, caffe_root + 'python')
9
---> 10 import caffe
L:\Anaconda2\lib\site-packages\caffe\__init__.py in <module>()
----> 1 from .pycaffe import Net, SGDSolver
2 from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver
3 from .proto.caffe_pb2 import TRAIN, TEST
4 from .classifier import Classifier
5 from .detector import Detector
L:\Anaconda2\lib\site-packages\caffe\pycaffe.py in <module>()
11 import numpy as np
12
---> 13 from ._caffe import Net, SGDSolver
14 import caffe.io
15
ImportError: DLL load failed: The specified module could not be found.
Whats wrong here?
Notes:
I'm using Anaconda2-2.4.1-Windows-x86_64.exe
There's most likely a more specific dependency issue you are not seeing (Protobuf / OpenCV). First try using the C++ API to load an example and make sure all the DLL's load. Then you can more confidently narrow things down to the Python side. I recommend the more recent windows caffe instructions based off the branch you're using:
https://initialneil.wordpress.com/2015/01/11/build-caffe-in-windows-with-visual-studio-2013-cuda-6-5-opencv-2-4-9/
I had to do a complete rebuild as detailed above (note that some dependencies are easier to find with NuGet). Also be on the lookout for the right protobuf binaries in various 3rdParty.zip files throughout the above blog.
If you are okay with a snapshot version of Caffe and you don't need to modify the project itself, the following binaries are much easier to install and get working:
https://initialneil.wordpress.com/2015/07/15/caffe-vs2013-opencv-in-windows-tutorial-i/