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

Quick Demo Problem about opendr #35

Closed
AndyVerne opened this issue Sep 8, 2021 · 15 comments
Closed

Quick Demo Problem about opendr #35

AndyVerne opened this issue Sep 8, 2021 · 15 comments

Comments

@AndyVerne
Copy link

The following message showed after run the human body reconstruction script of Quick Demo.

Traceback (most recent call last):
  File "./metro/tools/end2end_inference_bodymesh.py", line 28, in <module>
    from metro.utils.renderer import Renderer, visualize_reconstruction, visualize_reconstruction_test, visualize_reconstruction_no_text, visualize_reconstruction_and_att_local
  File "/root/MeshTransformer/metro/utils/renderer.py", line 15, in <module>
    from opendr.renderer import ColoredRenderer, TexturedRenderer
  File "/root/anaconda3/envs/maskrcnn/lib/python3.7/site-packages/opendr/renderer.py", line 25, in <module>
    from .contexts.ctx_mesa import OsContext
  File "opendr/contexts/ctx_base.pyx", line 18, in init opendr.contexts.ctx_mesa
ModuleNotFoundError: No module named '_constants'

And I have no clue how to fix it.
If anyone could come up with a solution. I really appreciate it.

@AndyVerne
Copy link
Author

Here are the configs about my environment:
conda list:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main
_openmp_mutex             4.5                       1_gnu
apex                      0.1                      pypi_0    pypi
appdirs                   1.4.4                    pypi_0    pypi
backcall                  0.2.0              pyhd3eb1b0_0
blas                      1.0                         mkl
boto3                     1.18.36                  pypi_0    pypi
botocore                  1.21.36                  pypi_0    pypi
ca-certificates           2020.10.14                    0    anaconda
certifi                   2020.6.20                py37_0    anaconda
charset-normalizer        2.0.4                    pypi_0    pypi
chumpy                    0.70                     pypi_0    pypi
cityscapesscripts         2.2.0                    pypi_0    pypi
click                     8.0.1                    pypi_0    pypi
coloredlogs               15.0.1                   pypi_0    pypi
constants                 0.6.0                    pypi_0    pypi
cudatoolkit               10.0.130                      0
cycler                    0.10.0                   pypi_0    pypi
cython                    3.0.0a9                  pypi_0    pypi
decorator                 5.0.9              pyhd3eb1b0_0
fonttools                 4.26.2                   pypi_0    pypi
freetype                  2.10.4               h5ab3b9f_0
humanfriendly             9.2                      pypi_0    pypi
idna                      3.2                      pypi_0    pypi
importlib-metadata        4.8.1                    pypi_0    pypi
intel-openmp              2021.3.0          h06a4308_3350
ipykernel                 5.3.4            py37h5ca1d4c_0    anaconda
ipython                   7.26.0           py37hb070fc8_0
ipython_genutils          0.2.0              pyhd3eb1b0_1
jedi                      0.18.0           py37h06a4308_1
jmespath                  0.10.0                   pypi_0    pypi
joblib                    1.0.1                    pypi_0    pypi
jpeg                      9b                   h024ee3a_2
jupyter_client            6.1.7                      py_0    anaconda
jupyter_core              4.6.3                    py37_0    anaconda
kiwisolver                1.3.2                    pypi_0    pypi
lcms2                     2.12                 h3be6417_0
ld_impl_linux-64          2.35.1               h7274673_9
libffi                    3.3                  he6710b0_2
libgcc-ng                 9.3.0               h5101ec6_17
libgomp                   9.3.0               h5101ec6_17
libpng                    1.6.37               hbc83047_0
libsodium                 1.0.18               h7b6447c_0    anaconda
libstdcxx-ng              9.3.0               hd4cf53a_17
libtiff                   4.2.0                h85742a9_0
libwebp-base              1.2.0                h27cfd23_0
lz4-c                     1.9.3                h295c915_1
maskrcnn-benchmark        0.1                       dev_0    <develop>
matplotlib                3.5.0b1                  pypi_0    pypi
matplotlib-inline         0.1.2              pyhd3eb1b0_2
metro                     0.1.0                     dev_0    <develop>
mkl                       2021.3.0           h06a4308_520
mkl-service               2.4.0            py37h7f8727e_0
mkl_fft                   1.3.0            py37h42c9631_2
mkl_random                1.2.2            py37h51133e4_0
ncurses                   6.2                  he6710b0_1
ninja                     1.10.2                   pypi_0    pypi
nltk                      3.6.2                    pypi_0    pypi
numpy                     1.20.3           py37hf144106_0
numpy-base                1.20.3           py37h74d4b33_0
olefile                   0.46                     py37_0
opencv-python             4.5.3.56                 pypi_0    pypi
opendr                    0.78                     pypi_0    pypi
openjpeg                  2.4.0                h3ad879b_0
openssl                   1.1.1l               h7f8727e_0
packaging                 21.0                     pypi_0    pypi
parso                     0.8.2              pyhd3eb1b0_0
pexpect                   4.8.0              pyhd3eb1b0_3
pickleshare               0.7.5           pyhd3eb1b0_1003
pillow                    8.3.1            py37h2c7a002_0
pip                       21.0.1           py37h06a4308_0
prompt-toolkit            3.0.17             pyh06a4308_0
ptyprocess                0.7.0              pyhd3eb1b0_2
pycocotools               2.0                      pypi_0    pypi
pygments                  2.10.0             pyhd3eb1b0_0
pyparsing                 3.0.0b3                  pypi_0    pypi
pyquaternion              0.9.9                    pypi_0    pypi
python                    3.7.11               h12debd9_0
python-dateutil           2.8.2                    pypi_0    pypi
pytorch                   1.4.0           py3.7_cuda10.0.130_cudnn7.6.3_0    pytorch
pyyaml                    5.4.1                    pypi_0    pypi
pyzmq                     19.0.2           py37he6710b0_1    anaconda
readline                  8.1                  h27cfd23_0
regex                     2021.8.28                pypi_0    pypi
requests                  2.26.0                   pypi_0    pypi
s3transfer                0.5.0                    pypi_0    pypi
scipy                     1.4.1                    pypi_0    pypi
setuptools                52.0.0           py37h06a4308_0
setuptools-scm            6.3.1                    pypi_0    pypi
six                       1.16.0             pyhd3eb1b0_0
sqlite                    3.36.0               hc218d9a_0
tk                        8.6.10               hbc83047_0
tomli                     1.2.1                    pypi_0    pypi
torchvision               0.5.0                py37_cu100    pytorch
tornado                   6.0.4            py37h7b6447c_1    anaconda
tqdm                      4.62.2                   pypi_0    pypi
traitlets                 5.0.5              pyhd3eb1b0_0
typing                    3.10.0.0                 pypi_0    pypi
typing-extensions         3.10.0.2                 pypi_0    pypi
urllib3                   1.26.6                   pypi_0    pypi
wcwidth                   0.2.5                      py_0
wheel                     0.37.0             pyhd3eb1b0_0
xz                        5.2.5                h7b6447c_0
yacs                      0.1.8                    pypi_0    pypi
zeromq                    4.3.3                he6710b0_3    anaconda
zipp                      3.5.0                    pypi_0    pypi
zlib                      1.2.11               h7b6447c_3
zstd                      1.4.9                haebb681_0

