Can't import audiolab in python - python

I installed audiolab from this source:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikits.audiolab
Those are the only windows binaries for python 2.7 I was able to find.
When I call from scikits import audiolab I get the following error:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
from scikits import audiolab
File "C:\Python27\lib\site-packages\scikits\audiolab\__init__.py", line 34, in <module>
from pysndfile.matapi import *
File "C:\Python27\lib\site-packages\scikits\audiolab\pysndfile\matapi.py", line 145, in <module>
Format('wav', 'pcm16').file_format)
File "_sndfile.pyx", line 170, in scikits.audiolab.pysndfile._sndfile.Format.__init__ (scikits\audiolab\pysndfile\_sndfile.c:1429)
NameError: _SNDFILE_FILE_FORMAT
Is there a way to fix it? If not what should I use for audio processing instead? (Audiolab seemed to be the best alternative among audiotools and pyaudio)
EDIT:
After replacing libsndfile-1.dll, I have this new error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from scikits import audiolab
File "C:\Python27\lib\site-packages\scikits\audiolab\__init__.py", line 25, in <module>
from pysndfile import formatinfo, sndfile
File "C:\Python27\lib\site-packages\scikits\audiolab\pysndfile\__init__.py", line 1, in <module>
from _sndfile import Sndfile, Format, available_file_formats, \
File "numpy.pxd", line 30, in scikits.audiolab.pysndfile._sndfile (scikits\audiolab\pysndfile\_sndfile.c:9632)
ValueError: numpy.dtype does not appear to be the correct type object
Note: numpy is installed.

