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 'yolox' ?? how can i resolve it ? please! #154

Closed
jcyhcs opened this issue Jul 26, 2021 · 9 comments
Closed

Comments

@jcyhcs
Copy link

jcyhcs commented Jul 26, 2021

hi,professor:

i test use cmd liks this:
python3 tools/demo.py image -n yolox_tiny -c ../weights/yolox_tiny.pth.tar --path ../assets/dog.jpg --conf 0.3 --nms 0.65 --tsize 640 --save_result

BUT! I GOT ERROR:
result
Traceback (most recent call last):
File "tools/demo.py", line 14, in
from yolox.data.data_augment import preproc
ModuleNotFoundError: No module named 'yolox'

OH, please tell me why? help ,please!

@jcyhcs jcyhcs closed this as completed Jul 26, 2021
@arianyambao
Copy link

Hi, @jcyhcs. May I ask if you were able to solve the issue? If yes, how?

I am currently experiencing the same problem:

Traceback (most recent call last):
  File "tools/train.py", line 10, in <module>
    from yolox.core import Trainer, launch
ModuleNotFoundError: No module named 'yolox'

Thank you!

@arianyambao
Copy link

Hi, @jcyhcs. May I ask if you were able to solve the issue? If yes, how?

I am currently experiencing the same problem:

Traceback (most recent call last):
  File "tools/train.py", line 10, in <module>
    from yolox.core import Trainer, launch
ModuleNotFoundError: No module named 'yolox'

Thank you!

Was able to find a quick fix, I manually exported my work directory and ran the train script again (on Jupyter notebook):

!export PYTHONPATH="${PYTHONPATH}:/your/path/to/project/" && python tools/train.py -f exps/example/yolox_voc/yolox_voc_s.py -d 1 -b 32 --fp16 -o -c ../yolox_s.pth

Here's the actual line I have used:

!export PYTHONPATH="${PYTHONPATH}:/home/jupyter/tutorials/yolo_x_trial/YOLOX/" && python tools/train.py -f exps/example/yolox_voc/yolox_voc_s.py -d 1 -b 32 --fp16 -o -c ../yolox_s.pth

@tulbureandreit
Copy link

Hello,

I have the same problem when Trying to run the UniTrack demo.

Traceback (most recent call last):
File "demo/mot_demo.py", line 27, in
from detector.YOLOX.tools.demo import Predictor
File "/home/cesiro/Desktop/UniTrack/detector/YOLOX/tools/demo.py", line 14, in
from yolox.data.data_augment import preproc
ModuleNotFoundError: No module named 'yolox.data'

And it did not resolve itself with your fix. Any idea? @arianyambao

@KashaMalaga
Copy link

Same here @tulbureandreit @arianyambao

python tools/demo.py video -n yolox-s -c .\weights\yolox_l.pth --path 0 --conf 0.25 --nms 0.45 --tsize 640
Traceback (most recent call last):
File "C:\Users\kasha\Documents\GitHub\YOLOX\tools\demo.py", line 14, in
from yolox.data.data_augment import ValTransform
ModuleNotFoundError: No module named 'yolox.data'

@tulbureandreit
Copy link

@KashaMalaga hello,
I thiink you would find your solution here
Zhongdao/UniTrack#12

Also, please check your paths for everything you open when executing demo.py! And the files ( i had some missing files)

@Avnsx
Copy link

Avnsx commented Nov 17, 2021

First of, please make sure you decide for a version of CUDA and consistently use that; I am using 11.3 in this.
I fixed this and many other installation and compilation errors, by uninstalling and re-installing the following programs in the exact order

  1. Clone the yolox repo and unzip it
  2. Install Virtual Studio 2019 Community (https://visualstudio.microsoft.com/downloads/)
  3. Download CUDA https://developer.nvidia.com/cuda-11.3.0-download-archive (I just did express installation)
  4. Get https://docs.conda.io/en/latest/miniconda.html for your version of python
  5. Install pytorch with cuda enabled conda install pytorch torchvision cudatoolkit=11.3 -c pytorch
  6. Navigate conda to the download directory (cd yolox_path) of yolox and type in:
    - pip install -r requirements.txt
    - pip install pycocotools # this should get added to requirements.txt @FateScript
    - pip install -v -e . # or python setup.py develop
  7. Congratulations you fixed the error, now you'll be able to run yolox as described in Quick Start > Demo (example: python tools/demo.py video -n yolox-s -c /path/to/your/yolox_s.pth --path /path/to/your/video --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [cpu/gpu] )

A couple notices:

  • You can at the time of writing this; not install above CUDA 11.3, because conda does not provide a higher version in sources to compile with pytorch
  • You can not install a higher version of Virtual Studio, because of incompability with CUDA (devs did not add support for MSVS22 yet)
  • You're forced to install MSVS; because this repo depends on it, to be able to compile as written in step 6.
  • You can not simply uninstall conda, because it removes its CUDA compiled pytorch version and that in return breaks yolox. But I think you could most likely avoid this

In short you kept getting this error, because you couldn't compile yolox properly or not at all.

@KashaMalaga @arianyambao @jcyhcs

@jsing20
Copy link

jsing20 commented Jul 30, 2022

image

Getting this error while running

train.py

@manish33scss
Copy link

yeah i know its late but,
add
import sys
sys.path.append("..")

just before
from yolox.data.data_augment (etc)
in demo.py, it'll work

@amitsas94
Copy link

@manish33scss I tried your solution but still not able to resolve

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

8 participants