facebookresearch / CompilerGym

Reinforcement learning environments for compiler and program optimization tasks
https://compilergym.ai/
MIT License
880 stars 123 forks source link

Error when creating gcc compilation environment #822

Open xclovehsy opened 8 months ago

xclovehsy commented 8 months ago

🐛 Bug

After installing docker by way of the official website, creating a gcc environment reports an error

To Reproduce

Steps to reproduce the behavior:

  1. installed docker, run "docker run hello-world" is ok
  2. import compiler_gym
  3. env = compiler_gym.make("gcc-v0", gcc_bin="docker:gcc:11.2.0")

Expected behavior

Traceback (most recent call last): File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/envs/gcc/service/./compiler_gym-gcc-service", line 9, in from compiler_gym.envs.gcc import DEFAULT_GCC File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/init.py", line 32, in from compiler_gym.compiler_env_state import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/compiler_env_state.py", line 15, in from compiler_gym.datasets.uri import BenchmarkUri File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/init.py", line 6, in from compiler_gym.datasets.benchmark import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/benchmark.py", line 13, in from compiler_gym.service.proto import Benchmark as BenchmarkProto File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/init.py", line 6, in from compiler_gym.service.connection import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/connection.py", line 27, in from compiler_gym.service.service_cache import ServiceCache File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/service_cache.py", line 12, in from compiler_gym.util.filesystem import is_in_memory File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/filesystem.py", line 12, in from compiler_gym.util import runfiles_path File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/runfiles_path.py", line 15, in _PACKAGE_ROOT = Path(os.path.join(os.path.dirname(file), "../../")).resolve( TypeError: resolve() got an unexpected keyword argument 'strict' ServiceError Service terminated with returncode: 1 (SIGHUP) (attempt 1) Traceback (most recent call last): File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/envs/gcc/service/./compiler_gym-gcc-service", line 9, in from compiler_gym.envs.gcc import DEFAULT_GCC File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/init.py", line 32, in from compiler_gym.compiler_env_state import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/compiler_env_state.py", line 15, in from compiler_gym.datasets.uri import BenchmarkUri File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/init.py", line 6, in from compiler_gym.datasets.benchmark import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/benchmark.py", line 13, in from compiler_gym.service.proto import Benchmark as BenchmarkProto File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/init.py", line 6, in from compiler_gym.service.connection import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/connection.py", line 27, in from compiler_gym.service.service_cache import ServiceCache File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/service_cache.py", line 12, in from compiler_gym.util.filesystem import is_in_memory File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/filesystem.py", line 12, in from compiler_gym.util import runfiles_path File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/runfiles_path.py", line 15, in _PACKAGE_ROOT = Path(os.path.join(os.path.dirname(file), "../../")).resolve( TypeError: resolve() got an unexpected keyword argument 'strict' ServiceError Service terminated with returncode: 1 (SIGHUP) (attempt 2) Traceback (most recent call last): File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/envs/gcc/service/./compiler_gym-gcc-service", line 9, in from compiler_gym.envs.gcc import DEFAULT_GCC File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/init.py", line 32, in from compiler_gym.compiler_env_state import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/compiler_env_state.py", line 15, in from compiler_gym.datasets.uri import BenchmarkUri File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/init.py", line 6, in from compiler_gym.datasets.benchmark import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/benchmark.py", line 13, in from compiler_gym.service.proto import Benchmark as BenchmarkProto File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/init.py", line 6, in from compiler_gym.service.connection import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/connection.py", line 27, in from compiler_gym.service.service_cache import ServiceCache File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/service_cache.py", line 12, in from compiler_gym.util.filesystem import is_in_memory File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/filesystem.py", line 12, in from compiler_gym.util import runfiles_path File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/runfiles_path.py", line 15, in _PACKAGE_ROOT = Path(os.path.join(os.path.dirname(file), "../../")).resolve( TypeError: resolve() got an unexpected keyword argument 'strict' ServiceError Service terminated with returncode: 1 (SIGHUP) (attempt 3) Traceback (most recent call last): File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/envs/gcc/service/./compiler_gym-gcc-service", line 9, in from compiler_gym.envs.gcc import DEFAULT_GCC File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/init.py", line 32, in from compiler_gym.compiler_env_state import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/compiler_env_state.py", line 15, in from compiler_gym.datasets.uri import BenchmarkUri File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/init.py", line 6, in from compiler_gym.datasets.benchmark import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/benchmark.py", line 13, in from compiler_gym.service.proto import Benchmark as BenchmarkProto File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/init.py", line 6, in from compiler_gym.service.connection import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/connection.py", line 27, in from compiler_gym.service.service_cache import ServiceCache File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/service_cache.py", line 12, in from compiler_gym.util.filesystem import is_in_memory File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/filesystem.py", line 12, in from compiler_gym.util import runfiles_path File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/runfiles_path.py", line 15, in _PACKAGE_ROOT = Path(os.path.join(os.path.dirname(file), "../../")).resolve( TypeError: resolve() got an unexpected keyword argument 'strict' ServiceError Service terminated with returncode: 1 (SIGHUP) (attempt 4) Traceback (most recent call last): File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/envs/gcc/service/./compiler_gym-gcc-service", line 9, in from compiler_gym.envs.gcc import DEFAULT_GCC File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/init.py", line 32, in from compiler_gym.compiler_env_state import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/compiler_env_state.py", line 15, in from compiler_gym.datasets.uri import BenchmarkUri File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/init.py", line 6, in from compiler_gym.datasets.benchmark import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/datasets/benchmark.py", line 13, in from compiler_gym.service.proto import Benchmark as BenchmarkProto File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/init.py", line 6, in from compiler_gym.service.connection import ( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/connection.py", line 27, in from compiler_gym.service.service_cache import ServiceCache File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/service_cache.py", line 12, in from compiler_gym.util.filesystem import is_in_memory File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/filesystem.py", line 12, in from compiler_gym.util import runfiles_path File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/runfiles_path.py", line 15, in _PACKAGE_ROOT = Path(os.path.join(os.path.dirname(file), "../../")).resolve( TypeError: resolve() got an unexpected keyword argument 'strict' ServiceError Service terminated with returncode: 1 (SIGHUP) (attempt 5) Traceback (most recent call last): File "", line 1, in File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/util/registration.py", line 16, in make return gym.make(id, kwargs) File "/home/xc/anaconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 235, in make return registry.make(id, kwargs) File "/home/xc/anaconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 129, in make env = spec.make(kwargs) File "/home/xc/anaconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 90, in make env = cls(_kwargs) File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/envs/gcc/gcc_env.py", line 76, in init super().init( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/client_service_compiler_env.py", line 207, in init self.service = service_connection or CompilerGymServiceConnection( File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/connection.py", line 646, in init self._establish_connection() File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/connection.py", line 657, in _establish_connection self.connection = self._create_connection(self.endpoint, self.opts) File "/home/xc/anaconda3/lib/python3.9/site-packages/compiler_gym/service/connection.py", line 718, in _create_connection raise exception_class( compiler_gym.errors.service_errors.ServiceError: Failed to create connection to compiler_gym-gcc-service after 2.6 seconds (5 attempts made). Last error (ServiceError): Service terminated with returncode: 1 (SIGHUP)

Environment

Please fill in this checklist:

You may use the environment collection script to generate most of this information. You can get the script and run it with:

wget https://raw.githubusercontent.com/facebookresearch/CompilerGym/stable/build_tools/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

Additional context

ChrisCummins commented 8 months ago

I see in the error message that Path.resolve() is being called with keyword strict, and that is causing an error because strict keyword doesn't exist. That was added in Python 3.6, so perhaps you are using an old Python version?

Could you check your python version and report back?