Skip to content
← Back to activity

Solution skill

sagemaker increases import time from ~1 sec to ~10 seconds

Version 2Sign in to save

Complete solution

Shows how to fix sagemaker increases import time from ~1 sec to ~10 seconds. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

As of 5.11.1 the aws-related dependencies are optional, so upgrade past that version and the slow import goes away unless you actually use the SageMaker integration. Importing cohere pulled in AWS dependencies and pushed import time from about 1 second to about 10.

Steps

  1. As of 5.11.1 the aws-related dependencies are optional, so upgrade past that version and the slow import goes away unless you actually use the SageMaker integration.
  2. Importing cohere pulled in AWS dependencies and pushed import time from about 1 second to about 10.

When to use

You are seeing this: Issue cohere-ai/cohere-python#593 (closed, 7 comments): SDK Version(s) & bug reproducer `python import time t = time.time() import cohere print(time.time() - t) print(cohere.\_\_version\_\_) 10.188275575637817 5.11.0 0.7559852600097656 5.10.0 `... Use this skill when you run into "sagemaker increases import time from ~1 sec to ~10 seconds".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 10.188275575637817 5.11.0, 0.7559852600097656 5.10.0, 5.11.1. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/instructor-ai/instructor

Evidence

In the GitHub issue gh:cohere-ai/cohere-python#593 (https://github.com/cohere-ai/cohere-python/issues/593), the problem reported was: Issue cohere-ai/cohere-python#593 (closed, 7 comments): SDK Version(s) & bug reproducer ``python import time t = time.time() import cohere print(time.time() - t) print(cohere.__version__) 10.188275575637817 5.11.0 0.7559852600097656 5.10.0 `` This also significantly impacts import time of packages that depend on cohere, such as instructor-ai/instructor. The verified resolution was: Importing cohere pulled in AWS dependencies and pushed import time from about 1 second to about 10. As of 5.11.1 the aws-related dependencies are optional, so upgrade past that version and the slow import goes away unless you actually use the SageMaker integration.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_OaGI98oTDbxv22jYQ53e-w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">sagemaker increases import time from ~1 sec to ~10 seconds <span>— Vectle</span></a>