Coder Social home page Coder Social logo

Comments (24)

YunjieYu avatar YunjieYu commented on July 17, 2024 13

@YuDeng hello, I also encounter [F glutil.cpp:338] eglInitialize() failed when running the inference code. My system environment is nvidia driver 450.80.02 and cuda 11.0. I already have a basic pytorch environment so only install OpenGL related libraries in my system environment (not docker environment) as suggested above. Specifically, I did the following steps:

  1. I organize the contents of the dockerfile (provided by @yuzhou164) into an environment.sh:
apt-get update && apt-get install -y --no-install-recommends \
    pkg-config \
    libglvnd0 \
    libgl1 \
    libglx0 \
    libegl1 \
    libgles2 \
    libglvnd-dev \
    libgl1-mesa-dev \
    libegl1-mesa-dev \
    libgles2-mesa-dev \
    cmake \
    curl \
    libsm6 \
    libxext6 \
    libxrender-dev

# export PYTHONDONTWRITEBYTECODE=1
export PYTHONUNBUFFERED=1

# for GLEW
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH

# nvidia-container-runtime
export NVIDIA_VISIBLE_DEVICES=all
export NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics

# Default pyopengl to EGL for good headless rendering support
export PYOPENGL_PLATFORM=egl

cp docker/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json

pip install --upgrade pip
pip install ninja imageio imageio-ffmpeg
  1. Run this environment.sh:
sudo bash environment.sh
  1. Re-install nvdiffrast:
cd nvdiffrast    # ./Deep3DFaceRecon_pytorch/nvdiffrast
pip install .

I want to know if it is really caused by the nvidia driver version or some other problems.
Looking forward to your reply.

from deep3dfacerecon_pytorch.

Blue-FishER avatar Blue-FishER commented on July 17, 2024 11

Solution

Replace all dr.RasterizeGLContext to dr.RasterizeCudaContext

I have tried different images using docker, and all failed with the same error. But this works for me. And these codes are located in util/nvdiffrast.py Line 62. I do like this:

if self.ctx is None:
self.ctx = dr.RasterizeCudaContext(device=device)
ctx_str = "cuda"
# if self.use_opengl:
# self.ctx = dr.RasterizeGLContext(device=device)
# ctx_str = "opengl"
# else:
# self.ctx = dr.RasterizeCudaContext(device=device)
# ctx_str = "cuda"
# print("create %s ctx on device cuda:%d"%(ctx_str, device.index))

from deep3dfacerecon_pytorch.

yuzhou164 avatar yuzhou164 commented on July 17, 2024 8

nvdiffrast.zip
Hi, This ZIP package includes a dockerfile with requirement.txt for this Deep3DFaceRecon_pytorch project.
The command to build the environment is docker build -f docker/Dockerfile -t name:tagname .
One thing needs attention is that the version correspondence between version Cuda and version Nvidia Driver . Please refers the Nvidia website

from deep3dfacerecon_pytorch.

Walterkd avatar Walterkd commented on July 17, 2024 8

Solution

Replace all dr.RasterizeGLContext to dr.RasterizeCudaContext

from deep3dfacerecon_pytorch.

YuDeng avatar YuDeng commented on July 17, 2024 6

Hi, the problem seems to be caused by some OpenGL related libraries required by nvdiffrast. Could you try to follow the Dockerfile provided by nvdiffrast to install the dependencies and re-install nvdiffrast to see if it works?

from deep3dfacerecon_pytorch.

yuzhou164 avatar yuzhou164 commented on July 17, 2024 5

Thank for your answering, the problem has been solved. I can close this issue.

from deep3dfacerecon_pytorch.

haoxurt avatar haoxurt commented on July 17, 2024 3

@YuDeng Hi, I also encountered [F glutil.cpp:338] eglInitialize() failed Aborted . My system is centos. DId you run the code in the centos? CentOS is reportedly problematic when using nvdiffrast.

from deep3dfacerecon_pytorch.

YuDeng avatar YuDeng commented on July 17, 2024

Hi, glad to hear that you have solved the issue. Could you post the extra dependencies you have installed?
We can add them to our installation instruction and help newcomers to build the environment from scratch.

from deep3dfacerecon_pytorch.

YuDeng avatar YuDeng commented on July 17, 2024

Okay. Thanks for your kind reply.

from deep3dfacerecon_pytorch.

haoxurt avatar haoxurt commented on July 17, 2024

@yuzhou164 Hi, could you share your version Cuda and version Nvidia Drive?

from deep3dfacerecon_pytorch.

punkoffice avatar punkoffice commented on July 17, 2024

Do I have to run the docker environment? What is the command to do that? Sorry, I'm not an expert in docker. If I just build it then try to run the test.py script I still get the egInitialize() failed error

from deep3dfacerecon_pytorch.

NewtOliver avatar NewtOliver commented on July 17, 2024

您好,我也遇到了egInitialize() failed的错误,按照上述的办法并未解决,请问有什么好方法吗?
image

我的Linux环境:
cudnn:8.6
cuda:11.3
python:3.7
pytorch:1.9.0

from deep3dfacerecon_pytorch.

liiffz avatar liiffz commented on July 17, 2024

I also encounter this problem when I run the code on our lab server. And that because the server missing some Nvidia drivers. Try to install the missing packages or just reinstall the whole driver.
You can see:
https://github.com/NVlabs/nvdiffrast/issues/51#issuecomment-954275825
https://github.com/NVlabs/nvdiffrast/issues/56#issuecomment-983690874
https://github.com/NVlabs/nvdiffrast/issues/24#issuecomment-824702760

from deep3dfacerecon_pytorch.