As far as I can tell you need to install libsndfile-1.0.25 as is mentioned right where you downloaded the binary
Scikits.audiolab is a package for audio file IO using numpy arrays. Linked against libsndfile-1.0.25.
You can download an installer from here. You may need to reinstall the scikits.audiolab distribution after you install libsndfile (although honestly, I'm not sure).
However, if this seems a lot of effort, it might be easier for you to install Python 2.6 and install audiolab from PyPi as scikits docs suggest. The PyPi version of scikits.audiolab is statically linked to libsndfile so you will not need to install it on your own.

I had the same problem on Mac OS. It's possible that you updated or installed a new version of python/numpy after you install audiolab. What I did is uninstall scikits.audiolab and reinstall it again, which got rid of this error

I had the same problem on Ubuntu 10.04.4 LTS. The reason was that the installed version of audiolab was for python2.5, but in the meantime with Ubuntu 10.04.4 LTS python was upgradee to version 2.6. After a new install of audiolab (wich grabbed the correct version) all's working fine.

All you need to do is to install libsndfile would have worked also.
brew install libsndfile

Related

ERROR: No matching distribution found for jaxlib==0.1.67

I need jaxlib==0.1.67 for a project I'm working on, but I can't
downgrade. At the moment I have jaxlib==0.1.75 and my program keeps failing due to an error I can't find a solution to either. I compared all versions of the important packages to another machines versions where my programs runs with no problems and the only difference is the jaxlib version (it's still 0.1.67 on the machine where it runs). I suspect that jaxlib is the issue because the error I get when it's not 0.1.67 is the following:
from haiku import data_structures
File "/net/home/justen/.local/lib/python3.10/site-packages/haiku/data_structures.py", line 17, in <module>
from haiku._src.data_structures import to_immutable_dict
File "/net/home/justen/.local/lib/python3.10/site-packages/haiku/_src/data_structures.py", line 30, in <module>
from haiku._src import utils
File "/net/home/justen/.local/lib/python3.10/site-packages/haiku/_src/utils.py", line 24, in <module>
import jax
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/__init__.py", line 108, in <module>
from .experimental.maps import soft_pmap
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/experimental/maps.py", line 25, in <module>
from .. import numpy as jnp
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/numpy/__init__.py", line 16, in <module>
from . import fft
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/numpy/fft.py", line 17, in <module>
from jax._src.numpy.fft import (
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/_src/numpy/fft.py", line 19, in <module>
from jax import lax
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/lax/__init__.py", line 334, in <module>
from jax._src.lax.parallel import (
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/_src/lax/parallel.py", line 36, in <module>
from jax._src.numpy import lax_numpy
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/_src/numpy/lax_numpy.py", line 51, in <module>
from jax import ops
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/ops/__init__.py", line 16, in <module>
from jax._src.ops.scatter import (
File "/net/home/justen/.local/lib/python3.10/site-packages/jax/_src/ops/scatter.py", line 31, in <module>
from typing import EllipsisType
ImportError: cannot import name 'EllipsisType' from 'typing' (/usr/lib/python3.10/typing.py)
haiku and typing are the same version on both machines so guess it must be jaxlib. On both machines I'm on pip==20.0.2 and in a python 3.9.9 virtualenv.
When I try to downgrade to jaxlib==0.1.67 I get:
ERROR: Could not find a version that satisfies the requirement jaxlib==0.1.67 (from versions: 0.1.75, 0.1.76, 0.3.0, 0.3.2, 0.3.5, 0.3.7, 0.3.10, 0.3.14, 0.3.15)
ERROR: No matching distribution found for jaxlib==0.1.67
I even tried pip install jaxlib==0.1.67 -f https://storage.googleapis.com/jax-releases/jax_releases.html and it doesn't work.
Has anyone experienced the same problem or maybe has a clue of what could be the issue here to help me?
Based on the path in the exception (/usr/lib/python3.10), it looks like you are using python 3.10. There are no python 3.10 wheels for jaxlib==0.1.67 (see pypi). You will have to use python 3.6-3.9.
If you think you are using python 3.9, then here's a way to clear up confusion when installing packages. Use
python3.9 -m pip install
to install packages into your python 3.9 environment. Replace python3.9 with whichever python interpreter you want to use.
The answer by #jkr is the correct answer for your question as written (how to install jaxlib 0.1.67), but I don't think it will fix the initial error you reported.
This looks like a Python 3.10 only bug that briefly existed in the JAX source code on October 5, 2021, but was fixed and never actually made it into a jax release. If you're seeing this, I suspect it means you installed/imported JAX from unreleased source. Further, installing a different version of jaxlib will not fix this error, because the code is in jax itself. If you're using jaxlib 0.1.75, you might try installing jax v0.2.7 or v0.2.8, which were released around the same time, and shouldn't contain the problematic EllipsisType import.
Another potential issue: you reported using a Python 3.9.9 virtualenv, but your traceback indicates you're executing Python 3.10, so you probably need to check your executable paths to make sure you're executing what you think you are.

Enthought Canopy not working on Fedora. Giving error related to Zlib not found

I installed canopy from the .sh file provided from the link of the Enthought canopy site and then ran the following command after cd into the Canopy directory.
Ashish#LoneWarrior Canopy]$ ./canopy
Subprocess output:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/Ashish/Canopy/appdata/canopy-2.1.3.3542.rh6-x86_64 /lib/python2.7/site-packages/pyface/gui.py", line 20, in <module>
from .toolkit import toolkit_object
File "/home/Ashish/Canopy/appdata/canopy-2.1.3.3542.rh6-x86_64/lib/python2.7/site-packages/pyface/toolkit.py", line 99, in <module>
_init_toolkit()
File "/home/Ashish/Canopy/appdata/canopy-2.1.3.3542.rh6-x86_64/lib/python2.7/site-packages/pyface/toolkit.py", line 65, in _init_toolkit
be = import_toolkit(ETSConfig.toolkit)
File "/home/Ashish/Canopy/appdata/canopy-2.1.3.3542.rh6-x86_64/lib/python2.7/site-packages/pyface/toolkit.py", line 58, in import_toolkit
__import__(be + 'init')
File "/home/Ashish/Canopy/appdata/canopy-2.1.3.3542.rh6-x86_64/lib/python2.7/site-packages/pyface/ui/qt4/init.py", line 18, in <module>
from pyface.qt import QtCore, QtGui, qt_api
File "/home/Ashish/Canopy/appdata/canopy-2.1.3.3542.rh6-x86_64/lib/python2.7/site-packages/pyface/qt/QtGui.py", line 8, in <module>
from PySide.QtGui import *
This is the main error : ZLIB_1.2.9 not found.
ImportError: /home/Ashish/Canopy/appdata/canopy-2.1.3.3542.rh6-x86_64/bin/../lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /lib64/libpng16.so.16)
I have tried changing the python default to 3 but still it is not working.
I presume the problem is on an Arch-based distribution. The temporary solution in this case is to downgrade libpng to 1.6.28 (this worked in my case). If you don't have it in your cache (`/var/cache/pacman/pkg'), you can download it from https://archive.archlinux.org/packages/l/libpng/
Then, following https://wiki.archlinux.org/index.php/downgrading_packages run in the directory with the downloaded file
# pacman -U libpng-1.6.28-1-x86_64.pkg.tar.xz
(with the correct architecture, of course)
Don't forget to list libpng in /etc/pacman.conf among ignored packages to prevent upgrading. Look for the [options] section and add IgnorePkg = libpng.
Improtant. Keep in mind that downgrading packages is not harmless, therefore, this is only a temporary solution.
The problem is that the libz file in the canopy environment is not compatible with the ZLIB installed in your system.
For a quick fix: just copy the libz.so.1 file from lib directory to your canopy environment.
In my case it was
$ cp /usr/lib/libz.so.1 path-to-Canopy-install-directory/appdata/canopy-2.1.6.3665.rh6-x86_64/lib/libz.so.1

Python 3.5 (32-bit): ImportError: cannot import name NUMPY_MKL

I am new to Python and I am trying to install numpy+mkl and scipy (in the same order), but I get below error when I execute following steps:
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
I am using Python 3.5 (32-bit) on a Windows 7 64-bit OS.
There is a similar question already answered for the exact problem here: ImportError: cannot import name NUMPY_MKL
Going through the answer, I reinstalled my numpy+mkl pkg numpy‑1.11.2+mkl‑cp35‑cp35m‑win32.whl from the mentioned link (http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) and then reinstalled scipy-0.18.1-cp35-cp35m-win32.whl as well, but that does not solve the problem and I still get the same error:
>>> exec(open("C:\\PythonFiles\\testpy1.py").read())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 3, in <module>
File "C:\Users\msoudagar\AppData\Local\Programs\Python\Python3532\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "C:\Users\msoudagar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\sklearn\base.py", line 10, in <module>
from scipy import sparse
File "C:\Users\msoudagar\AppData\Local\Programs\Python\Python3532\lib\site-packages\scipy\__init__.py", line 61, in <module>
from numpy._distributor_init import NUMPY_MKL # requires numpy+mkl
ImportError: cannot import name 'NUMPY_MKL'
Any inputs would be really helpful!
Try commenting out the line
from numpy._distributor_init import NUMPY_MKL
it might just work regardless.
ImportError: cannot import name NUMPY_MKL
I know this is not the most sophisticated of solutions but, all I had to do was close the IDE(in my case, Pycharm) and re-open it again.
Not sophisticated but effective in my case :).
Check this answer. Solved my problem.
https://stackoverflow.com/a/37294205/2708266
Suggesting to download ready made binary setup from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
pip install xx.whl
I ran into the same issue on Windows with Python 3.5 64 bit. Manually installing numpy+mkl from wheel file solved the issue for me.
Select the appropriate wheel file from here (cp35,win32 for you): and install it using pip install --user Path_to_local_file.whl replacing Path_to_local_file with wherever you saved the .whl file
This is a also a duplicate of ImportError: cannot import name NUMPY_MKL

