Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ImportError: Attempted Relative Import With No Known Parent Package

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Symptom

ImportError: Attempted Relative Import With No Known Parent Package

Solution

The best solution is to run the Python script as a Python module. However, you have to add the directory containing the Python module into the Python module search path first. A simple way to do this is to define the PYTHONPATH environemnt variable.

:::bash
PYTHONPATH=/root/xinstall/ python3 -m xinstall.main -h

References

ImportError: Attempted Relative Import With No Known Parent Package (Python)