Python: Numpy version is not downgrading - python

I am trying to import the keras library which causes the following error code:
AttributeError: module 'numpy' has no attribute 'typeDict'
Already found the reason for the error:
This means you are using a NumPy version that removed the deprecated ways AND the library you are using wasn't updated to match that version (uses something like np.typeDict instead of np.sctypeDict).
I wanted to downgrade numpy to an older version (1.21) to fix the issue.
BUT no matter what I am trying to downgrade numpy, it seems like it's stuck on version 1.24.1.
When trying pip3 install --upgrade numpy==1.21 in the terminal it says:
Requirement already up-to-date: numpy==1.21 in ./opt/anaconda3/lib/python3.8/site-packages (1.21.0)
But when checking the numpy version in my editor with import numpy print(numpy.__version__)it's still version 1.24.1. I have already uninstalled the numpy package and reinstalled the older version but nothing changes. What am I doing wrong?

Related

Importing pymc3 leads to the following error: 'TheanoConfigParser' object has no attribute 'gcc__cxxflags'

As the title already mentions, I am trying to import pymc3. However, I keep getting confronted with the following error:
TheanoConfigParser' object has no attribute 'gcc__cxxflags
At the top of the error message it reads:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The installed Theano(-PyMC) version (1.0.5) does not match the PyMC3 requirements.
It was imported from ['C:\\Users\\caspe\\miniconda3\\envs\\precourse\\lib\\site-packages\\theano']
For PyMC3 to work, a compatible Theano-PyMC backend version must be installed.
See https://github.com/pymc-devs/pymc3/wiki for installation instructions.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
According to the error message, it seems that I did not install the correct Theano version. So I uninstalled Theano and installed theano-pymc instead. I tried to uninstall and reinstall theano-pymc and pymc3 and also delete the directories after uninstalling, but the error remains.
How can I successfully import pymc3?

Why aren't transformers imported in Python?

I want to import transformers in jupyter notebook but I get the following error. What is the reason for this error? My Python version is 3.8
ImportError: cannot import name 'TypeAlias' from 'typing_extensions'
I also updated the typing-extensions library version, but the problem was not resolved
You could try
pip install typing-extensions --upgrade
maybe the probelm is the version of datasets package:
pip install datasets==1.15
TypeAlias is available from python version 3.10.
You should upgrade your python version to avoid the error.

Issues with Pandas and Numpy Version

I think have a whole mess of conflicts. I was attempting to run some code in a notebook and got the following message:
ImportError: this version of pandas is incompatible with numpy < 1.16.5
your numpy version is 1.16.2.
Please upgrade numpy to >= 1.16.5 to use this pandas version
I have version 1.2.2 of pandas installed.
I ran conda update numpy and still got the same error when I tried to run the notebook. I ran conda list and it says my version is 1.20.0 but if I run:
import numpy
print(numpy.version.version)
It says my version is 1.16.2. Running pip list it says my version is 1.16.2. I tried to force an upgrade by using pip install -Iv numpy==1.20.0 --force-reinstall and it returned the following error at the end of the install:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
target-encoding 0.5.0 requires numpy==1.16.2, but you have numpy 1.20.0 which is incompatible.
Successfully installed numpy-1.20.1
Yet it still says that my version is 1.16.2 and that pandas is still incompatible with numpy.
Thank you in advance for any help you can give me to resolve this quagmire.
Same issue here. Solved by reinstalling numpy a few times subsequently, until there is not any version of it installed. And then install again the version I needed.

Numpy version issue when using astropy

I am currentling trying to use a package I installed (stsynphot), but I have the following error when typing import stsynphot as stsyn
ImportError: Numpy version 1.9.0 or later must be installed to use Astropy
I was curious so just to try, I tried import astropy and of course had the same error.
Nevertheless, I do have numpy 1.14 installed, I have tried all the upgrade and reinstall procedures but I still have the issue.
Any ideas ?
Thanks !
Try this:
pip install --user astropy[all]
and for the stsynphot package follow these steps: https://stsynphot.readthedocs.io/en/latest/

OS X not using most recent NumPY version

Trying to update NumPY by running pip install -U numpy, which yields "Requirement already up-to-date: numpy in /Library/Python/2.7/site-packages". Then checking the version with import numpy and numpy.version.version yields '1.6.2' (old version). Python is importing numpy via the path '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy'. Please help me out here.
You can remove the old version of numpy from
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
.
Just delete the numpy package from there and then try to import numpy from the python shell.
The new NumPY version would install (via pip) into the System path, where it wasn't being recognized by Python. To solve this I ran pip install --user numpy==1.7.1 to specify I want NumPY version 1.7.1 on my Python (user) path.
:)

Categories

Resources