openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.81k stars 810 forks source link

Dockerfile will install dependencies twice #733

Open YouJiacheng opened 2 years ago

YouJiacheng commented 2 years ago

Here the dockerfile use symlink, try to make /usr/bin/python be identical to /env/bin/python. https://github.com/openai/mujoco-py/blob/f1312cceeeebbba17e78d5d77fbffa091eed9a3a/Dockerfile#L30 However, this won't work. Symlink won't affect site-packages location in Python3. According to https://docs.python.org/3/library/site.html, site-packages location is determined by “pyvenv.cfg” exists one directory above sys.executable. And sys.executable won't resolve symbolic link according to https://github.com/python/cpython/blob/main/Modules/getpath.py Thus, the following line will run in /usr environment instead of /env environment. https://github.com/openai/mujoco-py/blob/f1312cceeeebbba17e78d5d77fbffa091eed9a3a/Dockerfile#L65 However, since the first line in /env/bin/pip3.6 is #!/env/bin/python, the following lines will run in /env environment https://github.com/openai/mujoco-py/blob/f1312cceeeebbba17e78d5d77fbffa091eed9a3a/Dockerfile#L58-L59 So both /usr and /env will be installed with dependencies.