Numpy version issue when using astropy - python

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/

Related

Unable to import patch sklearn

after importing and installing required packages and libraries I am encountering an import error on patch_sklearn().
from sklearnx import patch_sklearn()
patch_sklearn()
ImportError: cannot import name 'sparse_lsqr' from 'sklearn.utils.fixes' (C:\Users\yogis\AppData\Roaming\Python\Python38\site-packages\sklearn\utils\fixes.py)
Didn't know what you want to do here.
But you can try this:
from sklearn.feature_extraction.image import extract_patches_2d
You must install scikit learn version 1.0 and not 1.1
pip install scikit-learn==1.0
Then after this, restart kernel. If it doesn't work after this, I also had to force reinstall the other packages for conda.
conda install numpy scipy joblib scikit-learn --force-reinstall
and then restart kernel. It worked fine. This is a known bug and is fixed on pypi releases but not yet on conda.

ImportError: cannot import name 'DecisionBoundaryDisplay' from 'sklearn.inspection'

I imported sklearn DecisionBoundaryDisplay via the below command in my Google Colab file.
from sklearn.inspection import DecisionBoundaryDisplay
And I'm getting the following error.
ImportError: cannot import name 'DecisionBoundaryDisplay' from 'sklearn.inspection'
I even installed the following packages & also tried by restarting my runtime but still I'm getting the error.
!pip install --upgrade scikit-learn
!pip install scipy
!pip3 install -U scikit-learn scipy matplotlib
How to fix this issue?
what worked for me was installing scikit learn 1.1.0, i had version 1.0.2 before and got the same error you're encountering.
pip install -U scikit-learn --user
Hope it helps.
It seems DecisionBoundaryDisplay is a new feature and it is currently in an unstable development version. To use it, you need to install the nightly build.

Pycaret cannot imported due to another import error

ImportError: cannot import name '_joblib_parallel_args' from 'sklearn.utils.fixes' (c:\users\ezgi\appdata\local\programs\python\python38\lib\site-packages\sklearn\utils\fixes.py)
To fix I update sklearn library. But, it don't work. Anyone know the reason behind it?
I update sklearn with
pip install --upgrade scikit-learn
Also, uninstall and install it with pip.
This is because one of pycaret's dependencies (imbalanced-learn) fails with the latest version of sklearn
https://github.com/scikit-learn-contrib/imbalanced-learn/issues/894
A temporary workaround until this is fixed would be to use a lower version of sklearn. If you are using pip install pycaret, then you need to use a version of sklearn < 1.0.0

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.

Categories

Resources