pip list:

Package            Version             Location
------------------ ------------------- ------------------------
apex               0.1
appdirs            1.4.4
backcall           0.2.0
boto3              1.18.36
botocore           1.21.36
certifi            2020.6.20
charset-normalizer 2.0.4
chumpy             0.70
cityscapesScripts  2.2.0
click              8.0.1
coloredlogs        15.0.1
constants          0.6.0
cycler             0.10.0
Cython             3.0.0a9
decorator          5.0.9
fonttools          4.26.2
humanfriendly      9.2
idna               3.2
importlib-metadata 4.8.1
ipykernel          5.3.4
ipython            7.26.0
ipython-genutils   0.2.0
jedi               0.18.0
jmespath           0.10.0
joblib             1.0.1
jupyter-client     6.1.7
jupyter-core       4.6.3
kiwisolver         1.3.2
maskrcnn-benchmark 0.1                 
matplotlib         3.5.0b1
matplotlib-inline  0.1.2
metro              0.1.0               /root/MeshTransformer
mkl-fft            1.3.0
mkl-random         1.2.2
mkl-service        2.4.0
ninja              1.10.2
nltk               3.6.2
numpy              1.20.3
olefile            0.46
opencv-python      4.5.3.56
opendr             0.78
packaging          21.0
parso              0.8.2
pexpect            4.8.0
pickleshare        0.7.5
Pillow             8.3.1
pip                21.0.1
prompt-toolkit     3.0.17
ptyprocess         0.7.0
pycocotools        2.0
Pygments           2.10.0
pyparsing          3.0.0b3
pyquaternion       0.9.9
python-dateutil    2.8.1
PyYAML             5.4.1
pyzmq              19.0.2
regex              2021.8.28
requests           2.26.0
s3transfer         0.5.0
scipy              1.4.1
setuptools         52.0.0.post20210125
setuptools-scm     6.3.1
six                1.16.0
tomli              1.2.1
torch              1.4.0
torchvision        0.5.0
tornado            6.0.4
tqdm               4.62.2
traitlets          5.0.5
typing             3.10.0.0
typing-extensions  3.10.0.2
urllib3            1.26.6
wcwidth            0.2.5
wheel              0.37.0
yacs               0.1.8
zipp               3.5.0

