question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

importlib.metadata.PackageNotFoundError: jsonschema

See original GitHub issue

(Maybe related to #1068, closed yesterday)

When running a small script compiled in standalone mode, I get:

Traceback (most recent call last):
  File "[...]/test.dist/jsonschema_test.py", line 1, in <module>
  File "[...]/test.dist/jsonschema/__init__.py", line 34, in <module jsonschema>
  File "[...]/test.dist/importlib/metadata.py", line 551, in version
  File "[...]/test.dist/importlib/metadata.py", line 524, in distribution
  File "[...]/test.dist/importlib/metadata.py", line 187, in from_name
importlib.metadata.PackageNotFoundError: jsonschema

Python installed with anaconda in dedicated environment.

$ python -m nuitka --version

0.6.15
Python: 3.9.5 (default, May 18 2021, 12:31:01)
Executable: /Users/mesca/anaconda3/envs/nuitka/bin/python
OS: Darwin
Arch: x86_64

I have the same issue when using the develop branch (v0.6.16rc1).

$ python -m pip freeze | grep jsonschema

jsonschema==3.2.0

Minimal example:

from jsonschema import validate

if __name__ == "__main__":
    schema = {
        "type" : "object",
        "properties" : {
            "foobar" : {"type" : "number"}
        }
    }
    validate(instance={"foobar": 42}, schema=schema)

Nuitka output:

Nuitka-Options:INFO: Used command line options: --standalone --plugin-enable=pkg-resources test.py
Nuitka:INFO: Starting Python compilation with Nuitka '0.6.16rc1' on Python '3.9' commercial None.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'tkinter' added '_tkinter'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'socket' added '_socket'.
Nuitka-Plugins:INFO: implicit-imports: Implicit dependencies of module 'ctypes' added '_ctypes'.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C level backend compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: clang (clang).
Nuitka-Scons:INFO: Compiled 56 C files using ccache.
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'disabled': 1
Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache miss': 55
Nuitka-Plugins:INFO: data-files: Included data dir 'jsonschema/schemas' with 4 files due to package data for 'jsonschema'.
Nuitka-Plugins:INFO: data-files: Included data file 'lib2to3/Grammar3.9.5.final.0.pickle' due to package data for 'lib2to3.pgen2'.
Nuitka-Plugins:INFO: data-files: Included data file 'lib2to3/PatternGrammar3.9.5.final.0.pickle' due to package data for 'lib2to3.pgen2'.
Nuitka:INFO: Keeping build directory 'test.build'.
Nuitka:INFO: Successfully created 'test.dist/test'.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, May 29, 2021

Fixed on github develop, but there will be a hotfix for this soon.

0reactions
kayhayencommented, Jun 19, 2021

Already releases as part of a hotfix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use of importlib_metadata breaks jsonschema usage in AWS ...
raises a PackageNotFoundError — importlib_metadata cannot be found, despite it being installed. I have worked around this by simply ...
Read more >
Failed to find package metadata for jsonschema
It terminates with this error: importlib_metadata.PackageNotFoundError: No package metadata was found for jsonschema
Read more >
importlib_metadata" error in Serverless AWS Lambda
How to fix "PackageNotFoundError: importlib_metadata" error in ... and for one of the endpoints i needed to implement jsonschema validation.
Read more >
Using importlib.metadata — Python 3.11.1 documentation
importlib_metadata is a library that provides access to the metadata of an installed Distribution Package, such as its entry points or its top-level...
Read more >
问答- 腾讯云开发者社区-腾讯云
它将终止,并显示以下错误: importlib_metadata.PackageNotFoundError: No package metadata was found for jsonschema.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found