Segmentation Fault, Core Dumped, Using Ubuntu 16.04 or 18.04, inside and outside Docker [steps to reproduce]

Hello! Here are my attempts at installing SoftGym.
Contents:

Background
Creating Conda Environment
Entering Docker and Adjusting Paths
Compiling PyFlex in Docker
Using the Compiled Code
Ubuntu 16.04 tests
Running inside Docker container, for both Ubuntu 16.04 and 18.04

Background
I have an Ubuntu 18.04 machine and I am attempting to get softgym to work. The machine has CUDA 10.0:
seita@mason:~ $ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

My directory structure is like this: conda environments are installed in /home/seita/miniconda3/ (I use miniconda) and softgym is cloned to /home/seita/softgym/. I am following these instructions in parallel:

https://github.com/Xingyu-Lin/softgym/blob/master/docker/docker.md
https://github.com/FranBesq/softgym/blob/master/docker/docker.md
https://github.com/Xingyu-Lin/softgym/issues/5  [Issue report with same error as me]

To start, after cloning a fresh copy of the repository, let's pull the docker image and make sure I have things updated. Here's what the output looks like:
seita@mason:~/softgym (master) $ docker pull xingyu/softgym
Using default tag: latest
latest: Pulling from xingyu/softgym
Digest: sha256:29a9f674cf3527e645a237facdfe4b5634c23cd0f1522290e0a523308435ccaa
Status: Image is up to date for xingyu/softgym:latest
docker.io/xingyu/softgym:latest
seita@mason:~/softgym (master) $ docker -v
Docker version 19.03.6, build 369ce74a3c
seita@mason:~/softgym (master) $ nvidia-docker -v
Docker version 19.03.6, build 369ce74a3c
seita@mason:~/softgym (master) $ docker images
REPOSITORY                TAG                             IMAGE ID            CREATED             SIZE
xingyu/softgym            latest                          2cbcd6a50965        3 months ago        2.44GB

Remark: I have a .bashrc setting that tells me the branch of a repo in parentheses, so it says (master) right after the "softgym" text in the command line.
Creating the Conda Environment
First before entering docker, I create the conda environment. The instructions in this fork suggest making the conda environment inside docker, however what that does is it will make the conda environment created by the root user and thus I won't be able to run conda install <xyz> commands outside of docker. In addition, installing it the way the README suggests will get the package versions set up correctly:
seita@mason:~/softgym (master) $ conda env create -f environment.yml
Warning: you have pip-installed dependencies in your environment file, but you do not list pip itself as one of your conda dependencies.  Conda may not use the correct pip to install your packages, and they may end up in the wrong place.  Please add an explicit pip dependency.  I'm adding one for you, but still nagging you.
Collecting package metadata (repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
  current version: 4.7.12
  latest version: 4.9.2

Please update conda by running

    $ conda update -n base -c defaults conda

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Ran pip subprocess with arguments:
['/home/seita/miniconda3/envs/softgym/bin/python', '-m', 'pip', 'install', '-U', '-r', '/home/seita/softgym/condaenv._19qblqw.requirements.txt']
Pip subprocess output:
Collecting gym==0.14.0
  Using cached gym-0.14.0-py3-none-any.whl
Requirement already satisfied: six in /home/seita/.local/lib/python3.6/site-packages (from gym==0.14.0->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 2)) (1.12.0)
Requirement already satisfied: numpy>=1.10.4 in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from gym==0.14.0->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 2)) (1.17.2)
Collecting opencv-python==<IP_ADDRESS>
  Using cached opencv_python-<IP_ADDRESS>-cp36-cp36m-manylinux1_x86_64.whl (28.7 MB)
Collecting pyquaternion==0.9.5
  Using cached pyquaternion-0.9.5-py3-none-any.whl (14 kB)
Collecting Shapely==1.6.4.post2
  Using cached Shapely-1.6.4.post2-cp36-cp36m-manylinux1_x86_64.whl (1.5 MB)
Collecting sk-video==1.1.10
  Using cached sk_video-1.1.10-py2.py3-none-any.whl (2.3 MB)
Collecting cloudpickle~=1.2.0
  Using cached cloudpickle-1.2.2-py2.py3-none-any.whl (25 kB)
Collecting pyglet<=1.3.2,>=1.2.0
  Using cached pyglet-1.3.2-py2.py3-none-any.whl (1.0 MB)
Collecting gtimer
  Using cached gtimer-1.0.0b5-py3-none-any.whl
Collecting moviepy
  Using cached moviepy-1.0.3-py3-none-any.whl
Requirement already satisfied: imageio<3.0,>=2.5 in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from moviepy->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 3)) (2.6.1)
Requirement already satisfied: decorator<5.0,>=4.0.2 in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from moviepy->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 3)) (4.4.2)
Requirement already satisfied: requests<3.0,>=2.8.1 in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from moviepy->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 3)) (2.25.1)
Requirement already satisfied: pillow in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from imageio<3.0,>=2.5->moviepy->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 3)) (6.1.0)
Collecting imageio-ffmpeg>=0.2.0
  Using cached imageio_ffmpeg-0.4.3-py3-none-manylinux2010_x86_64.whl (26.9 MB)
Collecting proglog<=1.0.0
  Using cached proglog-0.1.9-py3-none-any.whl
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from requests<3.0,>=2.8.1->moviepy->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 3)) (1.26.3)
Requirement already satisfied: chardet<5,>=3.0.2 in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from requests<3.0,>=2.8.1->moviepy->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 3)) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from requests<3.0,>=2.8.1->moviepy->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 3)) (2020.12.5)
Requirement already satisfied: idna<3,>=2.5 in /home/seita/miniconda3/envs/softgym/lib/python3.6/site-packages (from requests<3.0,>=2.8.1->moviepy->-r /home/seita/softgym/condaenv._19qblqw.requirements.txt (line 3)) (2.10)
Collecting tqdm<5.0,>=4.11.2
  Using cached tqdm-4.56.2-py2.py3-none-any.whl (72 kB)
Collecting future
  Using cached future-0.18.2-cp36-none-any.whl
Collecting scipy
  Using cached scipy-1.5.4-cp36-cp36m-manylinux1_x86_64.whl (25.9 MB)
Installing collected packages: tqdm, future, scipy, pyglet, proglog, imageio-ffmpeg, cloudpickle, sk-video, Shapely, pyquaternion, opencv-python, moviepy, gym, gtimer
Successfully installed Shapely-1.6.4.post2 cloudpickle-1.2.2 future-0.18.2 gtimer-1.0.0b5 gym-0.14.0 imageio-ffmpeg-0.4.3 moviepy-1.0.3 opencv-python-<IP_ADDRESS> proglog-0.1.9 pyglet-1.3.2 pyquaternion-0.9.5 scipy-1.5.4 sk-video-1.1.10 tqdm-4.56.2

#
# To activate this environment, use
#
#     $ conda activate softgym
#
# To deactivate an active environment, use
#
#     $ conda deactivate

seita@mason:~/softgym (master) $

Now that environment is saved in /home/seita/miniconda3/envs/softgym/
Entering Docker and Adjusting Paths
Next, let's go into docker to compile PyFlex. That is the only reason to use Docker.  So inside docker, I can change directory to /workspace/softgym and it will look like as if I am inside /home/seita/softgym. A similar thing happens with the second mounting command for miniconda. In fact I'm using the same exact directory before and after the colon, which means the directory structure is the same inside docker. The other commands are just copied from what you have.
Running the command means I am in a docker container as a "root" user. I go to the softgym directory. Next the current README here just says I need to adjust the PATH variable, and then run a prepare_1.0.sh script. This other reference  omits the prepare_1.0.sh script by just manually performing the same commands by adjusting  PYFLEXROOT, PYTHONPATH, and LD_LIBRARY_PATH. Here are the environment variables at the beginning when I enter docker:
root@a230c50ebe44:/workspace# cd softgym/
root@a230c50ebe44:/workspace/softgym# echo $PATH
/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root@a230c50ebe44:/workspace/softgym# echo $PYFLEXROOT

root@a230c50ebe44:/workspace/softgym# echo $PYTHONPATH

root@a230c50ebe44:/workspace/softgym# echo $LD_LIBRARY_PATH
/usr/local/nvidia/lib:/usr/local/nvidia/lib64

Now let's follow the current README and adjust the path, then run the prepare script which will assign to three environment variables. The prepare script also activates the softgym conda environment that we created earlier outside of docker. We need to adjust the path so that the . activate softgym command will work:
root@a230c50ebe44:/workspace/softgym# export PATH="/home/seita/miniconda3/bin:$PATH"
root@a230c50ebe44:/workspace/softgym# . ./prepare_1.0.sh
(softgym) root@a230c50ebe44:/workspace/softgym#