@kevinlin311tw
Copy link
Member

How about installing this one?

pip install git+https://gitlab.eecs.umich.edu/ngv-python-modules/opendr.git

@AndyVerne
Copy link
Author

How about installing this one?

pip install git+https://gitlab.eecs.umich.edu/ngv-python-modules/opendr.git

Thanks for your reply. I tried it. The same error still occurs. : (

@kevinlin311tw
Copy link
Member

Maybe you can try my personal docker image with the dependencies installed (although it has several extra packages that not used in this project). You can pull the docker image by

docker pull kevinlin311tw/maskrcnn:py37-cuda10.1-pytorch1.4-openmpi-opendr

@yinkangning0124
Copy link

Finally I solved the problem~ The reason is that you misses ctx_mesa.pyx and ctx_mesa.c in your conda env. So the solution is that:

Fisrt, clone the gitlab repo running : git clone https://gitlab.eecs.umich.edu/ngv-python-modules/opendr.git

Second, copy the two files above in the cloned repo to your conda env, these two files are in /your_cloned_place/opendr/contexts/. So you should run :
cp -r /your_cloned_place/opendr/contexts/ctx_mesa.pyx /your_cloned_place/opendr/contexts/ctx_mesa.c /your_anaconda_path/envs/your_env_name/lib/python3.x/site-packages/opendr/contexts

With the two steps above, you can solve the problem~

@interestingzhuo
Copy link

Finally I solved the problem~ The reason is that you misses ctx_mesa.pyx and ctx_mesa.c in your conda env. So the solution is that:

Fisrt, clone the gitlab repo running : git clone https://gitlab.eecs.umich.edu/ngv-python-modules/opendr.git

Second, copy the two files above in the cloned repo to your conda env, these two files are in /your_cloned_place/opendr/contexts/. So you should run : cp -r /your_cloned_place/opendr/contexts/ctx_mesa.pyx /your_cloned_place/opendr/contexts/ctx_mesa.c /your_anaconda_path/envs/your_env_name/lib/python3.x/site-packages/opendr/contexts

With the two steps above, you can solve the problem~

No ctx_mesa.c in the repo

@ZhihuaLiuEd
Copy link

Finally I solved the problem~ The reason is that you misses ctx_mesa.pyx and ctx_mesa.c in your conda env. So the solution is that:

Fisrt, clone the gitlab repo running : git clone https://gitlab.eecs.umich.edu/ngv-python-modules/opendr.git

Second, copy the two files above in the cloned repo to your conda env, these two files are in /your_cloned_place/opendr/contexts/. So you should run : cp -r /your_cloned_place/opendr/contexts/ctx_mesa.pyx /your_cloned_place/opendr/contexts/ctx_mesa.c /your_anaconda_path/envs/your_env_name/lib/python3.x/site-packages/opendr/contexts

With the two steps above, you can solve the problem~

Hi all @yinkangning0124
I manually build the opendr, which includes the ctx_mesa.pyx and cex_mesa.c in the contexts folder. However, it comes with the following error:

File "contexts/ctx_base.pyx", line 18, in init contexts.ctx_mesa
ModuleNotFoundError: No module named '_constants'

so the line in ctx_base.pyx is " from _constants import * ", I do have the _constants.py in the same folder "context". Any idea on solving this module import error?

Or Hi @kevinlin311tw , seems like this repo have some issue with dependencies with opendr. Any idea on run the demo/train/inference without install opendr?

@Mofafa
Copy link

Mofafa commented Oct 26, 2023

git clone https://gitlab.eecs.umich.edu/ngv-python-modules/opendr.git

I cloned this repo on 2 different machines. One has these 2 files, and the other one does not. That's weird. I upload these 2 files here just in case.

ctx_mesa.zip

@duyddwcs
Copy link

@ZhihuaLiuEd have u solved the issue yet?

@ZhihuaLiuEd
Copy link

@ZhihuaLiuEd have u solved the issue yet?

Hi duyddwcs:
Unfortunately no. Basically I clone the opendr from https://github.com/mattloper/opendr and checkout to the v0.78 branch. I can build it without errors, and all the things may needed does exist under the context folder. But the error on cannot import _constants still exists. I may work on this issue again on a different machine next week.

@duyddwcs
Copy link

@ZhihuaLiuEd Acctually i have solved this issue:

  1. Clone the repo https://github.com/mattloper/opendr.git, and checkout to v0.78
  2. Download the OSMesa.Linux.x86_64.zip from link http://files.is.tue.mpg.de/mloper/opendr/osmesa/OSMesa.Linux.x86_64.zip and put this file in opendr/contexts directory.
  3. Modify the line which import _constants.py to absolute path (from opendr.contexts._constants import *) in opendr/contexts/ctx_base.pyx
  4. Finally run python setup.py build and python setup.py install

@ZhihuaLiuEd
Copy link

ZhihuaLiuEd commented Oct 29, 2023

@ZhihuaLiuEd Acctually i have solved this issue:

  1. Clone the repo https://github.com/mattloper/opendr.git, and checkout to v0.78
  2. Download the OSMesa.Linux.x86_64.zip from link http://files.is.tue.mpg.de/mloper/opendr/osmesa/OSMesa.Linux.x86_64.zip and put this file in opendr/contexts directory.
  3. Modify the line which import _constants.py to absolute path (from opendr.contexts._constants import *) in opendr/contexts/ctx_base.pyx
  4. Finally run python setup.py build and python setup.py install

Thanks for your reply!
I actually did the same thing from step 1 to 4. But resulting the runtime error on cannot import _constants.
I will try again.
Thanks again.

==========================
Update:
sorry that I missed the step 3. Now everything works.
Thanks for your answer.

@Mofafa
Copy link

Mofafa commented Oct 30, 2023

@ZhihuaLiuEd Acctually i have solved this issue:

  1. Clone the repo https://github.com/mattloper/opendr.git, and checkout to v0.78
  2. Download the OSMesa.Linux.x86_64.zip from link http://files.is.tue.mpg.de/mloper/opendr/osmesa/OSMesa.Linux.x86_64.zip and put this file in opendr/contexts directory.
  3. Modify the line which import _constants.py to absolute path (from opendr.contexts._constants import *) in opendr/contexts/ctx_base.pyx
  4. Finally run python setup.py build and python setup.py install

This works for me! Except the opendr version is v0.77, but it works. Thank you!

@AlvaHan
Copy link

AlvaHan commented Oct 31, 2023

mattloper/opendr#55 (comment)
It works for me.
And also thanks the answer above,really helps a lot.

@233hentai
Copy link

@ZhihuaLiuEd Acctually i have solved this issue: 事实上我已经解决了这个问题:

  1. Clone the repo https://github.com/mattloper/opendr.git, and checkout to v0.78克隆存储库 https://github.com/mattloper/opendr.git,并签出到 v0.78
  2. Download the OSMesa.Linux.x86_64.zip from link http://files.is.tue.mpg.de/mloper/opendr/osmesa/OSMesa.Linux.x86_64.zip and put this file in opendr/contexts directory.从链接 http://files.is.tue.mpg.de/mloper/opendr/osmesa/OSMesa.Linux.x86_64.zip 下载 OSMesa.Linux.x86_64.zip 并将该文件放入 opendr/contexts 目录中。
  3. Modify the line which import _constants.py to absolute path (from opendr.contexts._constants import *) in opendr/contexts/ctx_base.pyx将 opendr/contexts/ctx_base.pyx 中 import _constants.py 修改为绝对路径(from opendr.contexts._constants import *)
  4. Finally run python setup.py build and python setup.py install最后运行 python setup.py buildpython setup.py install

That's amazing! Thanks!

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

9 participants