Closed ziyad121 closed 4 years ago
The problem seems to be with importing typing.Counter
. Can you run a new Python script just with the following?
from typing import Counter
Also, what Python version are you running?
python -VV
from a command line andthe output of following running inside Python?
import sys
print(sys.version_info)
For me I get Python 3.6.9 (default, Nov 23 2019, 06:41:34)
and sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)
, respectively. With that importing typing.Counter
should not be a problem.
I also get the same thing you got for sys version :
sys.version_info(major=3,minor=6, micro=0, releaselevel='final', serial=0)
and
$ python -VV
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
The script for typing.Counter
runs just fine.
Hm, according to the documentation typing.Counter
should only be available starting from Python 3.6.1.
Could you try upgrading your Python installation to at least that?
Still, I am somewhat surprised that the plain from typing import Counter
works for you because when starting with a plain Python 3.6.0 installation it fails for me, e.g.:
$ docker run --rm -it python:3.6.0 python -c "from typing import Counter"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'Counter
The upgrade to a higher version did the job.
Thank you
Problem in importing Counter. How can I fix it?