I am getting this error on my python project:
Exception has occurred: ImportError
cannot import name 'tzlocal' from 'dateutil.tz' (unknown location)
File "/workspace/__pypackages__/3.10/lib/botocore/compat.py", line 31, in <module>
from dateutil.tz import tzlocal
File "/workspace/__pypackages__/3.10/lib/botocore/docs/bcdoc/restdoc.py", line 17, in <module>
from botocore.compat import OrderedDict
File "/workspace/__pypackages__/3.10/lib/botocore/docs/service.py", line 13, in <module>
from botocore.docs.bcdoc.restdoc import DocumentStructure
File "/workspace/__pypackages__/3.10/lib/botocore/docs/__init__.py", line 15, in <module>
from botocore.docs.service import ServiceDocumenter
File "/workspace/__pypackages__/3.10/lib/botocore/waiter.py", line 18, in <module>
from botocore.docs.docstring import WaiterDocstring
File "/workspace/__pypackages__/3.10/lib/botocore/client.py", line 15, in <module>
from botocore import waiter, xform_name
File "/workspace/__pypackages__/3.10/lib/botocore/session.py", line 26, in <module>
import botocore.client
File "/workspace/__pypackages__/3.10/lib/boto3/session.py", line 17, in <module>
import botocore.session
File "/workspace/__pypackages__/3.10/lib/boto3/__init__.py", line 17, in <module>
from boto3.session import Session
File "/workspace/test_service.py", line 13, in <module>
import boto3
ImportError: cannot import name 'tzlocal' from 'dateutil.tz' (unknown location)
I am running the project on vs code devContainers extension (latest version v0.362.0) with python version 3.10 on an M2 mac book pro machine. I am using DockerHub version 4.30.0 and PDM version 2.15.3 for package management.
pdm show python-dateutil
shows that version 2.8.2 of python-dateutil
is installed.
To resolve the issue I tried pdm sync
and pdm install
, they both run successfully to the end but when I run the project I still get the same error. Some developers suggested re-installing python-dateutil
, that did not work either.
I also tried running pdm update
which displays Resolving dependencies
on the screen and then it just hangs for 20 minutes or so before the process is killed. This might be another clue to the root of the problem.
If anyone saw this error before or knows how to resolve it your help would be much appreciated.
user25306364 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.