Now we see that we are in the softgym conda environment, and furthermore, that the environment variables are updated:
(softgym) root@a230c50ebe44:/workspace/softgym# echo $PATH
/home/seita/miniconda3/envs/softgym/bin:/home/seita/miniconda3/condabin:/home/seita/miniconda3/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
(softgym) root@a230c50ebe44:/workspace/softgym# echo $PYFLEXROOT
/workspace/softgym/PyFlex
(softgym) root@a230c50ebe44:/workspace/softgym# echo $PYTHONPATH
/workspace/softgym/PyFlex/bindings/build:
(softgym) root@a230c50ebe44:/workspace/softgym#  echo $LD_LIBRARY_PATH
/workspace/softgym/PyFlex/external/SDL2-2.0.4/lib/x64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
(softgym) root@a230c50ebe44:/workspace/softgym#

Now we have to install the pybind11 package as stated in the README [output omitted as it's pretty standard]:
(softgym) root@a230c50ebe44:/workspace/softgym# conda install pybind11

Compiling PyFlex in Docker
Now let's try to compile PyFlex. The current instructions in this repo say to do this: . ./prepare_1.0.sh && ./compile_1.0.sh. We've already done the first, let's do the second part to compile, and I could have merged the commands together by doing conda install pybind11 outside of docker.
(softgym) root@a230c50ebe44:/workspace/softgym# ./compile_1.0.sh
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found suitable version "9.2", minimum required is "9.0")
-- Found PythonInterp: /home/seita/miniconda3/envs/softgym/bin/python3.6 (found suitable version "3.6.12", minimum required is "3.6")
-- Found PythonLibs: /home/seita/miniconda3/envs/softgym/lib/libpython3.6m.so
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /workspace/softgym/PyFlex/bindings/build
Scanning dependencies of target pyflex
[  5%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/pfm.cpp.o
[ 10%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/maths.cpp.o
[ 15%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/core.cpp.o
[ 21%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/voxelize.cpp.o
[ 26%] Building CXX object CMakeFiles/pyflex.dir/pyflex.cpp.o
[ 36%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/sdf.cpp.o
[ 36%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/mesh.cpp.o
[ 47%] Building CXX object CMakeFiles/pyflex.dir/imgui.cpp.o
[ 47%] Building CXX object CMakeFiles/pyflex.dir/opengl/imguiRenderGL.cpp.o
[ 57%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/png.cpp.o
[ 57%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/tga.cpp.o
[ 63%] Building CXX object CMakeFiles/pyflex.dir/opengl/shadersGL.cpp.o
[ 68%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/aabbtree.cpp.o
[ 78%] Building CXX object CMakeFiles/pyflex.dir/opengl/shader.cpp.o
[ 78%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/extrude.cpp.o
[ 84%] Building CXX object CMakeFiles/pyflex.dir/shadersDemoContext.cpp.o
[ 89%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/platform.cpp.o
[ 94%] Building CXX object CMakeFiles/pyflex.dir/workspace/softgym/PyFlex/core/perlin.cpp.o
In file included from /usr/include/c++/7/cassert:44:0,
                 from /workspace/softgym/PyFlex/core/quat.h:30,
                 from /workspace/softgym/PyFlex/core/maths.h:241,
                 from /workspace/softgym/PyFlex/core/aabbtree.h:31,
                 from /workspace/softgym/PyFlex/core/aabbtree.cpp:28:
/workspace/softgym/PyFlex/core/aabbtree.cpp: In member function 'void AABBTree::Build()':
/workspace/softgym/PyFlex/core/aabbtree.cpp:136:22: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
     assert(m_numFaces*3);
            ~~~~~~~~~~^~
/workspace/softgym/PyFlex/core/mesh.cpp: In function 'void ExportToObj(const char*, const Mesh&)':
/workspace/softgym/PyFlex/core/mesh.cpp:601:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (!file)
     ^~
/workspace/softgym/PyFlex/core/mesh.cpp:604:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  file << "# positions" << endl;
  ^~~~
/workspace/softgym/PyFlex/bindings/opengl/shadersGL.cpp: In function 'GLuint LoadTexture(const char*)':
/workspace/softgym/PyFlex/bindings/opengl/shadersGL.cpp:212:16: warning: converting to non-pointer type 'GLuint {aka unsigned int}' from NULL [-Wconversion-null]
         return NULL;
                ^~~~
/workspace/softgym/PyFlex/bindings/opengl/shadersGL.cpp: In function 'void InitRenderHeadless(const RenderInitOptions&, int, int)':
/workspace/softgym/PyFlex/bindings/opengl/shadersGL.cpp:3386:25: warning: invalid conversion from 'EGLConfig {aka void*}' to 'void**' [-fpermissive]
  g_eglConfig = configs[0];
                ~~~~~~~~~^
/workspace/softgym/PyFlex/bindings/opengl/shadersGL.cpp:3390:33: warning: invalid conversion from 'EGLContext {aka void*}' to 'void**' [-fpermissive]
  g_eglContext = eglCreateContext(
                 ~~~~~~~~~~~~~~~~^
           g_eglDisplay,
           ~~~~~~~~~~~~~
           g_eglConfig,
           ~~~~~~~~~~~~
           EGL_NO_CONTEXT,
           ~~~~~~~~~~~~~~~
           NULL);
           ~~~~~
/workspace/softgym/PyFlex/bindings/opengl/shadersGL.cpp:3398:40: warning: invalid conversion from 'EGLSurface {aka void*}' to 'void**' [-fpermissive]
  g_eglSurface = eglCreatePbufferSurface(g_eglDisplay, g_eglConfig,
                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
            eglPBAttribs);
            ~~~~~~~~~~~~~
/workspace/softgym/PyFlex/bindings/opengl/shadersGL.cpp: At global scope:
/workspace/softgym/PyFlex/bindings/opengl/shadersGL.cpp:248:13: warning: '{anonymous}::g_eglDisplay' defined but not used [-Wunused-variable]
 EGLDisplay* g_eglDisplay;
             ^~~~~~~~~~~~
In file included from /workspace/softgym/PyFlex/bindings/pyflex.cpp:1:0:
/workspace/softgym/PyFlex/bindings/main.cpp: In function 'int GetKeyFromGameControllerButton(SDL_GameControllerButton)':
/workspace/softgym/PyFlex/bindings/main.cpp:84:9: warning: case value '17' not in enumerated type 'SDL_GameControllerButton' [-Wswitch]
         case SDL_CONTROLLER_BUTTON_RIGHT_TRIGGER: {
         ^~~~
In file included from /workspace/softgym/PyFlex/bindings/scenes.h:30:0,
                 from /workspace/softgym/PyFlex/bindings/main.cpp:587,
                 from /workspace/softgym/PyFlex/bindings/pyflex.cpp:1:
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_cloth.h: In member function 'virtual void SoftgymCloth::Initialize(pybind11::array_t<float>, int)':
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_cloth.h:63:14: warning: unused variable 'size' [-Wunused-variable]
          int size = g_buffers->triangles.size();
              ^~~~
In file included from /workspace/softgym/PyFlex/bindings/scenes.h:31:0,
                 from /workspace/softgym/PyFlex/bindings/main.cpp:587,
                 from /workspace/softgym/PyFlex/bindings/pyflex.cpp:1:
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_fluid.h: In member function 'virtual void SoftgymFluid::Initialize(pybind11::array_t<float>, int)':
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_fluid.h:43:9: warning: unused variable 'surfaceTension' [-Wunused-variable]
   float surfaceTension = ptr[4];
         ^~~~~~~~~~~~~~
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_fluid.h:44:9: warning: unused variable 'adhesion' [-Wunused-variable]
   float adhesion = ptr[5];
         ^~~~~~~~
In file included from /workspace/softgym/PyFlex/bindings/scenes.h:32:0,
                 from /workspace/softgym/PyFlex/bindings/main.cpp:587,
                 from /workspace/softgym/PyFlex/bindings/pyflex.cpp:1:
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_softbody.h: In member function 'void SoftgymSoftBody::CreateSoftBody(SoftgymSoftBody::Instance, int)':
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_softbody.h:202:10: warning: unused variable 'createStart' [-Wunused-variable]
   double createStart = GetSeconds();
          ^~~~~~~~~~~
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_softbody.h:222:10: warning: unused variable 'createEnd' [-Wunused-variable]
   double createEnd = GetSeconds();
          ^~~~~~~~~
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_softbody.h:233:10: warning: unused variable 'skinStart' [-Wunused-variable]
   double skinStart = GetSeconds();
          ^~~~~~~~~
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_softbody.h:245:10: warning: unused variable 'skinEnd' [-Wunused-variable]
   double skinEnd = GetSeconds();
          ^~~~~~~
In file included from /workspace/softgym/PyFlex/bindings/scenes.h:33:0,
                 from /workspace/softgym/PyFlex/bindings/main.cpp:587,
                 from /workspace/softgym/PyFlex/bindings/pyflex.cpp:1:
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_rigid_cloth.h: In member function 'virtual void SoftgymRigidCloth::Initialize(pybind11::array_t<float>, int)':
/workspace/softgym/PyFlex/bindings/softgym_scenes/softgym_rigid_cloth.h:72:60: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i=int(g_mesh->GetNumVertices()*0.6); i<g_mesh->GetNumVertices(); ++i)
                                                           ~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /workspace/softgym/PyFlex/bindings/scenes.h:80:0,
                 from /workspace/softgym/PyFlex/bindings/main.cpp:587,
                 from /workspace/softgym/PyFlex/bindings/pyflex.cpp:1:
/workspace/softgym/PyFlex/bindings/scenes/shapechannels.h: In member function 'void ShapeChannels::Initialize()':
/workspace/softgym/PyFlex/bindings/scenes/shapechannels.h:26:108: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
    AddBox(Vec3(0.5f, 0.1f, 0.5f), Vec3(0.0f, 0.5f + i*0.5f, 0.0f), Quat(), false, eNvFlexPhaseShapeChannel0<<i);
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
[100%] Linking CXX shared module pyflex.cpython-36m-x86_64-linux-gnu.so
[100%] Built target pyflex

This looks like it proceeded well, and outside docker I can see the Pyflex compiled module in softgym/PyFlex/bindings/build/.
Note: upon re-reading this post, I actually realize there is a slight typo, I did ./compile_1.0.sh instead of . ./compile_1.0.sh with the leading period. However I don't think this affects things and I re-did it with the period there and it gave the same output.
Using the Compiled Code
Now we are outside of docker.  I refresh via the . ~/.bashrc,  activate the same conda environment and attempt to run an example:
(softgym) seita@mason:~/softgym (master) $ python examples/random_env.py --env_name ClothFlatten
Traceback (most recent call last):
  File "examples/random_env.py", line 5, in <module>
    from softgym.registered_env import env_arg_dict, SOFTGYM_ENVS
ModuleNotFoundError: No module named 'softgym'

Normally since this is the name of the package, I would expect to be able to do pip install -e . or somewthere, but there is no setup.py file so that must not be the issue. Following the other linked references at the top, perhaps we have to refresh the environment variables? Here's what I had before:
(softgym) seita@mason:~/softgym (master) $ echo $PATH
/home/seita/miniconda3/envs/softgym/bin:/home/seita/.local/bin:/home/seita/miniconda3/condabin:/home/seita/blender-2.82a-linux64:/usr/local/cuda/bin:/home/seita/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
(softgym) seita@mason:~/softgym (master) $ echo $PYTHONPATH

(softgym) seita@mason:~/softgym (master) $ echo $PYFLEXROOT

(softgym) seita@mason:~/softgym (master) $ echo $LD_LIBRARY_PATH
/usr/local/cuda/lib64::/home/seita/.mujoco/mujoco200/bin

Then I update them, but then that leads to a segmentation fault.
(softgym) seita@mason:~/softgym (master) $ export PYFLEXROOT=${PWD}/PyFlex
(softgym) seita@mason:~/softgym (master) $ export PYTHONPATH=${PYFLEXROOT}/bindings/build:$PYTHONPATH
(softgym) seita@mason:~/softgym (master) $ export LD_LIBRARY_PATH=${PYFLEXROOT}/external/SDL2-2.0.4/lib/x64:$LD_LIBRARY_PATH
(softgym) seita@mason:~/softgym (master) $ python examples/random_env.py --env_name ClothFlatten
Waiting to generate environment variations. May take 1 minute for each variation...
Unable to initialize SDLCould not initialize GL extensions
Reshaping
Segmentation fault (core dumped)
(softgym) seita@mason:~/softgym (master) $

So now I am not sure how to proceed. The libraries seem to be installed:
(softgym) seita@mason:~/softgym (master) $ (dpkg-query -W -f='${Status}' libglfw3 2>/dev/null | grep -c "ok installed")
1
(softgym) seita@mason:~/softgym (master) $ (dpkg-query -W -f='${Status}' libgles2-mesa-dev 2>/dev/null | grep -c "ok installed")
1
(softgym) seita@mason:~/softgym (master) $

(using the one-liner solution to check if a package is installed or not)
@Xingyu-Lin @yufeiwang63  If any of you two have time to reproduce this setup I am wondering how you managed to get around the segmentation fault? I know it might take a while but I wonder if any of you are able to start with a "clean" machine and then go through the full installation steps to get it working?

Follow-up on Ubuntu 16.04 Machine
I tried to reproduce all the instructions above, on an Ubuntu 16.04 machine instead of an Ubuntu 18.04 machine. I followed all the steps the same way as above, however this time there is a slightly different error. After compiling PyFlex and exiting Docker, I activate the softgym env and need to again refresh the environment variables (please let me know if this is not what you do):
seita@triton1:~/softgym (master) $ conda activate softgym
(softgym) seita@triton1:~/softgym (master) $ python examples/random_env.py --env_name ClothFlatten
Traceback (most recent call last):
  File "examples/random_env.py", line 5, in <module>
    from softgym.registered_env import env_arg_dict, SOFTGYM_ENVS
ModuleNotFoundError: No module named 'softgym'
(softgym) seita@triton1:~/softgym (master) $ export PYFLEXROOT=${PWD}/PyFlex
(softgym) seita@triton1:~/softgym (master) $ export PYTHONPATH=${PYFLEXROOT}/bindings/build:$PYTHONPATH
(softgym) seita@triton1:~/softgym (master) $ export LD_LIBRARY_PATH=${PYFLEXROOT}/external/SDL2-2.0.4/lib/x64:$LD_LIBRARY_PATH

Then I run but now there is a GLIBC error:
(softgym) seita@triton1:~/softgym (master) $ python examples/random_env.py --env_name ClothFlatten
Traceback (most recent call last):
  File "examples/random_env.py", line 5, in <module>
    from softgym.registered_env import env_arg_dict, SOFTGYM_ENVS
  File "/home/seita/softgym/softgym/registered_env.py", line 1, in <module>
    from softgym.envs.pour_water import PourWaterPosControlEnv
  File "/home/seita/softgym/softgym/envs/pour_water.py", line 4, in <module>
    import pyflex
ImportError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /home/seita/softgym/PyFlex/bindings/build/pyflex.cpython-36m-x86_64-linux-gnu.so)
(softgym) seita@triton1:~/softgym (master) $ ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu11.2) 2.23
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
(softgym) seita@triton1:~/softgym (master) $

It's version 2.23 on this machine, whereas the Ubuntu 18 version in my post above has the correct 2.27 version. However, according to this:
https://stackoverflow.com/questions/59145051/glibc-2-27-not-found-ubuntu-16-04
in Ubuntu 16.04, this is the correct version, and upgrading it can be very tricky and not straightforward. In fact, the answer there even seems to suggest to switch to Ubuntu 18.04, which confuses me even more since I believe Ubuntu 16.04 is what you are normally testing with.
Does this issue make sense?

Running inside Docker (instead of Outside)
For both methods above, I attempted to see what happens when running inside docker, rather than outside. It seems like it fails on both Ubuntu 18.04:
(softgym) root@a230c50ebe44:/workspace/softgym# python examples/random_env.py --env_name PassWater
Waiting to generate environment variations. May take 1 minute for each variation...
Unable to initialize SDLCould not initialize GL extensions
Reshaping
Segmentation fault (core dumped)
(softgym) root@a230c50ebe44:/workspace/softgym#

and 16.04 (for clarity here I'm showing the pyflex folder first, then changing directory a bit, then running an example:
(softgym) root@c7225cc8bb31:/workspace/softgym/PyFlex/bindings/build# ls -lh
total 13M
-rw-r--r-- 1 root root  24K Feb 12 22:55 CMakeCache.txt
drwxr-xr-x 5 root root 4.0K Feb 12 22:55 CMakeFiles
-rw-r--r-- 1 root root  24K Feb 12 22:55 Makefile
-rw-r--r-- 1 root root 1.5K Feb 12 22:55 cmake_install.cmake
-rwxr-xr-x 1 root root  13M Feb 12 22:55 pyflex.cpython-36m-x86_64-linux-gnu.so
(softgym) root@c7225cc8bb31:/workspace/softgym/PyFlex/bindings/build# cd ../../..
(softgym) root@c7225cc8bb31:/workspace/softgym#
(softgym) root@c7225cc8bb31:/workspace/softgym#
(softgym) root@c7225cc8bb31:/workspace/softgym# python examples/random_env.py --env_name PassWater
Waiting to generate environment variations. May take 1 minute for each variation...
Unable to initialize SDLCould not initialize GL extensions
Reshaping
Segmentation fault (core dumped)

Interestingly, for the 16.04 machine, running inside Docker will not produce the "GLIBC" error that appears when running outside Dockder.

@DanielTakeshi, For approach 1, I have seen this segmentation fault a long time ago. One solution that worked for me was to re-install Nvidia driver version 440.64 (The sub-version also matters). Can you try that? Also, I am currently using cuda 10.2, although I don't think this matters.

The other issue with GLIBC makes sense to me: The docker image is built under ubuntu 18. If you compile inside a ubuntu 18 docker and try to use the .so object out side in a ubuntu 16 system, it will give an error. You can either try ubuntu 16 without the docker, or rebuild the docker image under ubuntu 16. For rebuilding the docker, you can find the docker recipe here and just change the first line to be ubuntu 16.

Attempt 4: Installing Ubuntu 16.04 entirely outside of Dockder
@Xingyu-Lin  Thanks for the suggestions. Here I am trying to install without using Docker at all. This machine has a close driver version, version 440 (but a different subversion). It does not have the same exact sub-version that you suggest but unfortunately I need to first check in with other users first since it's a shared lab machine. Here are details of NVIDIA:
seita@triton3:~$ nvidia-smi
Sun Feb 14 07:59:41 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01    Driver Version: 440.33.01    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  TITAN Xp            Off  | 00000000:01:00.0 Off |                  N/A |
| 62%   86C    P2   103W / 250W |   9356MiB / 12188MiB |     87%      Default |
+-------------------------------+----------------------+----------------------+
|   1  TITAN Xp            Off  | 00000000:02:00.0 Off |                  N/A |
| 51%   82C    P2   150W / 250W |   2238MiB / 12196MiB |     49%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1572      G   /usr/lib/xorg/Xorg                            49MiB |
|    0      4625      C   python                                      4501MiB |
|    0     13683      C   ...sup_rbt_train_quat.py -dataset 872objv2  4793MiB |
|    1     16940      C   ...sup_rbt_train_quat.py -dataset 872objv2  2225MiB |
+-----------------------------------------------------------------------------+

I follow the steps:
git clone https://github.com/Xingyu-Lin/softgym.git
cd softgym/
conda env create -f environment.yml
conda activate softgym
. ./prepare_1.0.sh
. ./compile_1.0.sh
cd ../../..

All the above seems to work (though prepare_1.0.sh script has un-necessary . activate softgym, since I activate beforehand, since it throws an error if I don't activate the env first). Then I get:
(softgym) seita@triton3:~/softgym$ python examples/random_env.py --env_name PassWater
Waiting to generate environment variations. May take 1 minute for each variation...
Unable to initialize SDLCould not initialize GL extensions
Reshaping
Segmentation fault (core dumped)

Same error. I will try again if I can get the exact NVIDIA driver version ready, so 440.33 should turn into 440.64? Also does it matter that this is done remotely through ssh connections?

hmmm acutally I am using the driver of the exact version 440.33.01
(base) yufei@yufei-OMEN-by-HP-Laptop:~$ nvidia-smi
Mon Feb 15 00:20:22 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01    Driver Version: 440.33.01    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 960M    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   48C    P8    N/A /  N/A |    925MiB /  2002MiB |      3%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1140      G   /usr/lib/xorg/Xorg                           341MiB |
|    0      2213      G   compiz                                        37MiB |
|    0      2285      G   fcitx-qimpanel                                 4MiB |
|    0      2883      G   ...quest-channel-token=2700618523479150890   222MiB |
|    0      3953      G   ...quest-channel-token=4260863179945314425    44MiB |
|    0      4805      G   ...quest-channel-token=1622710122323873953   264MiB |
+-----------------------------------------------------------------------------+

but I am using a different nvcc (version 9.2):
(base) yufei@yufei-OMEN-by-HP-Laptop:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Tue_Jun_12_23:07:04_CDT_2018
Cuda compilation tools, release 9.2, V9.2.148

We ran into this SDL initialization problem a long time ago. I will try to remember more details on how we solved it. But perhaps you could give it a try to change the nvcc version?

I see, thanks for checking. The machine in my last past does not have CUDA 9.2 and I will need to check in with other users to make sure I can install it. I did try downgrading to 9.0 (the other version available) and get the same error:
(softgym) seita@triton3:~/softgym$ python examples/random_env.py --env_name PassWater
Waiting to generate environment variations. May take 1 minute for each variation...
Unable to initialize SDLCould not initialize GL extensions
Reshaping
Segmentation fault (core dumped)
(softgym) seita@triton3:~/softgym$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176
(softgym) seita@triton3:~/softgym$

So we know that for Ubuntu 16.04 with this nvidia driver, CUDA 9.0 and 10.0 are not working and maybe 9.2 will be once I can test it. :)

A few other suggestions based on how we debugged this issue:

If you are running on cluster, you don't have a display environment. Did you set headless to true when running the random_env.py example?
Run export LIBGL_DEBUG=verbose in the shell which can give you more information about GL during linking.
Inspect the compiled GL to see what happened: nm -D pyflex.cpython-36m-x86_64-linux-gnu.so | grep SDL_GL to see if all symbols are normal.
You can look at the C++ code by searching the error message Unable to initialize SDL and see what went wrong there

Also, you can install multiple CUDA version on ubuntu and set the environment variables to properly link to the CUDA version that you need. Hope that will help!

Earlier today installed SoftGym on a machine with Ubuntu 16.04 and CUDA 9.2 and NO Docker - It had CUDA 9.0 installed but got permission to purge it. Docker install with CUDA 9.0 apparently is not possible so had to upgrade. I guess the only contribution of this post is knowing the NO docker install also works with Driver Version: 396.37.
This is the output of nvidia-smi:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.37                 Driver Version: 396.37                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX TIT...  Off  | 00000000:01:00.0  On |                  N/A |
| 22%   34C    P8    15W / 250W |    205MiB / 12207MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1021      G   /usr/lib/xorg/Xorg                           145MiB |
|    0      1695      G   compiz                                        56MiB |
+-----------------------------------------------------------------------------+

I upgraded manually to Driver Version: 430 but after installing CUDA 9.2 using .deb package I got downgraded to Driver Version: 396.37.
nvcc --version | grep "release" | awk '{print $6}' | cut -c2- outputs: 9.2.148
To add on some of your questions from your last post:

Try to install 9.2 (alone or alongside other versions as mentioned before) and leave your driver version to be managed by .deb install package if possible.

If you can only do it remotely I would also worry about sudo reboot as it is needed after CUDA install. I am not sure how it works when done remotely.

PD: About the installation itself:
You metion:

I follow the steps:
git clone https://github.com/Xingyu-Lin/softgym.git
cd softgym/
conda env create -f environment.yml
conda activate softgym
. ./prepare_1.0.sh
. ./compile_1.0.sh
cd ../../..

This where my steps from history:
conda env create -f environment.yml
conda activate softgym
export PYFLEXROOT=${PWD}/PyFlex
export PYTHONPATH=${PYFLEXROOT}/bindings/build:$PYTHONPATH
export LD_LIBRARY_PATH=${PYFLEXROOT}/external/SDL2-2.0.4/lib/x64:$LD_LIBRARY_PATH
. ./compile_1.0.sh
cd ~/repos/softgym
python examples/random_env.py --env_name PassWater

The only problem I had was with environment.yml not finding some packages, so I had to install them using pip.
Hope this helps.

Attempt 5 (Success, on Ubuntu 18.04, compiling in Docker, run outside docker, CUDA 10.0)
So, apparently the headless option was all I needed on my Ubuntu 18.04 machine. I should have read through the random_env.py code carefully and tried that. To be clear, I followed the steps in my first post here which compiles on docker. Here are the machine specs:
(softgym) seita@mason:~/softgym (master) $ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130
(softgym) seita@mason:~/softgym (master) $ nvidia-smi
Wed Feb 17 09:28:29 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.102.04   Driver Version: 450.102.04   CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla V100-PCIE...  Off  | 00000000:04:00.0 Off |                    0 |
| N/A   32C    P0    27W / 250W |     33MiB / 32510MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  Tesla V100-PCIE...  Off  | 00000000:08:00.0 Off |                    0 |
| N/A   34C    P0    25W / 250W |     28MiB / 32510MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   2  Tesla V100-PCIE...  Off  | 00000000:09:00.0 Off |                    0 |
| N/A   37C    P0    28W / 250W |     28MiB / 32510MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   3  Tesla V100-PCIE...  Off  | 00000000:85:00.0 Off |                    0 |
| N/A   36C    P0    29W / 250W |     28MiB / 32510MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   4  Tesla V100-PCIE...  Off  | 00000000:89:00.0 Off |                    0 |
| N/A   33C    P0    25W / 250W |     28MiB / 32510MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     17055      G   /usr/lib/xorg/Xorg                 28MiB |
|    1   N/A  N/A     17055      G   /usr/lib/xorg/Xorg                 23MiB |
|    2   N/A  N/A     17055      G   /usr/lib/xorg/Xorg                 23MiB |
|    3   N/A  N/A     17055      G   /usr/lib/xorg/Xorg                 23MiB |
|    4   N/A  N/A     17055      G   /usr/lib/xorg/Xorg                 23MiB |
+-----------------------------------------------------------------------------+

I did the compilation in docker, and the symbols look good when I check outside of docker:
(softgym) seita@mason:~/softgym/PyFlex/bindings/build (master) $ ls -lh
total 13M
-rw-r--r-- 1 root root  24K Feb 17 09:21 CMakeCache.txt
drwxr-xr-x 5 root root 4.0K Feb 17 09:21 CMakeFiles
-rw-r--r-- 1 root root 1.5K Feb 17 09:21 cmake_install.cmake
-rw-r--r-- 1 root root  24K Feb 17 09:21 Makefile
-rwxr-xr-x 1 root root  13M Feb 17 09:21 pyflex.cpython-36m-x86_64-linux-gnu.so
(softgym) seita@mason:~/softgym/PyFlex/bindings/build (master) $ nm -D pyflex.cpython-36m-x86_64-linux-gnu.so | grep SDL_GL
00000000000c1be0 T SDL_GL_BindTexture
00000000000c28d0 T SDL_GL_CreateContext
00000000000c2950 T SDL_GL_DeleteContext
00000000000c28a0 T SDL_GL_ExtensionSupported
00000000000c28c0 T SDL_GL_GetAttribute
00000000000c2900 T SDL_GL_GetCurrentContext
00000000000c28f0 T SDL_GL_GetCurrentWindow
00000000000c2910 T SDL_GL_GetDrawableSize
00000000000c2880 T SDL_GL_GetProcAddress
00000000000c2930 T SDL_GL_GetSwapInterval
00000000000c2870 T SDL_GL_LoadLibrary
00000000000c28e0 T SDL_GL_MakeCurrent
00000000000c2980 T SDL_GL_ResetAttributes
00000000000c28b0 T SDL_GL_SetAttribute
00000000000c2920 T SDL_GL_SetSwapInterval
00000000000c2940 T SDL_GL_SwapWindow
00000000000c1bf0 T SDL_GL_UnbindTexture
00000000000c2890 T SDL_GL_UnloadLibrary

Then I activate the conda env, get the paths set up:
seita@mason:~/softgym/PyFlex/bindings/build (master) $ conda activate softgym
(softgym) seita@mason:~/softgym/PyFlex/bindings/build (master) $ cd ../../..
(softgym) seita@mason:~/softgym (master) $ export PYFLEXROOT=${PWD}/PyFlex
(softgym) seita@mason:~/softgym (master) $ export PYTHONPATH=${PYFLEXROOT}/bindings/build:$PYTHONPATH
(softgym) seita@mason:~/softgym (master) $ export LD_LIBRARY_PATH=${PYFLEXROOT}/external/SDL2-2.0.4/lib/x64:$LD_LIBRARY_PATH

and run this (I have to make the data/ directory):
(softgym) seita@mason:~/softgym (master) $ mkdir data
(softgym) seita@mason:~/softgym (master) $ python examples/random_env.py --env_name ClothFlatten  --headless 1
Waiting to generate environment variations. May take 1 minute for each variation...
Compute Device: Tesla V100-PCIE-32GB

Pyflex init done!
config 0: camera params {'default_camera': {'pos': array([-0.  ,  0.82,  0.82]), 'angle': array([ 0.        , -0.78539816,  0.        ]), 'width': 720, 'height': 720}}, flatten area: 0.27312500000000006
MoviePy - Building file ./data/ClothFlatten.gif with imageio.
Video generated and save to ./data/ClothFlatten.gif

Here is the GIF:

@Xingyu-Lin  I think it may be worthy to mention the headless option in more detail in the README. Or maybe a link to this issue report...

@Xingyu-Lin  I'll update this post (to avoid cluttering the issue with more posts) with working vs non-working settings.
All Working Settings Thus Far
By "working" I mean it can run the example commands in headless mode.
By the CUDA version, I mean the version from nvcc -V, NOT the nvidia-smi command. That latter command is used for the NVIDIA Driver version.

Ubuntu 16.04, CUDA 9.0, NVIDIA 440.33.01. Do not use Docker at all. Run code (shown above).
Ubuntu 18.04, CUDA 10.0. NVIDIA 450.102.04. Install PyFlex within Docker. Outside Docker, activate + run the code (shown above).

All Non-Working Settings Thus Far

Ubuntu 16.04, CUDA 10.0, NVIDIA 440.33.01. Do not use Docker at all. The only difference from a working setting above is that it's CUDA 10.0 instead of 9.0. This setting is resulting in:

(softgym) seita@triton3:~/softgym$ python examples/random_env.py --env_name ClothFold  --headless 1
Waiting to generate environment variations. May take 1 minute for each variation...
*** stack smashing detected ***: python terminated
Aborted (core dumped)

I then quickly changed my paths to point to CUDA 9.0 on that machine (instead of 10.0) and the code runs as expected. Interesting...

@Xingyu-Lin I think we can probably close this ;)
I am going to update https://danieltakeshi.github.io/2021/02/20/softgym/ with additional working setups.


Permanent disconnect error did not result in "disconnected" UI

I triggered a disconnect error which VS Code should treat as a permanent error, however there was no UI and the workbench still 'looked' connected.

I also hit this on a mismatched reconnection token

@connor4312 I don't see a status bar in your screenshots. Are you hiding it via settings or is it cropped out of the screenshot?

What are the steps to reproduce?

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.
Happy Coding!

Yes, sorry, I think the error message is actually spurious. I'll let you know if I get real repro steps.


Utilize DIY coverage tool for SemanticVersionImpl::SemanticVersionImpl

Implement flags in this method

Some schanges need to be reverted
row 103-114 in the second image does not need to exist

fixed and merged


support prettification of requests/responses

Idea is to add a flag to prettify the payloads for string based backends (adoc and plain)
linked to issue: https://github.com/sdaschner/jaxrs-analyzer/issues/125
Side note: made a few changes compared to 0.15 (I think they are ok but just want to mention them):

enum get merged into a string instead of something not json ("foo"|"bar" would be "foo|bar")
replaced visit(collection) by visitStart/visitEnd(collection) to be able to ensure the [ and ] are symmetric (was not the case)
changed a bit the adoc output (added some \n) to ensure it renders properly in html even with prettification (so you can get few more empty lines which are not affecting the rendering normally)

Cool, thanks a lot for contributing!
I have changed the configuration a bit, actually the Backend is configurable using a map. Also renamed the CLI option. Please have a look.
I have uploaded the 0.16-SNAPSHOT version in the Maven snapshot repository, could you please check whether that is all fine? :-)

Looks good, thanks!


tube_data_cbor(tube, CBOR)

as counterpart to tube_data.  MUST send 0 key yourself.a

See "tube_send_cbor" at https://github.com/sznadas/SPUDlib/blob/master/src/tube.c .

I propose to close it, bool tube_send_cbor is in the main branch and implements this.


[DO NOT MERGE] per-token dynamic observer

This PR adds support for per-token dynamic observers. These observer find a scale and zero point for each group of values against a given token dimension.
TODO:
Unit testing

@horheynm let's redo this PR as a quant arg strategy instead of an Observer


Pin Pul-Assets gem to the version that works.

The new version of the gem is updated for Orangelight's Blacklight 7
upgrade.
Closes #746

Coverage remained the same at 100.0% when pulling ffeea0a801f8eb92dd4d7df245ee3cf7ab456cc9 on pin_pul_assets into bfe34d32d4129bf619a8d7b6d64cb15ac8275a8c on master.


Update php version constraints

We wont know if this package will break in PHP 8.0!
This way we can get ahead of future problems...

Excellent point! Thanks! 👍


feat: Improve error handling and code readability in pr_agent tools

Type
Enhancement

Description

Improved error handling in pr_code_suggestions.py, pr_description.py, and pr_reviewer.py by adding checks for data validity before processing.
Removed redundant comments in pr_description.py and pr_reviewer.py.
In case of missing PR diff or prediction, the initial comment is now removed in pr_description.py and pr_reviewer.py.

Changes walkthrough
Relevant filesError handling

pr_code_suggestions.pyImproved error handling and comment clarity in PR code suggestions

pr_agent/tools/pr_code_suggestions.py

Added extra checks for data validity before processing.

Improved comment for clarity.

+3/-1

pr_description.pyStreamlined PR description preparation and improved error handling

pr_agent/tools/pr_description.py

Removed redundant comments.

Added error handling for missing PR diff.

Removed initial comment if prediction is not available.

+7/-15

pr_reviewer.pyStreamlined PR review preparation and improved error handling

pr_agent/tools/pr_reviewer.py

Removed redundant comments.

Added error handling for missing PR diff.

Removed initial comment if prediction is not available.

+9/-18

 ✨ Usage guide:
Overview:
The describe tool scans the PR code changes, and generates a description for the PR - title, type, summary, walkthrough and labels. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, to edit configurations related to the describe tool (pr_description section), use the following template:
/describe --pr_description.some_config1=... --pr_description.some_config2=...

With a configuration file, use the following template:
[pr_description]
some_config1=...
some_config2=...

  Enabling\disabling automation

When you first install the app, the default mode for the describe tool is:

pr_commands = ["/describe --pr_description.add_original_user_description=true"
                         "--pr_description.keep_original_user_title=true", ...]

meaning the describe tool will run automatically on every PR, will keep the original title, and will add the original user description above the generated description.

Markers are an alternative way to control the generated description, to give maximal control to the user. If you set:

pr_commands = ["/describe --pr_description.use_description_markers=true", ...]

the tool will replace every marker of the form pr_agent:marker_name in the PR description with the relevant content, where marker_name is one of the following:

type: the PR type.
summary: the PR summary.
walkthrough: the PR walkthrough.

Note that when markers are enabled, if the original PR description does not contain any markers, the tool will not alter the description at all.

  Custom labels
The default labels of the describe tool are quite generic: [Bug fix, Tests, Enhancement, Documentation, Other].
If you specify custom labels in the repo's labels page or via configuration file, you can get tailored labels for your use cases.
Examples for custom labels:

Main topic:performance - pr_agent:The main topic of this PR is performance
New endpoint - pr_agent:A new endpoint was added in this PR
SQL query - pr_agent:A new SQL query was added in this PR
Dockerfile changes - pr_agent:The PR contains changes in the Dockerfile
...

The list above is eclectic, and aims to give an idea of different possibilities. Define custom labels that are relevant for your repo and use cases.
Note that Labels are not mutually exclusive, so you can add multiple label categories.
Make sure to provide proper title, and a detailed and well-phrased description for each label, so the tool will know when to suggest it.

  Utilizing extra instructions
The describe tool can be configured with extra instructions, to guide the model to a feedback tailored to the needs of your project.
Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Notice that the general structure of the description is fixed, and cannot be changed. Extra instructions can change the content or style of each sub-section of the PR description.
Examples for extra instructions:
[pr_description]
extra_instructions="""
- The PR title should be in the format: '<PR type>: <title>'
- The title should be short and concise (up to 10 words)
- ...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the describe usage page for a comprehensive guide on using this tool.

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

Preparing suggestions...

PR Custom Suggestions
No suggestions found to improve this PR.
 ✨ Usage guide:
Overview:
The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
/improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...

With a configuration file, use the following template:
[pr_code_suggestions]
some_config1=...
some_config2=...

  Enabling\disabling automation
When you first install the app, the default mode for the improve tool is:
pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]

meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

  Utilizing extra instructions
Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.
Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.
Examples for extra instructions:
[pr_code_suggestions] # /improve #
extra_instructions="""
Emphasize the following aspects:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
- Is the code logic efficient?
...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

  A note on code suggestions quality

While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project.
Best quality will be obtained by using 'improve --extended' mode.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the improve usage page for a more comprehensive guide on using this tool.

Preparing suggestions...

PR Custom Suggestions
No suggestions found to improve this PR.
 ✨ Usage guide:
Overview:
The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
/improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...

With a configuration file, use the following template:
[pr_code_suggestions]
some_config1=...
some_config2=...

  Enabling\disabling automation
When you first install the app, the default mode for the improve tool is:
pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]

meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

  Utilizing extra instructions
Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.
Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.
Examples for extra instructions:
[pr_code_suggestions] # /improve #
extra_instructions="""
Emphasize the following aspects:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
- Is the code logic efficient?
...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

  A note on code suggestions quality

While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project.
Best quality will be obtained by using 'improve --extended' mode.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the improve usage page for a more comprehensive guide on using this tool.

Preparing suggestions...

PR Custom Suggestions
No custom suggestions found to improve this PR.
 ✨ Usage guide:
Overview:
The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
/improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...

With a configuration file, use the following template:
[pr_code_suggestions]
some_config1=...
some_config2=...

  Enabling\disabling automation
When you first install the app, the default mode for the improve tool is:
pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]

meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

  Utilizing extra instructions
Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.
Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.
Examples for extra instructions:
[pr_code_suggestions] # /improve #
extra_instructions="""
Emphasize the following aspects:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
- Is the code logic efficient?
...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

  A note on code suggestions quality

While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project.
Best quality will be obtained by using 'improve --extended' mode.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the improve usage page for a more comprehensive guide on using this tool.

Preparing suggestions...

PR Custom Suggestions
Suggestions                                                                                Error Handling
Add a type check for data before checking its contents.

Consider adding a check for the type of data before checking if 'code_suggestions' is in  data. This will prevent a potential TypeError if data is not a dictionary.
pr_agent/tools/pr_code_suggestions.py [73-75]
-if (not data) or (not 'code_suggestions' in data):
+if not isinstance(data, dict) or 'code_suggestions' not in data:
     get_logger().info('No code suggestions found for PR.')
     return

Add error handling for removing the initial comment.

Consider adding error handling for the case when  self.git_provider.remove_initial_comment() fails. This will prevent the program from   crashing if an error occurs during this operation.
pr_agent/tools/pr_description.py [89-90]
-self.git_provider.remove_initial_comment()
+try:
+    self.git_provider.remove_initial_comment()
+except Exception as e:
+    get_logger().error(f"Error removing initial comment: {e}")
 return None

Add a type check for self.patches_diff before proceeding with the AI prediction.

Consider adding a check for the type of self.patches_diff before proceeding with the AI   prediction. This will prevent a potential TypeError if self.patches_diff is not the   expected type.
pr_agent/tools/pr_reviewer.py [142-147]
-if self.patches_diff:
+if isinstance(self.patches_diff, dict):
     get_logger().info('Getting AI prediction...')
     self.prediction = await self._get_prediction(model)
 else:
     get_logger().error(f"Error getting PR diff")
     self.prediction = None

 ✨ Usage guide:
Overview:
The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
/improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...

With a configuration file, use the following template:
[pr_code_suggestions]
some_config1=...
some_config2=...

  Enabling\disabling automation
When you first install the app, the default mode for the improve tool is:
pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]

meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

  Utilizing extra instructions
Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.
Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.
Examples for extra instructions:
[pr_code_suggestions] # /improve #
extra_instructions="""
Emphasize the following aspects:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
- Is the code logic efficient?
...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

  A note on code suggestions quality

While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project.
Best quality will be obtained by using 'improve --extended' mode.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the improve usage page for a more comprehensive guide on using this tool.

Preparing suggestions...

PR Custom Suggestions
Suggestions                                                                                Bug Risk
Add a check for None in data['code_suggestions'] to prevent a potential TypeError.

Consider adding a check for None in data['code_suggestions']. This will prevent a <br>  ``TypeError   if data['code_suggestions'] is None.
pr_agent/tools/pr_code_suggestions.py [73-75]
-if (not data) or (not 'code_suggestions' in data):
+if (not data) or (not 'code_suggestions' in data) or (data['code_suggestions'] is None):
     get_logger().info('No code suggestions found for PR.')
     return

Add a check for None in self.patches_diff to prevent a potential TypeError.

Consider adding a check for None in self.patches_diff. This will prevent a TypeError   if self.patches_diff is None.
pr_agent/tools/pr_description.py [144-149]
-if self.patches_diff:
+if self.patches_diff is not None:
     get_logger().info(f"Getting AI prediction {self.pr_id}")
     self.prediction = await self._get_prediction(model)
 else:
     get_logger().error(f"Error getting PR diff {self.pr_id}")
     self.prediction = None

Add a check for None in self.patches_diff to prevent a potential TypeError.

Consider adding a check for None in self.patches_diff. This will prevent a TypeError   if self.patches_diff is None.
pr_agent/tools/pr_reviewer.py [142-147]
-if self.patches_diff:
+if self.patches_diff is not None:
     get_logger().info('Getting AI prediction...')
     self.prediction = await self._get_prediction(model)
 else:
     get_logger().error(f"Error getting PR diff")
     self.prediction = None

 ✨ Usage guide:
Overview:
The custom_suggestions tool scans the PR code changes, and automatically generates custom suggestions for improving the PR code. Unlike the improve tool, which offers more general suggestion according to a pre-configured set of rules, the custom_suggestions tool will propose suggestion that follow a specific pattern, defined by the prompt in: pr_custom_suggestions.custom_suggestions_prompt.
The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, use the following template:
/custom_suggestions --pr_custom_suggestions.custom_suggestions_prompt="The suggestions should focus only on the following:
-...
-...
-..."

With a configuration file, use the following template:
[pr_custom_suggestions]
custom_suggestions_prompt="""The suggestions should focus only on the following:
-...
-...
-...
"""

Using a configuration file is recommended, since it allows to use multi-line instructions.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the improve usage page for a more comprehensive guide on using this tool.

Preparing suggestions...

PR Custom Suggestions
Suggestions                                                                                Error Handling
Add a check to ensure data is a dictionary before checking for the key 'code_suggestions'.

Consider adding a check for data being a dictionary before checking for the key  'code_suggestions' in it. This will prevent a potential TypeError if data is not a   dictionary.
pr_agent/tools/pr_code_suggestions.py [73-75]
-if (not data) or (not 'code_suggestions' in data):
+if (not data) or (not isinstance(data, dict)) or (not 'code_suggestions' in data):
     get_logger().info('No code suggestions found for PR.')
     return

Add error handling for the case where removing the initial comment fails.

Consider adding error handling for the case where  self.git_provider.remove_initial_comment() fails. This will prevent the program from   crashing unexpectedly.
pr_agent/tools/pr_description.py [89-90]
-self.git_provider.remove_initial_comment()
+try:
+    self.git_provider.remove_initial_comment()
+except Exception as e:
+    get_logger().error(f"Error removing initial comment: {e}")
 return None

Add a check to ensure self.prediction is a string before proceeding.

Consider adding a check for self.prediction being a string before proceeding. This will   prevent a potential TypeError if self.prediction is not a string.
pr_agent/tools/pr_reviewer.py [111-113]
-if not self.prediction:
+if not self.prediction or not isinstance(self.prediction, str):
     self.git_provider.remove_initial_comment()
     return None

Add error handling for the case where removing the initial comment fails.

Consider adding error handling for the case where  self.git_provider.remove_initial_comment() fails. This will prevent the program from   crashing unexpectedly.
pr_agent/tools/pr_reviewer.py [112-113]
 if not self.prediction:
-    self.git_provider.remove_initial_comment()
+    try:
+        self.git_provider.remove_initial_comment()
+    except Exception as e:
+        get_logger().error(f"Error removing initial comment: {e}")
     return None

 ✨ Usage guide:
Overview:
The custom_suggestions tool scans the PR code changes, and automatically generates custom suggestions for improving the PR code.
Unlike the improve tool, which offers more general suggestion according to a pre-configured set of rules, the custom_suggestions tool will propose suggestion that follow a specific pattern, defined by the prompt in: pr_custom_suggestions.custom_suggestions_prompt.
The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, use the following template:
/custom_suggestions --pr_custom_suggestions.custom_suggestions_prompt="The suggestions should focus only on the following:\n-...\n-...\n-..."

With a configuration file, use the following template:
[pr_custom_suggestions]
custom_suggestions_prompt="""\
The suggestions should focus only on the following:
-...
-...
-...
"""

Using a configuration file is recommended, since it allows to use multi-line instructions.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the custom suggestions usage page for a more comprehensive guide on using this tool.

Preparing suggestions...

PR Custom Suggestions
Suggestions                                                                                Bug
Add a check to ensure that 'code_suggestions' in the data is not an empty list.

It seems like the code is checking if the data variable is None or if it doesn't   contain the key 'code_suggestions'. However, it doesn't handle the case where   'code_suggestions' is present but its value is an empty list. This could lead to   unexpected behavior later in the code.
pr_agent/tools/pr_code_suggestions.py [73-75]
-if (not data) or (not 'code_suggestions' in data):
+if (not data) or (not 'code_suggestions' in data) or (not data['code_suggestions']):
     get_logger().info('No code suggestions found for PR.')
     return

Add a check to ensure that 'patches_diff' is not an empty list before getting the AI prediction.

The code is checking if self.patches_diff is not None before proceeding to get the AI   prediction. However, it doesn't handle the case where self.patches_diff is an empty   list. This could lead to unnecessary computation if the PR diff is empty.
pr_agent/tools/pr_description.py [144-149]
 if self.patches_diff:
-    get_logger().info(f"Getting AI prediction {self.pr_id}")
-    self.prediction = await self._get_prediction(model)
+    if not self.patches_diff:
+        get_logger().info(f"PR diff is empty {self.pr_id}")
+        self.prediction = None
+    else:
+        get_logger().info(f"Getting AI prediction {self.pr_id}")
+        self.prediction = await self._get_prediction(model)
 else:
     get_logger().error(f"Error getting PR diff {self.pr_id}")
     self.prediction = None

Add a check to ensure that 'patches_diff' is not an empty list before getting the AI prediction.

The code is checking if self.patches_diff is not None before proceeding to get the AI   prediction. However, it doesn't handle the case where self.patches_diff is an empty   list. This could lead to unnecessary computation if the PR diff is empty.
pr_agent/tools/pr_reviewer.py [142-147]
 if self.patches_diff:
-    get_logger().info('Getting AI prediction...')
-    self.prediction = await self._get_prediction(model)
+    if not self.patches_diff:
+        get_logger().info(f"PR diff is empty")
+        self.prediction = None
+    else:
+        get_logger().info('Getting AI prediction...')
+        self.prediction = await self._get_prediction(model)
 else:
     get_logger().error(f"Error getting PR diff")
     self.prediction = None

 ✨ Usage guide:
Overview:
The custom_suggestions tool scans the PR code changes, and automatically generates custom suggestions for improving the PR code.
Unlike the improve tool, which offers more general suggestion according to a pre-configured set of rules, the custom_suggestions tool will propose suggestion that follow a specific pattern, defined by the prompt in: pr_custom_suggestions.custom_suggestions_prompt configuration.
The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, use the following template:
/custom_suggestions --pr_custom_suggestions.custom_suggestions_prompt="The suggestions should focus only on the following:\n-...\n-...\n-..."

With a configuration file, use the following template:
[pr_custom_suggestions]
custom_suggestions_prompt="""\
The suggestions should focus only on the following:
-...
-...
-...
"""

Using a configuration file is recommended, since it allows to use multi-line instructions.
Don't forget - with this tool, you are the prompter. Be specific, clear, and concise in the instructions. Specify relevant aspects that you want the model to focus on.
You might benefit from several try-and-error iterations, until you get the correct prompt for your use case.

  Example usage
Here is an example for a possible prompt:
[pr_custom_suggestions]
custom_suggestions_prompt="""\
The suggestions should focus only on the following:
- look for edge cases when implementing a new function
- make sure every variable has a meaningful name
- make sure the code is efficient
"""

The instructions above are just an example. We want to emphasize that the prompt should be specific and clear, and should be tailored to the needs of your project.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the custom suggestions usage page for a more comprehensive guide on using this tool.

Preparing suggestions...

PR Custom Suggestions
Suggestions                                                                                Variable Naming
Rename the variable data to pr_suggestions_data for better code readability.

Consider renaming the variable data to something more descriptive, such as  pr_suggestions_data. This will make the code more readable and maintainable.
pr_agent/tools/pr_code_suggestions.py [68-73]
-data = self._prepare_pr_code_suggestions()
+pr_suggestions_data = self._prepare_pr_code_suggestions()
 ...
-if (not data) or (not 'code_suggestions' in data):
+if (not pr_suggestions_data) or (not 'code_suggestions' in pr_suggestions_data):

Rename the variable self.patches_diff to pr_patches_diff for better code readability.

Consider renaming the variable self.patches_diff to something more descriptive, such as  pr_patches_diff. This will make the code more readable and maintainable.
pr_agent/tools/pr_reviewer.py [141-147]
-self.patches_diff = get_pr_diff(self.git_provider, self.token_handler, model)
-if self.patches_diff:
+pr_patches_diff = get_pr_diff(self.git_provider, self.token_handler, model)
+if pr_patches_diff:
     get_logger().info('Getting AI prediction...')
     self.prediction = await self._get_prediction(model)
 else:
     get_logger().error(f"Error getting PR diff")
     self.prediction = None

Error Handling
Add error handling for the case when self.patches_diff is None.

Add error handling for the case when self.patches_diff is None. This will help to   prevent potential issues in the future.
pr_agent/tools/pr_description.py [143-148]
 self.patches_diff = get_pr_diff(self.git_provider, self.token_handler, model)
 if self.patches_diff:
     get_logger().info(f"Getting AI prediction {self.pr_id}")
     self.prediction = await self._get_prediction(model)
 else:
     get_logger().error(f"Error getting PR diff {self.pr_id}")
     self.prediction = None
+    raise Exception(f"Error getting PR diff {self.pr_id}")

Add error handling for the case when self.patches_diff is None.

Add error handling for the case when self.patches_diff is None. This will help to   prevent potential issues in the future.
pr_agent/tools/pr_reviewer.py [141-147]
 self.patches_diff = get_pr_diff(self.git_provider, self.token_handler, model)
 if self.patches_diff:
     get_logger().info('Getting AI prediction...')
     self.prediction = await self._get_prediction(model)
 else:
     get_logger().error(f"Error getting PR diff")
     self.prediction = None
+    raise Exception(f"Error getting PR diff")

 ✨ Usage guide:
Overview:
The custom_suggestions tool scans the PR code changes, and automatically generates custom suggestions for improving the PR code.
Unlike the improve tool, which offers more general suggestion according to a pre-configured set of rules, the custom_suggestions tool will propose suggestion that follow a specific pattern, defined by the prompt in: pr_custom_suggestions.custom_suggestions_prompt configuration.
The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, use the following template:
/custom_suggestions --pr_custom_suggestions.custom_suggestions_prompt="The suggestions should focus only on the following:\n-...\n-...\n-..."

With a configuration file, use the following template:
[pr_custom_suggestions]
custom_suggestions_prompt="""\
The suggestions should focus only on the following:
-...
-...
-...
"""

Using a configuration file is recommended, since it allows to use multi-line instructions.
Don't forget - with this tool, you are the prompter. Be specific, clear, and concise in the instructions. Specify relevant aspects that you want the model to focus on.
You might benefit from several try-and-error iterations, until you get the correct prompt for your use case.

  Example usage
Here is an example for a possible prompt:
[pr_custom_suggestions]
custom_suggestions_prompt="""\
The suggestions should focus only on the following:
- look for edge cases when implementing a new function
- make sure every variable has a meaningful name
- make sure the code is efficient
"""

The instructions above are just an example. We want to emphasize that the prompt should be specific and clear, and be tailored to the needs of your project.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the custom suggestions usage page for a more comprehensive guide on using this tool.

Preparing suggestions...

PR Custom Suggestions
Suggestions                                                                                Code Readability
Rename the variable data to pr_suggestions_data to improve code readability.

Consider renaming the variable data to a more descriptive name. This would improve code   readability by making it clear what kind of data the variable is expected to hold.
pr_agent/tools/pr_code_suggestions.py [68-70]
-data = self._prepare_pr_code_suggestions()
-data = await retry_with_fallback_models(self._prepare_prediction_extended)
+pr_suggestions_data = self._prepare_pr_code_suggestions()
+pr_suggestions_data = await retry_with_fallback_models(self._prepare_prediction_extended)

Rename the variable self.patches_diff to self.pr_patches_diff to improve code readability.

Consider renaming the variable self.patches_diff to a more descriptive name. This would   improve code readability by making it clear what kind of data the variable is expected to   hold.
pr_agent/tools/pr_reviewer.py [141]
-self.patches_diff = get_pr_diff(self.git_provider, self.token_handler, model)
+self.pr_patches_diff = get_pr_diff(self.git_provider, self.token_handler, model)

Error Handling
Improve error handling by raising an exception when self.patches_diff is not available.

The error handling for self.patches_diff could be improved by raising an exception   instead of logging an error and setting self.prediction to None. This would make it   easier to debug issues as they occur.
pr_agent/tools/pr_description.py [144-148]
 if self.patches_diff:
     get_logger().info(f"Getting AI prediction {self.pr_id}")
     self.prediction = await self._get_prediction(model)
 else:
-    get_logger().error(f"Error getting PR diff {self.pr_id}")
-    self.prediction = None
+    raise Exception(f"Error getting PR diff {self.pr_id}")

Improve error handling by raising an exception when self.patches_diff is not available.

The error handling for self.patches_diff could be improved by raising an exception   instead of logging an error and setting self.prediction to None. This would make it   easier to debug issues as they occur.
pr_agent/tools/pr_reviewer.py [142-146]
 if self.patches_diff:
     get_logger().info('Getting AI prediction...')
     self.prediction = await self._get_prediction(model)
 else:
-    get_logger().error(f"Error getting PR diff")
-    self.prediction = None
+    raise Exception(f"Error getting PR diff")

 ✨ Usage guide:
Overview:
The custom_suggestions tool scans the PR code changes, and automatically generates custom suggestions for improving the PR code.
Unlike the improve tool, which offers more general suggestion according to a pre-configured set of rules, the custom_suggestions tool will only propose suggestion that follow specific guidelines defined by the prompt in: pr_custom_suggestions.prompt configuration.
The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
When commenting, use the following template:
/custom_suggestions --pr_custom_suggestions.prompt="The suggestions should focus only on the following:\n-...\n-...\n-..."

With a configuration file, use the following template:
[pr_custom_suggestions]
prompt="""\
The suggestions should focus only on the following:
-...
-...
-...
"""

Using a configuration file is recommended, since it allows to use multi-line instructions.
Don't forget - with this tool, you are the prompter. Be specific, clear, and concise in the instructions. Specify relevant aspects that you want the model to focus on.
You might benefit from several try-and-error iterations, until you get the correct prompt for your use case.

  Example usage
Here is an example for a possible prompt:
[pr_custom_suggestions]
prompt="""\
The suggestions should focus only on the following:
- look for edge cases when implementing a new function
- make sure every variable has a meaningful name
- make sure the code is efficient
"""

The instructions above are just an example. We want to emphasize that the prompt should be specific and clear, and be tailored to the needs of your project.

  More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs 💎: Generate docstring for new components introduced in the PR.
/generate_labels 💎: Generate labels for the PR based on the PR's contents.
/analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the custom suggestions usage page for a more comprehensive guide on using this tool.

PR Analysis
Here is a list of code components that were changed in this PR:
fileComponentspr_code_suggestions.py
generate_summarized_suggestions (method of PRCodeSuggestions)
+1/-1

pr_description.py
run (method of PRDescription)
+1/-0

_prepare_prediction (method of PRDescription)
+6/-15

pr_reviewer.py
run (method of PRReviewer)
+3/-7

_prepare_prediction (method of PRReviewer)
+6/-11

 ✨ Usage guide:
Using static code analysis capabilities, the analyze tool scans the PR code changes and find the code components (methods, functions, classes) that changed in the PR.
The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR:
/analyze

Language that are currently supported: Python, Java, C++, JavaScript, TypeScript.
See more information about the tool in the docs.

Tests for 'run' method
PR-Agent tests for code changes in run method, file pr_reviewer.py:
 [happy path]The method should log the start of the PR review process

test_code:
import pytest
from unittest.mock import patch

@pytest.mark.asyncio
async def test_run_logs_start_of_review(caplog):
    pr_reviewer = PRReviewer("https://fake.url")
    pr_reviewer.git_provider.publish_comment = AsyncMock()
    pr_reviewer._prepare_prediction = AsyncMock()
    pr_reviewer.prediction = "Mock Prediction"  # Simulate successful prediction

    with patch.object(pr_reviewer, '_prepare_pr_review', return_value="Mock PR Comment"):
        await pr_reviewer.run()

    assert "Reviewing PR: https://fake.url ..." in caplog.text

 [edge case]When the `_prepare_prediction` method fails to set a prediction, the initial comment should be removed and the method should exit early

test_code:
import pytest
from unittest.mock import AsyncMock

@pytest.mark.asyncio
async def test_run_exits_early_if_no_prediction(monkeypatch):
    pr_reviewer = PRReviewer("https://fake.url")
    pr_reviewer.git_provider.publish_comment = AsyncMock()
    pr_reviewer.git_provider.remove_initial_comment = AsyncMock()
    pr_reviewer._prepare_prediction = AsyncMock(return_value=None)
    pr_reviewer.prediction = None  # Simulate failure to set prediction

    await pr_reviewer.run()

    pr_reviewer.git_provider.publish_comment.assert_called_once_with("Preparing review...", is_temporary=True)
    pr_reviewer.git_provider.remove_initial_comment.assert_called_once()

 [edge case]The method should not proceed with the review process if the PR is incremental but cannot run an incremental review

test_code:
import pytest
from unittest.mock import AsyncMock, patch

@pytest.mark.asyncio
async def test_run_does_not_proceed_with_incremental_review_if_not_allowed(monkeypatch):
    pr_reviewer = PRReviewer("https://fake.url")
    pr_reviewer.incremental.is_incremental = True
    pr_reviewer._can_run_incremental_review = AsyncMock(return_value=False)
    pr_reviewer.git_provider.publish_comment = AsyncMock()
    pr_reviewer.git_provider.remove_initial_comment = AsyncMock()

    with patch.object(pr_reviewer, '_prepare_prediction') as mock_prepare_prediction:
        await pr_reviewer.run()

    mock_prepare_prediction.assert_not_called()
    pr_reviewer.git_provider.publish_comment.assert_not_called()
    pr_reviewer.git_provider.remove_initial_comment.assert_not_called()

 ✨ Usage guide:
The test tool generate tests for a selected component, based on the PR code changes.
It can be invoked manually by commenting on any PR:
/test component_name

where 'component_name' is the name of a specific component in the PR. To get a list of the components that changed in the PR, use the analyze tool.
Language that are currently supported: Python, Java, C++, JavaScript, TypeScript.
Configuration options:

num_tests: number of tests to generate. Default is 3.
testing_framework: the testing framework to use. If not set, for Python it will use pytest, for Java it will use JUnit, for C++ it will use Catch2, and for JavaScript and TypeScript it will use jest.
avoid_mocks: if set to true, the tool will try to avoid using mocks in the generated tests. Note that even if this option is set to true, the tool might still use mocks if it cannot generate a test without them. Default is true.
extra_instructions: Optional extra instructions to the tool. For example: "use the following mock injection scheme: ...".
file: in case there are several components with the same name, you can specify the relevant file
class_name: in case there are several components with the same name in the same file, you can specify the relevant class name

See more information about the test tool in the docs.


Mapping video timestamps back to media timestamps

Have you read the Tutorials?
Yes
Have you read the FAQ and checked for duplicate open issues?
Yes
What version of Shaka Player are you using?
3.0.8
Please ask your question
Is there a way to map the current video time (videoElement.currentTime) back to the media timestamps?  Below is an example of a VOD manifest with non-zero timestamps
https://krishndurpv3-usw22.streaming.media.azure.net/40459df0-a517-4f48-a39a-8c153ff20bef/test.ism/manifest(format=mpd-time-cmaf,starttime=2021-03-05T04:25:00.000Z,endtime=2021-03-05T04:30:00.000Z).mpd
The video.currentTime time always starts from 0 to the duration of the manifest.  Wondering if there is a way to map it back to the timestamp from either the manifest/or the video segment.

The timestamps are added by the Period@start - @presentationTimeOffset attributes.  Take a look at https://github.com/google/shaka-player/blob/master/docs/design/dash-manifests.md.  At runtime, you can use SegmentReference.timestampOffset to get this from the reference.

Thanks. Is there a way to get the SegmentReference for the current playing segment using the player API?

Thank you so much. This is very helpful.
Understood that this could change between release().  A quick question would this work for HLS or it only works for DASH?

It's the same for either, but there is one additional issue that may come up for HLS.  With HLS content using TS containers (instead of MP4), the third-party transmuxer (mux.js) may modify the timestamps.  I can't recall offhand.  but with TS content, there's another component in the mix that we didn't write.

Thanks.  This is really helpful.