From 50ea8f36cce31e52b569696f46722fc78ec2ceca Mon Sep 17 00:00:00 2001 From: Jason Garner Date: Fri, 24 Oct 2025 07:30:56 -0500 Subject: [PATCH 1/4] needed # Conflicts: # setup.py --- pufferlib/ocean/environment.py | 7 ++++++ pufferlib/pufferl.py | 7 +++++- setup.py | 43 +++++++++++++++++++++------------- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/pufferlib/ocean/environment.py b/pufferlib/ocean/environment.py index f3cffcb2e..64c6c61dc 100644 --- a/pufferlib/ocean/environment.py +++ b/pufferlib/ocean/environment.py @@ -1,5 +1,12 @@ import importlib import pufferlib.emulation +import platform +import os + +is_windows = platform.system() == "Windows" +if is_windows: + raylib_dll_path = os.path.abspath(r'raylib-5.5_win64_msvc16\lib') + os.add_dll_directory(raylib_dll_path) def lazy_import(module_path, attr): """ diff --git a/pufferlib/pufferl.py b/pufferlib/pufferl.py index 2d9b1c1a1..3629ce19f 100644 --- a/pufferlib/pufferl.py +++ b/pufferlib/pufferl.py @@ -6,6 +6,8 @@ import warnings warnings.filterwarnings('error', category=RuntimeWarning) +import platform +is_windows = platform.system() == "Windows" import os import io import sys @@ -865,7 +867,10 @@ def run(self): while not self.stopped: self.cpu_util.append(100*psutil.cpu_percent()/psutil.cpu_count()) mem = psutil.virtual_memory() - self.cpu_mem.append(100*mem.active/mem.total) + if is_windows: + self.cpu_mem.append(100*mem.used/mem.total) + else: + self.cpu_mem.append(100*mem.active/mem.total) if torch.cuda.is_available(): # Monitoring in distributed crashes nvml if torch.distributed.is_initialized(): diff --git a/setup.py b/setup.py index f1004bdbf..098010b0e 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,14 @@ # Build raylib for your platform RAYLIB_URL = 'https://github.com/raysan5/raylib/releases/download/5.5/' -RAYLIB_NAME = 'raylib-5.5_macos' if platform.system() == "Darwin" else 'raylib-5.5_linux_amd64' +system = platform.system() +if system == 'Linux': + RAYLIB_NAME = 'raylib-5.5_linux_amd64' +elif system == 'Darwin': + RAYLIB_NAME = 'raylib-5.5_macos' +elif system == 'Windows': + RAYLIB_NAME = 'raylib-5.5_win64_msvc16' + RLIGHTS_URL = 'https://raw.githubusercontent.com/raysan5/raylib/refs/heads/master/examples/shaders/rlights.h' def download_raylib(platform, ext): @@ -113,7 +120,6 @@ def download_box2d(platform): '-O3', ] -system = platform.system() if system == 'Linux': extra_compile_args += [ '-Wno-alloc-size-larger-than', @@ -138,6 +144,9 @@ def download_box2d(platform): ] if not NO_OCEAN: download_raylib('raylib-5.5_macos', '.tar.gz') +elif system == 'Windows': + if not NO_OCEAN: + download_raylib('raylib-5.5_win64_msvc16', '.zip') else: raise ValueError(f'Unsupported system: {system}') @@ -179,7 +188,8 @@ def run(self): self.extensions = [e for e in self.extensions if e.name in extnames] super().run() -RAYLIB_A = f'{RAYLIB_NAME}/lib/libraylib.a' +RAYLIB_A = f'{RAYLIB_NAME}/lib/raylibdll.lib' if system == "Windows" else f'{RAYLIB_NAME}/lib/libraylib.a' + INCLUDE = [numpy.get_include(), 'raylib/include', f'{BOX2D_NAME}/include', f'{BOX2D_NAME}/src'] extension_kwargs = dict( include_dirs=INCLUDE, @@ -194,7 +204,7 @@ def run(self): c_extension_paths = glob.glob('pufferlib/ocean/**/binding.c', recursive=True) c_extensions = [ Extension( - path.rstrip('.c').replace('/', '.'), + path.rstrip('.c').replace('/', '.').replace('\\', '.'), sources=[path], **extension_kwargs, ) @@ -236,18 +246,19 @@ def run(self): ), ] -# Prevent Conda from injecting garbage compile flags -from distutils.sysconfig import get_config_vars -cfg_vars = get_config_vars() -for key in ('CC', 'CXX', 'LDSHARED'): - if cfg_vars[key]: - cfg_vars[key] = cfg_vars[key].replace('-B /root/anaconda3/compiler_compat', '') - cfg_vars[key] = cfg_vars[key].replace('-pthread', '') - cfg_vars[key] = cfg_vars[key].replace('-fno-strict-overflow', '') - -for key, value in cfg_vars.items(): - if value and '-fno-strict-overflow' in str(value): - cfg_vars[key] = value.replace('-fno-strict-overflow', '') +if system != 'Windows': + # Prevent Conda from injecting garbage compile flags + from distutils.sysconfig import get_config_vars + cfg_vars = get_config_vars() + for key in ('CC', 'CXX', 'LDSHARED'): + if cfg_vars[key]: + cfg_vars[key] = cfg_vars[key].replace('-B /root/anaconda3/compiler_compat', '') + cfg_vars[key] = cfg_vars[key].replace('-pthread', '') + cfg_vars[key] = cfg_vars[key].replace('-fno-strict-overflow', '') + + for key, value in cfg_vars.items(): + if value and '-fno-strict-overflow' in str(value): + cfg_vars[key] = value.replace('-fno-strict-overflow', '') install_requires = [ 'setuptools', From 4f17b8312366713fd68a450bed130ee3d2afbd4d Mon Sep 17 00:00:00 2001 From: Jason Garner Date: Mon, 29 Sep 2025 07:54:56 -0500 Subject: [PATCH 2/4] needed --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a851bdf3d..c08aa96ef 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ def download_raylib(platform, ext): if not NO_OCEAN: download_raylib('raylib-5.5_webassembly', '.zip') - download_raylib(RAYLIB_NAME, '.tar.gz') + download_raylib(RAYLIB_NAME, '.tar.gz' if platform.system() != "Windows" else '.zip') BOX2D_URL = 'https://github.com/capnspacehook/box2d/releases/latest/download/' BOX2D_NAME = 'box2d-macos-arm64' if platform.system() == "Darwin" else 'box2d-linux-amd64' From 98d8baf333e2eb08e29b00bd25188e75a66d3d22 Mon Sep 17 00:00:00 2001 From: Jason Garner Date: Fri, 28 Nov 2025 19:50:41 -0600 Subject: [PATCH 3/4] https://docs.python.org/3.12/tutorial/controlflow.html#pass-statements --- setup.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/setup.py b/setup.py index c08aa96ef..c75706165 100644 --- a/setup.py +++ b/setup.py @@ -151,11 +151,8 @@ def download_box2d(platform): '-framework', 'OpenGL', '-framework', 'IOKit', ] - if not NO_OCEAN: - download_raylib('raylib-5.5_macos', '.tar.gz') elif system == 'Windows': - if not NO_OCEAN: - download_raylib('raylib-5.5_win64_msvc16', '.zip') + pass else: raise ValueError(f'Unsupported system: {system}') From a7e0b113f31322c00bfd639c2feb94fb04599564 Mon Sep 17 00:00:00 2001 From: Jason Garner Date: Wed, 31 Dec 2025 13:25:22 -0600 Subject: [PATCH 4/4] GTX 980 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 58b56057f..a694492b2 100644 --- a/setup.py +++ b/setup.py @@ -304,7 +304,7 @@ def run(self): if not NO_TRAIN: install_requires += [ - 'torch>=2.9', + 'torch>=2.6', 'psutil', 'nvidia-ml-py', 'rich',