I'm struggling to understand this problem with python 3.5.2 on Ubuntu 16.04 with importlib_metadata package
An error has occured in the execution of the program. Error Message: invalid syntax (__init__.py, line 88)
Stack Trace: Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/jsonschema/__init__.py", line 31, in <module>
from importlib import metadata
ImportError: cannot import name 'metadata'
During handling of the above exception, another exception occurred:
File "/usr/local/lib/python3.5/dist-packages/jsonschema/__init__.py", line 33, in <module>
import importlib_metadata as metadata
File "/usr/local/lib/python3.5/dist-packages/importlib_metadata/__init__.py", line 88
dist: Optional['Distribution'] = None
^
SyntaxError: invalid syntax
This importlib_metadata was installed:
pip3 install importlib-metadata --upgrade
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.5/dist-packages
(3.3.0)
Requirement already satisfied: typing-extensions>=3.6.4 in /usr/local/lib/python3.5/dist-
packages (from importlib-metadata) (3.7.4.3)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.5/dist-packages (from
importlib-metadata) (3.4.0)
Could anyone give some help to bypass this problem?
This got me today, very annoying issue.
Python 3.5.2, Ubuntu Xenial
One of the packages I was installing had a dependency of importlib-metadata
, but the version wasn't pinned so I ended up with v3.7.0. This caused a problem, as v3.0.0 of importlib-metadata requires Python 3.6 or later .
However, I was able to pip3 install importlib-metadata==2.0.0
and then continue installing my other packages. This should work provided the package you are trying to install is compatible with 2.0.0
.
This package importlib-metadata is imported from a package jsonschema which I use, so I removed this dependent package of jsonschema package, and it works.
pip3 uninstall importlib-metadata
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.