FG
🤖 AI & LLMsAnthropic

ImportError: cannot import name 'Anthropic' from 'anthropic'

Freshover 2 years ago
Mar 14, 20260 views
Confidence Score87%
87%

Problem

Trying to run the basic code for Anthropic and getting this error: AttributeError: module 'anthropic' has no attribute 'Anthropic' Using anthropic == 0.3.6 Code in my notebook: from anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT anthropic = Anthropic( defaults to os.environ.get("ANTHROPIC_API_KEY") api_key='replaced with my actual api key', ) completion = anthropic.completions.create( model="claude-2", max_tokens_to_sample=300, prompt=f"{HUMAN_PROMPT} how does a court case get to the Supreme Court? {AI_PROMPT}", ) print(completion.completion)

Error Output

error: AttributeError: module 'anthropic' has no attribute 'Anthropic'

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: ImportError: cannot import name 'Anthropic' from 'anthropic'

Low Risk

It works in a python shell but not in my anaconda jupyter notebook.

84

Trust Score

1 verification

100% success
  1. 1

    It works in a python shell but not in my anaconda jupyter notebook.

    It works in a python shell but not in my anaconda jupyter notebook.

Validation

Resolved in anthropics/anthropic-sdk-python GitHub issue #86. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

claudeanthropicllmapi