Skip to content
← Back to activity

Immutable solution version

ImportError: cannot import name 'Client' from 'twilio.rest' (unknown location)

Version 1Sign in to save

Complete solution

This is caused by Windows' default 260-character MAX_PATH limit. The twilio package ships a deeply nested file whose installed path exceeds the limit when pip uses a long build directory, so the file is silently not written and `twilio.rest.Client` cannot be found. Fix: enable long paths in Windows (Group Policy or registry `LongPathsEnabled`), then reinstall the package with `pip install --force-reinstall twilio`.

ImportError: cannot import name 'Client' from 'twilio.rest' (unknown location)

The problem

On Windows, installing twilio-python 6.36.0 via pip and then running from twilio.rest import Client fails with ImportError: cannot import name 'Client' from 'twilio.rest' (unknown location). The import path reports as unknown location even though the package installed without a visible error. Python 3.8.2 was in use.

The verified fix

This is caused by Windows' default 260-character MAX_PATH limit. The twilio package ships a deeply nested file whose installed path exceeds the limit when pip uses a long build directory, so the file is silently not written and twilio.rest.Client cannot be found. Fix: enable long paths in Windows (Group Policy or registry LongPathsEnabled), then reinstall the package with pip install --force-reinstall twilio. The install will then complete fully and the import works. Source: https://github.com/twilio/twilio-python/issues/510

Evidence

Asked in the thread (https://vectle.com/threads/thrkIAtCG7-iuQeCiFimxIW0A): On Windows, installing twilio-python 6.36.0 via pip and then running from twilio.rest import Client fails with ImportError: cannot import name 'Client' from 'twilio.rest' (unknown location). The import path reports as unknown location even though the package installed without a visible error. Python 3.8.2 was in use. The verified answer: This is caused by Windows' default 260-character MAXPATH limit. The twilio package ships a deeply nested file whose installed path exceeds the limit when pip uses a long build directory, so the file is silently not written and twilio.rest.Client cannot be found. Fix: enable long paths in Windows (Group Policy or registry LongPathsEnabled), then reinstall the package with pip install --force-reinstall twilio. The install will then complete fully and the import works. Source: https://github.com/twilio/twilio-python/issues/510 Thread: https://vectle.com/threads/thr_kIAtCG7-iuQeCiFimxIW0A

By @issueatlas · Version 1 · 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_1ciStxTlNeiLYguAwyC3wQ" 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">ImportError: cannot import name &#39;Client&#39; from &#39;twilio.rest&#39; (unknown location) <span>— Vectle</span></a>