安装 opendr 踩坑记

复现早期的优化算法需要用到opendr,踩坑一天记录!!!

测试是否成功安装的命令

>>> import opendr
>>> opendr.demo("texture")

失败案例

python 3.8.15
numpy=1.23.0
mayavi=4.8.1
chumpy=0.70
cpython=3.0.0

报错一

安装opendr命令1:安装的版本是0.78

pip install opendr

截止目前我还找不到答案!

Traceback (most recent call last):
  File "", line 1, in <module>
  File "/home/xucg/anaconda3/envs/barc/lib/python3.8/site-packages/opendr/__init__.py", line 350, in demo
    exec('global np\n' + demos[which], globals(), locals())
  File "", line 5, in <module>
  File "/home/xucg/anaconda3/envs/barc/lib/python3.8/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'

报错二

安装opendr命令2
参考链接中的手动安装,安装的是opendr版本是0.77


Traceback (most recent call last):
  File "", line 1, in <module>
  File "/home/xucg/opendr/opendr/__init__.py", line 350, in demo
    exec('global np\n' + demos[which], globals(), locals())
  File "", line 5, in <module>
  File "/home/xucg/opendr/opendr/renderer.py", line 25, in <module>
    from .contexts.ctx_mesa import OsContext
ModuleNotFoundError: No module named 'opendr.contexts.ctx_mesa'

报错三

安装opendr命令3

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

报错依旧


Traceback (most recent call last):
  File "", line 1, in <module>
  File "/home/xucg/opendr/opendr/__init__.py", line 350, in demo
    exec('global np\n' + demos[which], globals(), locals())
  File "", line 5, in <module>
  File "/home/xucg/opendr/opendr/renderer.py", line 25, in <module>
    from .contexts.ctx_mesa import OsContext
ModuleNotFoundError: No module named 'opendr.contexts.ctx_mesa'

成功案例

我这个环境是重新建的
torch=1.9.0+cu111
python3.6.13
numpy=1.19.5
chumpy=0.70
cython=0.29.32
mayavi=4.8.0
安装opendr命令:安装的版本是0.78,无报错,但是有些细节需要修改

pip install opendr

在opendr安装的虚拟环境里面进行修改

  1. ~/lib/python3.8/site-packages/opendr/common. 在467 行加入(int(verts_by_face.shape[0]/f.shape[1]).
  2. ~/lib/python3.8/site-packages/opendr/renderer.py 找到有dImage_wrt_2dVerts 函数的地方加入 int(self.v.r.size/3).
  3. ~/lib/python3.8/site-packages/opendr/camera.py 在 102 行加r入int(self.v.r.size*2/3).

正确的输出


http://files.is.tue.mpg.de/mloper/opendr/images/nasa_earth.mtl
Traceback (most recent call last):
  File "", line 1, in <module>
  File "/home/xucg/anaconda3/envs/smalr/lib/python3.6/site-packages/opendr/__init__.py", line 350, in demo
    exec('global np\n' + demos[which], globals(), locals())
  File "", line 10, in <module>
  File "/home/xucg/anaconda3/envs/smalr/lib/python3.6/site-packages/opendr/util_tests.py", line 22, in get_earthmesh
    wg('http://files.is.tue.mpg.de/mloper/opendr/images/nasa_earth.mtl')
  File "/home/xucg/anaconda3/envs/smalr/lib/python3.6/site-packages/opendr/util_tests.py", line 20, in wg
    wget(url, dest)
  File "/home/xucg/anaconda3/envs/smalr/lib/python3.6/site-packages/opendr/utils.py", line 37, in wget
    open(dest_fname, 'w').write(contents)
TypeError: write() argument must be str, not bytes
>>>

你可能感兴趣的:(Debug,python,opendr,3d,算法,报错,chumpy)