EpicGames / MetaHuman-DNA-Calibration

https://epicgames.github.io/MetaHuman-DNA-Calibration/
Other
454 stars 121 forks source link

No module named 'dna' #59

Open Khalil-Chiao opened 2 months ago

Khalil-Chiao commented 2 months ago

Dear smilicev marijavik,

Hello! I encountered an issue while using the code you provided, and I hope to get your assistance.

When attempting to run the following code:

This example demonstrates Maya UI Window for simple and non-programmatic creation the scene with the creating functional rig. IMPORTANT: You have to setup the environment before running this example. Please refer to the 'Environment setup' section in README.md.

"""

This example is intended to be used in Maya

import dna_viewer

dna_viewer.show()

I received the following error message:

错误: ModuleNotFoundError: file C:\dna_calibration\dna_viewer\dnalib\dnalib.py line 3: No module named 'dna'

After checking, I found that dna is not a folder but a missing module file. Here are the steps I have tried:

Confirmed the project structure and ensured that all dependencies are in the specified paths. Attempted to add the path containing the dna module to sys.path, but the issue persists. I would appreciate any guidance or suggestions you could provide so that I can use the code successfully. Thank you for your hard work!

Looking forward to your response!

marijavik commented 1 month ago

Hello @Khalil-Chiao,

It looks that dna lib is not on the path. Check the following code and replace the paths:

from sys import path as syspath
from sys import platform

ROOT_DIR = "D:/work/MetaHuman-DNA-Calibration"

MAYA_VERSION = "2022"  # or 2023
ROOT_LIB_DIR = f"{ROOT_DIR}/lib/Maya{MAYA_VERSION}"
if platform == "win32":
    LIB_DIR = f"{ROOT_LIB_DIR}/windows"
elif platform == "linux":
    LIB_DIR = f"{ROOT_LIB_DIR}/linux"
else:
    raise OSError(
        "OS not supported, please compile dependencies and add value to LIB_DIR"
    )

syspath.insert(0, ROOT_DIR)
syspath.insert(0, LIB_DIR)

import dna_viewer
dna_viewer.show()