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.
Related
I have installed jax and jaxlib using pip according to https://github.com/google/jax#installation:
Successfully installed jax-0.1.68 jaxlib-0.1.67+cuda11
But after i ran my project, it showed Importerror:
Traceback (most recent call last):
File "...", line 1, in <module>
from jax import jit, jacfwd, jacrev, hessian, lax
File "...", line 16, in <module>
from .api import (
File "...", line 38, in <module>
from . import core
File "...", line 30, in <module>
from . import dtypes
File "...", line 31, in <module>
from .lib import xla_client
File "...", line 51, in <module>
from jaxlib import pytree
ImportError: cannot import name 'pytree' from 'jaxlib' (/home/control/.local/lib/python3.7/site-packages/jaxlib/__init__.py)
Could this problem comes from uncompatible jax/jaxlib version for running the project?
If not, how to deal with it?
It appears that you are importing a much older jax version than you report in the question; jax.lib has not attempted to import pytree from jaxlib since version 0.2.8.
This probably indicates that you are running pip install in a different environment than the one you're using to execute code.
Assuming you are working at the command prompt, try this instead:
$ python -m pip install jax jaxlib
$ python -c "import jax; print(jax.__version__)"
(where you can replace python in both lines with whatever python executable you are using)
If you're working in Jupyter with different kernels, this answer might help you understand how to proceed: Running Jupyter with multiple Python and IPython paths
I'm trying to upgrade some packages and to consolidate my requirements.txt for an existing python program in order to move it to a docker container.
This container will be based on the tensorflow docker container, this dictates some package versions I have to use. We work under windows and we want to be able to run the program locally on our machines (at least for some time). So I need to find a configuration that works in docker and on Windows 10.
Tensorflow 2.4.1 needs numpy~=1.19.2. When using numpy 1.20, pip complains that numpy 1.20 is an incompatible version.
But when using numpy~=1.19.2 I get the following error when importing cvxpy. pip installs all packages just fine:
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
File "test.py", line 1, in <module>
import cvxpy
File "c:\Projekte\algo5\venv\lib\site-packages\cvxpy\__init__.py", line 18, in <module>
from cvxpy.atoms import *
File "c:\Projekte\algo5\venv\lib\site-packages\cvxpy\atoms\__init__.py", line 20, in <module>
from cvxpy.atoms.geo_mean import geo_mean
File "c:\Projekte\algo5\venv\lib\site-packages\cvxpy\atoms\geo_mean.py", line 20, in <module>
from cvxpy.utilities.power_tools import (fracify, decompose, approx_error, lower_bound,
File "c:\Projekte\algo5\venv\lib\site-packages\cvxpy\utilities\power_tools.py", line 18, in <module>
from cvxpy.atoms.affine.reshape import reshape
File "c:\Projekte\algo5\venv\lib\site-packages\cvxpy\atoms\affine\reshape.py", line 18, in <module>
from cvxpy.atoms.affine.hstack import hstack
File "c:\Projekte\algo5\venv\lib\site-packages\cvxpy\atoms\affine\hstack.py", line 18, in <module>
from cvxpy.atoms.affine.affine_atom import AffAtom
File "c:\Projekte\algo5\venv\lib\site-packages\cvxpy\atoms\affine\affine_atom.py", line 22, in <module>
from cvxpy.cvxcore.python import canonInterface
File "c:\Projekte\algo5\venv\lib\site-packages\cvxpy\cvxcore\python\__init__.py", line 3, in <module>
import _cvxcore
ImportError: numpy.core.multiarray failed to import
Steps to reproduce:
1.)
Create a new Python 3.8 venv under Windows 10 and activate it
2.) Install the following requirements.txt via pip install -r requirements.txt:
cvxpy
numpy~=1.19.2 # tensorflow 2.4.1 requires this version
3.) Execute the following test.py via python test.py
import cvxpy
if __name__ == '__main__':
pass
The same thing happens if I want to use tensorflow 2.3. In this case numpy~=1.18 is needed, the error is exactly the same.
Searching for the error finds very few hits which sadly did not help me.
What can I do to solve this?
Hi just updated my version of python from 3.7 to 3.8 I am using pycharm IDE and sklearn was working perfectly fine in the previous version but now when I try to run code that was
However after updating my version it keeps giving the following error.
"C:\Program Files\Python\python.exe" C:/Users/SmithyB/Desktop/test/K-Means.py
Traceback (most recent call last):
File "C:/Users/SmithyB/Desktop/test/K-Means.py", line 6, in <module>
from sklearn.cluster import KMeans
File "C:\Program Files\Python\lib\site-packages\sklearn\__init__.py", line 80, in <module>
from .base import clone
File "C:\Program Files\Python\lib\site-packages\sklearn\base.py", line 21, in <module>
from .utils import _IS_32BIT
File "C:\Program Files\Python\lib\site-packages\sklearn\utils\__init__.py", line 20, in <module>
from scipy.sparse import issparse
File "C:\Program Files\Python\lib\site-packages\scipy\__init__.py", line 119, in <module>
from scipy._lib._ccallback import LowLevelCallable
File "C:\Program Files\Python\lib\site-packages\scipy\_lib\_ccallback.py", line 1, in <module>
from . import _ccallback_c
ImportError: cannot import name '_ccallback_c' from 'scipy._lib' (C:\Program Files\Python\lib\site-packages\scipy\_lib\__init__.py)
I have made sure that the interpreter is correct. I have made sure that I have uninstalled older versions of python from my computer but unfortunately still no luck.
I will really appreciate it if someone can point out how to solve this problem.
Thanks
Try removing Scipy folder from C:/Users/SmithyB/AppData/Roaming/Python/Python36/site-packages/scipy
Reinstall using pip install scipy
Thanks for all your input, I couldn't have solved the problem without you guys.
I am posting how I solved the problem with the hope that it will be helpful to someone.
Since the problem was originally with using the SK-Learn library I uninstalled scikit-learn
pip uninstall scikit-learn
and then reinstalled it.
pip install scikit-learn
the error did not go away after that so I followed the suggestion of uninstalling scipy
pip uninstall scipy
and then reinstalling it.
pip install scipy
I ran a code that I had written which uses sklearn previously and it worked.
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
I had a working installation of NLTK (py26-nltk) on my Mac (OS X 10.6.2). Then I installed numpy. Now when I try to import nltk, I get this:
>>> import nltk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "nltk/__init__.py", line 83, in <module>
from collocations import *
File "nltk/collocations.py", line 39, in <module>
from nltk.metrics import ContingencyMeasures, BigramAssocMeasures, TrigramAssocMeasures
File "nltk/metrics/__init__.py", line 14, in <module>
from scores import *
File "nltk/metrics/scores.py", line 15, in <module>
from scipy.stats.stats import betai
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/stats/__init__.py", line 7, in <module>
from stats import *
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/stats/stats.py", line 203, in <module>
from morestats import find_repeats #is only reference to scipy.stats
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/stats/morestats.py", line 7, in <module>
import distributions
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/stats/distributions.py", line 27, in <module>
import vonmises_cython
File "numpy.pxd", line 30, in scipy.stats.vonmises_cython (scipy/stats/vonmises_cython.c:2939)
ValueError: numpy.dtype does not appear to be the correct type object
What has gone wrong? How can I fix this?
It seems to be more of a matter of [version] incompatibility between SciPy and NumPy versions than between NLTK and Numpy.
While SciPy is not required for NLTK, it is an optional import, and will load if available.
A few hypothesis regarding your situation:
Hyp #1
you formerly were running under NumPy 1.3 along with a compatible version of SciPy
you recently installed NumPy 1.4 but didn't touch SciPy
==> "Old" SciPy is broken.
Remedy : Install newer SciPy or uninstall it altogether (although you may be using/needing SciPy, without knowing it, depending on the modules of NLTK you use)
Alternate Remedy: re-install NumPy 1.3 over 1.4.
Hyp #2 (less likely)
You never had SciPy and NLTK was happy, working without it.
You recently installed NumPy 1.4 (over 1.3) and SciPy (over nothing)
For some reason NumPy and SciPy don't play nice together
Remedy: Uninstall SciPy
I had the same problem on Python 2.6 on Windows XP and as suggested by mjv, I uninstalled my old SciPy module and installed the latest, at which stage I got the error that the yaml module was missing.
After installing the PyYAML module, the "import nltk" statement didn't give any errors.
Hope this helps anyone else having the same problem.
Atish
Chiming in somewhat late, but I ran into this problem with numpy and fisher, on osx (snow leopard,
but I assume this would happen on other x86 machines).
I had installed fisher via pypm, and installed numpy from a binary dmg. In a situation
like this I assume that somewhere along the way a binary got infected with a PowerPC
binary, so it's best to clear them away, and rebuild from source.
I manually deleted them from ~/Library/...,
pulled down the sources (including scipy, might as well bite that bullet now),
recompiled all three from source, and two hours later had a working system.