How to get pyFFTW running? - python

I am basically looking for a faster alternative to scipy.fftpack.fft and found pyFFTW.
However, I am about to despair since no matter what I am trying I am not getting pyFFTW to work.
What I did so far:
installed pyFFTW by means of PIP: pip install pyfftw
downloaded FFTW 3.3.5 for Windows from here
extracted the zip file and copied anything to the site-package directory of pyFFTW
As soon as I try to import pyFFTW, the following exception occurs:
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyfftw
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files (x86)\Python27\lib\site-packages\pyfftw\__init__.py", line 16, in <module> from .pyfftw import (
File "__init__.pxd", line 861, in init pyfftw.pyfftw (C:\projects
\pyfftw\pyfftw\pyfftw.c:17297)
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 104, got 112
I am using numpy 1.7.1.
Any suggestions about how to fix this problem are highly appreciated.
BTW: I already tried to uninstall / install numpy and pyFFTW several times.

You need to upgrade numpy. Whatever binary you found was compiled against a too-new copy of numpy.

Related

Pandas import error on older Numpy version on Raspbian

On a fresh install of Raspbian 10 on Raspberry PI 3 B+, I am trying to install with Python 3.7 the numpy==1.19.5. The problem is that when I import pandas, I get this error:
pi#raspberrypi:~ $ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python3.7/site-packages/pandas/__init__.py", line 29, in <module>
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
File "/home/pi/.local/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 44 from C header, got 40 from PyObject
If I keep the default installation of numpy==1.20.2, it works perfectly, but I have a requirement for any numpy version less than 1.20. I've tried some versions of pandas, but nothing works. I've hit a dead-end so I am asking here for help.

ciscoconfparse unable to import python3.7 win10

Any new solution for this. I am unable to from ciscoconfparse import CiscoConfParse
I tried several versions of ciscoconfparse in python3 usin gpowershell in windows10.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ciscoconfparse import CiscoConfParse
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python3\lib\site-packages\ciscoconfparse\__init__.py", line 1, in <module>
from .ciscoconfparse import *
File "C:\Python3\lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 4018
^
SyntaxError: invalid syntax
I still have not found a version that will let me import the module.
I browsed through several links here..but did not find an answer. The closest issue to mine is:
ciscoconfparse in Python 3.4 module doesn't import correctly
but not answer.
Any new info?
Thanks
I have reproduced the bug where Win10 and Python 3.7.0 cause problems.
FWIW, if you completely uninstall Python 3.7.0 (including manually deleting your Windows installation directory tree), then install Python 3.7.1, you should not have this problem with Windows 10.

Pybrain not working with Python 3.6.1

I installed Python 3.6.1. And then installed pybrain using git (See Screen Shot). Then when I useimport pybrainit works but afterwards when I usefrom pybrain.tools.shortcuts import buildNetworkit gives me error that: Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pybrain
>>> from pybrain.tools.shortcuts import buildNetwork
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from pybrain.tools.shortcuts import buildNetwork
File "C:\Users\davm5\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pybrain\tools\shortcuts.py", line 14
except ImportError, e:
SyntaxError: invalid syntax.
>>> from pybrain.structure import TanhLayer
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from pybrain.structure import TanhLayer
File "C:\Users\davm5\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pybrain\structure\__init__.py", line 1, in <module>
from connections.__init__ import *
ModuleNotFoundError: No module named 'connections'
Why is it doing like this? Kindly help me out here. Thanks
EDIT: Excluded screen shots. Added everything in post as per request.
except ImportError, e is Python 2 syntax and you've tried to run the code with Python 3. Install the latest version — the code seems to be fixed in git (it's except ImportError as e now, so it's suitable for both Python 2.7 and Python 3).
Just an update: I was able to resolve the issue by un-installing python, then installing python 3.6.2 (64 bit), using pip3 (pip3 install pybrain) I was able to install the latest version of pybrain which worked flawlessly. Thanks to everyone who tried to help me out when I was fairly new to python. Love this community!!

ValueError with 'ciphers' when importing paramiko

I want to install paramiko on win 7 32bit ,the python is 3.3 .
I can compile it,but get follow errors:
Installed c:\python33\lib\site-packages\paramiko-1.8.0-py3.3.egg
Processing dependencies for paramiko==1.8.0
Searching for pycrypto==2.6
Best match: pycrypto 2.6
Adding pycrypto 2.6 to easy-install.pth file
Using c:\python33\lib\site-packages
Finished processing dependencies for paramiko==1.8.0
C:\Users\MC\Downloads\paramiko-paramiko-v1.8.0-9-g786920a>python
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".\paramiko\__init__.py", line 62, in <module>
from .transport import SecurityOptions, Transport
File ".\paramiko\transport.py", line 68, in <module>
class SecurityOptions (object):
ValueError: 'ciphers' in __slots__ conflicts with class variable
>>>
Paramiko does not run on Python 3. Yet. I'm working on a development branch (https://github.com/dorianpula/paramiko/tree/python3-support) to add support for Python 3, and I'm working on fixing this particular issue.

"import numpy" results in error in one eclipse workspace, but not in another

Whenever I try importing numpy in my new installation of Eclipse and Pydev, I get the following error:
Traceback (most recent call last):
File "Q:\temp\test.py", line 1, in <module>
import numpy
File "C:\Python26\lib\site-packages\numpy\__init__.py", line 132, in <module>
import add_newdocs
File "C:\Python26\lib\site-packages\numpy\add_newdocs.py", line 9, in <module>
from lib import add_newdoc
File "C:\Python26\lib\site-packages\numpy\lib\__init__.py", line 4, in <module>
from type_check import *
File "C:\Python26\lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "C:\Python26\lib\site-packages\numpy\core\__init__.py", line 13, in <module>
import defchararray as char
File "C:\Python26\lib\site-packages\numpy\core\defchararray.py", line 23, in <module>
from numpy.core.multiarray import _vec_string
ImportError: cannot import name _vec_string
However, in a vanila python console and in IPython, import is successful
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
Q:\Groups\Bioinformatics\HPLCautomatization\autohplc>ipython
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [2]: import numpy
To make stuff even more complicated, in another Eclipse workspace, this import works fine. Restarting eclipse didn't help. I also tried to re-config the interpreter in Preferences->python->interpreter->python (as in this question), but the problem still exists
Two additional similar problems were described on SO (this and this), but both of them were observed with IronPython and I couldn't find anything I could use in the few answers that were provided.
EDIT As suggested by dutt, I checked Preferences->Pydev->Interpreter python->libraries in both the tested workspaces (the working one and the one that doesn't). The malfunctioning workspace contained the following library in system libs C:\Python26\lib\site-packages\numpy-1.5.0-py2.6-win32.egg . On the other hand, the working workspace doesn't list any numpy library in its system libraries list. I have removed the above library from the list in the not working workspace.
(Assuming you'r using PyDev) Look in Preferences->Pydev->Interpreter-Python->Libaries, you may have to add NumPy there. Should be located in your python/lib/site-packages folder.
check the version of your python release and numpy release. they should be the same.
It happened to me and I solved it re-installing my python and numpy for win32, although I have a 64-bit machine.

Categories

Resources