'pip install pymongo' stopped working

What do I do wrong?
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==7.1.0', 'console_scripts', 'pip')()
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1- py3.4.egg/pkg_resources/__init__.py", line 558, in load_entry_point
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2682, in load_entry_point
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2355, in load
File "/usr/local/lib/python3.4/dist-packages/setuptools-18.1-py3.4.egg/pkg_resources/__init__.py", line 2361, in resolve
ImportError: No module named 'pip'
Stackoverflow asked me to type more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more and more
Try to fix pip installation with:
sudo apt-get install python3-pip
I've had the same issue and this worked for me. Maybe it's because you only installed pip for an earlier version of python or you intalled it from source and not from you distributions package management.
It sounds like your pip variable isn't set or you're trying to use conflicting environments. If you want to get the python package pymongo installed on your 3.4 version look to use:
/usr/local/bin/pip3.4 install pymongo
Then you can verify by testing in the 3.4 interpreter by running:
python3.4
>>>import pymongo
>>>
In the future look at using virtualenvs, they can be really easy and clean to work with while controlling your packages neatly. Hope this helps!

ImportError: DLL load failed: %1 is not a valid Win32 application - paramiko

I have a situation in win7 64bit, after I installing paramiko 1.12.1 by using easy_install paramiko,I'm using 64bit python2.7 , also installed 64bit pycrypto, there is a import error:
>>> import paramiko
enter code hereenter code hereTraceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import paramiko
File "build\bdist.win-amd64\egg\paramiko\__init__.py", line 65, in <module>
File "build\bdist.win-amd64\egg\paramiko\transport.py", line 33, in <module>
File "build\bdist.win-amd64\egg\paramiko\util.py", line 33, in <module>
File "build\bdist.win-amd64\egg\paramiko\common.py", line 98, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\__init__.py", line 28, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\__init__.py", line 34, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\nt.py", line 28, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\winrandom.py", line 7, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\winrandom.py", line 6, in __bootstrap__
ImportError: DLL load failed: %1 is not a valid Win32 application.
Any thoughs?
This is a problem I ran into as well. I have Windows Server 2012 64 bit and python 32 bit. What I ended up doing is letting pip solve everything.
I have pip 1.6.dev1.
pip install --upgrade paramiko
*if you get this error during upgrade:
AttributeError: 'str' object has no attribute 'rollback', do:
pip uninstall pycrypto and enter (y)
pip install pycrypto
pip install ecdsa
Basically, just try to run that first command, and follow the tracebacks to resolve whatever dependency is missing. This worked for me.
I saved my session in txt if you need it for reference.
-Daniel
If you are having trouble building and installing Python 2.7 components that depend on compiled C modules, I highly recommend you check out Microsoft's specially packaged compiler for Python 2.7, here:
http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266
I had ALL kinds of trouble getting pycrypto to install on Windows 7 64-bit (I was trying to get Fabric to work, which depends on paramiko which depends on pycrypto). After installing the aforementioned compiler and then doing:
pip install wheel
pip uninstall pycrypto paramiko
pip install paramiko
Everything just started working! Hope that helps anyone landing on this answer from Google in the future.

Categories