Rodger-Huang avatar Rodger-Huang commented on July 17, 2024

According to NVlabs/nvdiffrast#56 (comment), I successfully resolve this problem by reinstalling the NVIDIA driver without -no-opengl-files.

from deep3dfacerecon_pytorch.

ChenVoid avatar ChenVoid commented on July 17, 2024

nvdiffrast.zip Hi, This ZIP package includes a dockerfile with requirement.txt for this Deep3DFaceRecon_pytorch project. The command to build the environment is docker build -f docker/Dockerfile -t name:tagname . One thing needs attention is that the version correspondence between version Cuda and version Nvidia Driver . Please refers the Nvidia website

Hi,May i ask that how to use the command of 'docker'?

from deep3dfacerecon_pytorch.

ChenVoid avatar ChenVoid commented on July 17, 2024

According to NVlabs/nvdiffrast#56 (comment), I successfully resolve this problem by reinstalling the NVIDIA driver without -no-opengl-files.

May i ask how to reinstall the NVIDIA driver without -no-opengl-files? Could u provide more details?
Looking forward to your assistance!

from deep3dfacerecon_pytorch.

Rodger-Huang avatar Rodger-Huang commented on July 17, 2024

According to NVlabs/nvdiffrast#56 (comment), I successfully resolve this problem by reinstalling the NVIDIA driver without -no-opengl-files.

May i ask how to reinstall the NVIDIA driver without -no-opengl-files? Could u provide more details? Looking forward to your assistance!

Hi, I downloaded the corresponding Nvidia Driver from https://www.nvidia.cn/Download/index.aspx?lang=cn and installed it without -no-opengl-files in my device.

from deep3dfacerecon_pytorch.

ChenVoid avatar ChenVoid commented on July 17, 2024

According to NVlabs/nvdiffrast#56 (comment), I successfully resolve this problem by reinstalling the NVIDIA driver without -no-opengl-files.

May i ask how to reinstall the NVIDIA driver without -no-opengl-files? Could u provide more details? Looking forward to your assistance!

Hi, I downloaded the corresponding Nvidia Driver from https://www.nvidia.cn/Download/index.aspx?lang=cn and installed it without -no-opengl-files in my device.

Very glad to receive your sincere reply.
EXM, i'm a newcomer on it. Could u explain more about how to "installed it without -no-opengl-files in my device."? Is there some tutorial for reinstalling Nvidia about it?
Thx.

from deep3dfacerecon_pytorch.

Rodger-Huang avatar Rodger-Huang commented on July 17, 2024

@ChenVoid, this blog (https://blog.csdn.net/weixin_43925119/article/details/109808670) may help you. When installing the Nvidia Driver, I changed the command "sudo ./NVIDIA-Linux-x86_64-430.14.run -no-x-check -no-nouveau-check -no-opengl-files" to "sudo ./NVIDIA-Linux-x86_64-430.14.run".

from deep3dfacerecon_pytorch.

ChenVoid avatar ChenVoid commented on July 17, 2024

@Rodger-Huang, thanks for your reply.
By the way, do i need to re-install CUDA, Anaconda or PyTorch after reinstalling the Nvidia driver?

from deep3dfacerecon_pytorch.

SunYangtian avatar SunYangtian commented on July 17, 2024

@YuDeng hello, I also encounter [F glutil.cpp:338] eglInitialize() failed when running the inference code. My system environment is nvidia driver 450.80.02 and cuda 11.0. I already have a basic pytorch environment so only install OpenGL related libraries in my system environment (not docker environment) as suggested above. Specifically, I did the following steps:

  1. I organize the contents of the dockerfile (provided by @yuzhou164) into an environment.sh:
apt-get update && apt-get install -y --no-install-recommends \
    pkg-config \
    libglvnd0 \
    libgl1 \
    libglx0 \
    libegl1 \
    libgles2 \
    libglvnd-dev \
    libgl1-mesa-dev \
    libegl1-mesa-dev \
    libgles2-mesa-dev \
    cmake \
    curl \
    libsm6 \
    libxext6 \
    libxrender-dev

# export PYTHONDONTWRITEBYTECODE=1
export PYTHONUNBUFFERED=1

# for GLEW
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH

# nvidia-container-runtime
export NVIDIA_VISIBLE_DEVICES=all
export NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics

# Default pyopengl to EGL for good headless rendering support
export PYOPENGL_PLATFORM=egl

cp docker/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json

pip install --upgrade pip
pip install ninja imageio imageio-ffmpeg
  1. Run this environment.sh:
sudo bash environment.sh
  1. Re-install nvdiffrast:
cd nvdiffrast    # ./Deep3DFaceRecon_pytorch/nvdiffrast
pip install .

I want to know if it is really caused by the nvidia driver version or some other problems. Looking forward to your reply.

The same problem came across to me. It seems that the use of a low version OpenGL (specifically, Mesa instead of Nvidia) caused this error.

from deep3dfacerecon_pytorch.

duongminhhieu16 avatar duongminhhieu16 commented on July 17, 2024

@SunYangtian Could you explain more? The previous solution is not working because I don't have permission to reinstall the nvidia driver.

from deep3dfacerecon_pytorch.

sicxu avatar sicxu commented on July 17, 2024

Following #108, we have updated the code and README to support CUDA context. For someone having trouble installing OpenGL, you may try to add "--use_opengl False" to the script to switch to using CUDA context.

from deep3dfacerecon_pytorch.

lydonchandra avatar lydonchandra commented on July 17, 2024

Solution

Replace all dr.RasterizeGLContext to dr.RasterizeCudaContext

Thank you, confirmed this worked for me too.

from deep3dfacerecon_pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.