Fastai/fastbook on Sagemaker Studio Lab

Hi all,

Is there a guide to get Fastai and fastbook working on Fastai/fastbook on Sagemaker Studio Lab? Is Sagemaker Studio Lab compatible with fastai/fastbook currently?

When I try to create the fastbook environment within the Sagemaker Studio Lab terminal I get the following error:

Pip subprocess error:
ERROR: Exception:
Traceback (most recent call last):
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/cli/base_command.py”, line 173, in _main
status = self.run(options, args)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/cli/req_command.py”, line 203, in wrapper
return func(self, options, args)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/commands/install.py”, line 286, in run
reqs = self.get_requirements(args, options, finder, session)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/cli/req_command.py”, line 384, in get_requirements
for parsed_req in parse_requirements(
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/req/req_file.py”, line 135, in parse_requirements
for parsed_line in parser.parse(filename, constraint):
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/req/req_file.py”, line 319, in parse
yield from self._parse_and_recurse(filename, constraint)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/req/req_file.py”, line 348, in _parse_and_recurse
yield from self._parse_and_recurse(req_path, nested_constraint)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/req/req_file.py”, line 324, in _parse_and_recurse
for line in self._parse_file(filename, constraint):
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/req/req_file.py”, line 353, in _parse_file
_, content = get_file_content(filename, self._session)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/req/req_file.py”, line 518, in get_file_content
resp = session.get(url)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py”, line 555, in get
return self.request(‘GET’, url, **kwargs)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_internal/network/session.py”, line 454, in request
return super().request(method, url, *args, **kwargs)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py”, line 542, in request
resp = self.send(prep, **send_kwargs)
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py”, line 697, in send
r.content
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_vendor/requests/models.py”, line 836, in content
self._content = b’’.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b’’
File “/home/studio-lab-user/.conda/envs/fastbook/lib/python3.10/site-packages/pip/_vendor/requests/models.py”, line 769, in generate
chunk = self.raw.read(chunk_size)
AttributeError: ‘FileNotFoundError’ object has no attribute ‘read’

failed

CondaEnvException: Pip failed

How are you creating the fastbook environment?

I tried both conda env create -f environment.yml in a terminal tab and via the gui of studio lab, both gave the same error.

You can try pip installing fastai without creating conda env

1 Like

I just did “!pip install fastbook” and was able to run a sample learning session for pets no problem. in a CPU runtime though.

Has anyone been able to get a GPU runtime? I’ve been trying for two days and it just simply tells me to “try again later”