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

the problem of "ImportError: No module named ctx_mesa" #48

Open
zjw689 opened this issue Nov 21, 2020 · 8 comments
Open

the problem of "ImportError: No module named ctx_mesa" #48

zjw689 opened this issue Nov 21, 2020 · 8 comments

Comments

@zjw689
Copy link

zjw689 commented Nov 21, 2020

pip install opendr==0.77, and it is successfully. Then, enter into the environment of python, input the test of demo "import opendr
opendr.demo('spherical_harmonics')".
But the error is as below:
"Traceback (most recent call last):
File "", line 1, in
File "opendr/init.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "", line 5, in
File "opendr/renderer.py", line 25, in
from .contexts.ctx_mesa import OsContext
ImportError: No module named ctx_mesa"

@zjw689
Copy link
Author

zjw689 commented Nov 21, 2020

can any dear teacher help me? The python is 2.7,OS is ubuntu 18.04

@zjw689
Copy link
Author

zjw689 commented Nov 21, 2020

@paulmelnikow
Copy link
Contributor

Hi, sorry, I can't help with this.

@classner
Copy link
Contributor

Hi @zjw689 !

I'm not a maintainer of this package, but if I recall correctly this means that the installation is not complete and lacks the OS specific components for rendering. During installation, I think this method ( https://github.com/mattloper/opendr/blob/master/setup.py#L31 ) should take care of it, so you could check whether this is done successfully. @mattloper could probably provide more details.

@zjw689
Copy link
Author

zjw689 commented Nov 22, 2020

Hi @zjw689 !

I'm not a maintainer of this package, but if I recall correctly this means that the installation is not complete and lacks the OS specific components for rendering. During installation, I think this method ( https://github.com/mattloper/opendr/blob/master/setup.py#L31 ) should take care of it, so you could check whether this is done successfully. @mattloper could probably provide more details.

Thank you very much. But it dose not work.

@NguyenTriTrinh
Copy link

I guess python setup.py build_ext --inplace may help you.

@SMY19999
Copy link

SMY19999 commented Mar 1, 2023

I have solved this problem. Please go to this webpage, which in Chinese.
I use Python 2.7 and follow the "二、手动安装" instruction.
In fact, we need to add step 7 : python setup.py build_ext --inplace
The terminal will print:
running build_ext copying build/lib.linux-x86_64-2.7/opendr/contexts/ctx_mesa.so -> ./contexts
That's all.

@SMY19999
Copy link

Based on my last reply,

**xiaoyang-RL9 ** commented Mar 1, 2023

I solve the problem by modifying some code.

As the error said, it is the opendr/contexts/ctx_base.pyx, code : from _constants import *. And the error is no module named _constancts.

So I check the _constants.py in the same root directory, it just contains some names, just copy them and put them on the top of ctx_base.pyx. And delete from _constants import *.

After doing such modification, you can install opendr manually following my last reply. Test it by

import opendr

opendr.demo('texture')

You will see an earth.

My venv is python2.7, created by conda.

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

5 participants