ImportError: Cannot import name 'ChainMap' (pandas\compat\chainmap.py) - python

I have installed and tried reinstalling pandas package. I am having the following error:
from pandas.compat.chainmap import DeepChainMap
file: venv\lib\site-packages\pandas\compat\chainmap.py
from typing import ChainMap, MutableMapping, TypeVar, cast
ImportError: cannot import name 'ChainMap'
I have installed python 3.6, tensorflow-gpu==1.13.1, pandas-1.0.3

Update the python version or downgrade the pandas to 0.25. Pandas 1.0.3 requires python >=3.6.1.
Check this issue

I have uninstalled the python3.6.1 version and installed python3.7.3 pandas 1.0.3 version along with tensorflow==1.14 version. This solved the issue.

Related

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.

ImportError: cannot import name 'DtypeArg' from 'pandas

I'm using Pandas 1.3.2 in a Conda environment.
When importing pandas on a Jupyter Notebook:
import pandas as pd
I get the error:
ImportError: cannot import name 'DtypeArg' from 'pandas._typing' (C:\Users\tone_\anaconda3\envs\spyder\lib\site-packages\pandas\_typing.py)
I've seen similar questions, but so far no solution.
Can anyone help?
It worked with me when I downgraded the pandas from panadas=1.3.5 to pandas=1.3.0 and I am using conda enviroment
According to the answer provided in this post it is a bug in pandas==1.3.1.
A possible solution is to downgrade it to some earlier version, e.g pip install pandas==1.3.0

Python Ariadne GraphQL "cannot import name 'GraphQLNamedType'"

I am using Ariadne with Flask.
When I try from ariadne import QueryType, graphql_sync, make_executable_schema as indicated in the Ariadne's doc for Flask I get the following error :
ImportError: cannot import name 'GraphQLNamedType'
I am using :
Python 3.5.1
ariadne-0.11.0
graphql-core-2.3.2
At the moment Ariadne is not compatible with many of the graphql-core, so the version should be between 3.0 and 3.1 for Ariadne to work.
pip install "graphql-core<3.1"
Her is some sources:
https://github.com/mirumee/ariadne/issues/345
https://graphql-core-3.readthedocs.io/en/latest/intro.html#getting-started
Seems the issue came from graphql-core version which need to be >=3.
I was unabled to install the version >=3 so I upgraded Python to 3.8. When installing Ariadne, I get the same version 0.11.0 but now the graphql-core version 3.0.5 and no more the error.

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/

ImportError: cannot import name 'comb'

I am using the updated scikit-learn version 0.18.1 but still I am getting the
ImportError: cannot import name 'comb' when I try to use the model_selection.
Using Spyder IDE latest version.

Categories

Resources