Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HANDS-ON BUG] Unit 02 : Installing Requierments fails on Pickle5 module #603

Open
SlyPex opened this issue Mar 4, 2025 · 2 comments
Open

Comments

@SlyPex
Copy link

SlyPex commented Mar 4, 2025

When i try to run the following cell in the notebook in google collab :

!pip install -r https://raw.githubusercontent.com/huggingface/deep-rl-class/main/notebooks/unit2/requirements-unit2.txt

it fails with the following error :

Building wheels for collected packages: pickle5
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for pickle5 (setup.py) ... error
  ERROR: Failed building wheel for pickle5
  Running setup.py clean for pickle5
Failed to build pickle5
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pickle5)

Here's the Link to my notebook where the error keeps occuring.

I didn't use my own computer to try and run it.

@korbirayen
Copy link

Here is how i fixed it :

i added 3 code cells on top of that cell:

on the first one paste this code and execute :

%%file pickle5.py
# Compatibility layer that redirects to the standard pickle module
import pickle
import sys

# Re-export everything from the standard pickle module
from pickle import *

# Add specific pickle5 functionality if needed
if not hasattr(pickle, "HIGHEST_PROTOCOL"):
    HIGHEST_PROTOCOL = 5
else:
    HIGHEST_PROTOCOL = pickle.HIGHEST_PROTOCOL

# The dump functions with protocol 5 by default
def dump(obj, file, protocol=HIGHEST_PROTOCOL, *, fix_imports=True, buffer_callback=None):
    return pickle.dump(obj, file, protocol=protocol, fix_imports=fix_imports, buffer_callback=buffer_callback)

def dumps(obj, protocol=HIGHEST_PROTOCOL, *, fix_imports=True, buffer_callback=None):
    return pickle.dumps(obj, protocol=protocol, fix_imports=fix_imports, buffer_callback=buffer_callback)

# Add the current directory to Python's path so it can be imported
sys.path.insert(0, ".")

and then in the next cell paste this code :

%%file setup.py
from setuptools import setup

setup(
    name="pickle5",
    version="0.0.11",
    py_modules=["pickle5"],
)

and in the third cell paste this code and execute :

!pip install -e .

now after finishing these 3 cells pickle5 is installed successfully , so now you have to change that requirements installation cell with this code in order to install everything except of pickel5 :

 !pip install gymnasium pygame numpy huggingface_hub pyyaml==6.0 imageio imageio_ffmpeg pyglet==1.5.1 tqdm

@federicoorlandini
Copy link

It works like a charm.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants