Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'train_tools' #13

Closed
rmd13 opened this issue Jan 8, 2024 · 2 comments
Closed

ModuleNotFoundError: No module named 'train_tools' #13

rmd13 opened this issue Jan 8, 2024 · 2 comments

Comments

@rmd13
Copy link

rmd13 commented Jan 8, 2024

Hi, I test the colab demo with no peroblem, however, when I run it as script, error take place:
ModuleNotFoundError: No module named 'train_tools'
I noticed that train_tools is localized inside Anaconda3\envs\Mediar\Lib\site-packages\MEDIAR, thus that's why the module is not detected.

To solve the problem,I add three lines in the beginning of demo script,:

import os
print("============ getcwd 1=======================")
print(os.getcwd())
aMEDIARroot = "E:\\BackupVIP\\RMD\\GreenSoft\\Anaconda3\\envs\Mediar\\Lib\\site-packages\\MEDIAR"
os.chdir(aMEDIARroot)
print("============ getcwd 2=======================")
print(os.getcwd())

However, the error still persist.

I use a batch file to launch the Anaconda3 and Medira env:

call E:\BackupVIP\RMD\GreenSoft\Anaconda3\Scripts\activate.bat E:\BackupVIP\RMD\GreenSoft\Anaconda3
call conda activate Mediar
call python mediar_demo.py
echo "good"
pause

I also tried add 2 lines the beginning, but it still not work.

E:
cd E:\BackupVIP\RMD\GreenSoft\Anaconda3\envs\Mediar\Lib\site-packages\MEDIAR

I confirmed that both os.getcwd() print the correct path:
============ getcwd 1=======================
E:\BackupVIP\RMD\GreenSoft\Anaconda3\envs\Mediar\Lib\site-packages\MEDIAR
============ getcwd 2=======================
E:\BackupVIP\RMD\GreenSoft\Anaconda3\envs\Mediar\Lib\site-packages\MEDIAR

but the same error still appears.

Finally, I found that it only works when I place the bat file and mediar_demo.py together inside folder "E:\BackupVIP\RMD\GreenSoft\Anaconda3\envs\Mediar\Lib\site-packages\MEDIAR"

Is there a way to specify the working directory to solve the mising "train_tools" problem?
Thanks

@rmd13
Copy link
Author

rmd13 commented Jan 8, 2024

I add many MEDIAR. to py files that import *, solved.

@Lee-Gihun
Copy link
Owner

Good to hear that the problem has been solved! The codebase includes several overrides for system paths, so if a path-related issue arises, manual adjustments to the import pipeline may be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants