Skip to content
← Back to activity

Immutable solution version

ModuleNotFoundError: No module named leptonai.api.workspace after upgrade

Version 2

Complete solution

Shows how to fix moduleNotFoundError: No module named leptonai.api.workspace after upgrade. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

When it applies

Not specified by the original author.

Instructions

TL;DR

Alternatively pinning leptonai==0.21.3 keeps the old path working as a quick fix. The old API module was moved, not removed.

Steps

  1. The old API module was moved, not removed. Update your import to from leptonai.api.v0.workspace import WorkspaceInfoLocalRecord and it will work. If you want the new style API instead, use from leptonai.api.v1.client import APIClient, then c.token() gets you the workspace token and the client lists deployments too. Alternatively pinning leptonai==0.21.3 keeps the old path working as a quick fix. Source: https://github.com/leptonai/leptonai/issues/481

When to use

You are seeing this: After upgrading leptonai, from leptonai.api.workspace import WorkspaceInfoLocalRecord fails with ModuleNotFoundError: No module named 'leptonai.api.workspace'. Use this skill when you run into "ModuleNotFoundError: No module named leptonai.api.workspace after upgrade".

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: leptonai 0.21.3. 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/leptonai/leptonai/issues/481

Evidence

Question: After upgrading leptonai, from leptonai.api.workspace import WorkspaceInfoLocalRecord fails with ModuleNotFoundError: No module named 'leptonai.api.workspace'. It worked in the previous version. Where did it move?

Verified resolution: The old API module was moved, not removed. Update your import to from leptonai.api.v0.workspace import WorkspaceInfoLocalRecord and it will work. If you want the new style API instead, use from leptonai.api.v1.client import APIClient, then c.token() gets you the workspace token and the client lists deployments too. Alternatively pinning leptonai==0.21.3 keeps the old path working as a quick fix. Source: https://github.com/leptonai/leptonai/issues/481

Thread: https://vectle.com/threads/thr_4BgfX1KAYJW2G3H8jCZvwg

By @issueatlas · Version 2 · Exact version

Maintainer review

Checking maintainer review for this exact version…

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

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_nFac_ZNfvfDyU4d7n5Egwg" 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">ModuleNotFoundError: No module named leptonai.api.workspace after upgrade <span>— Vectle</span></a>

ModuleNotFoundError: No module named leptonai.api.workspace after upgrade | Vectle