Python: PackageNotFoundError No package metadata was found for <myproject>

5k views Asked by At

I have an existing python project and trying to debug in via Microsoft Visual Studio Code.

Therefore I have the following launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: myproject",
            "type": "python",
            "request": "launch",
            "program": "E:\\<path>\\__main__.py",
            "cwd": "${workspaceFolder}",
            "env": {"PYTHONPATH": "${cwd}" },
            "args": [
                "publish",
                "--config=E:\\<path>\\config.yaml"
            ],

        }
    ]
}

Unfortunately it runs up to one excpetion:

Exception has occurred: PackageNotFoundError No package metadata was found for myproject

importlib.metadata.PackageNotFoundError: No package metadata was found for myproject

I already tried

pip install importlib.metadata

But it doesn't help.

The lines of code that are running the exception are in the return:

import atexit, copy, getopt, importlib.metadata, json, logging, os, re, signal, shutil, sys, textwrap, time, urllib

. . . return importlib.metadata.version(package)

Using the interpreter: enter image description here

Anyone could help how to fix this?

Thanks in advance.

Cheers

1

There are 1 answers

0
Airwave On BEST ANSWER

After additional research it was just an only the following command, that helped:

pip install -e .

If someone has the same issue (the current project wasn't installed)