Jithin Pavithran
Jithin Pavithran

Reputation: 1351

" ImportError: cannot import name CaptchaFields " - Django

I cloned a working project from BitBucket and tried:
python manage.py runserver

I'm getting the following error:

from captcha.fields import CaptchaField
ImportError: cannot import name CaptchaField

I did install captcha using pip install captcha and it installed without any error.
Following is my captcha folder ( installation directory ) contents

enter image description here

I tried installing simple-cpatcha , recaptcha manually but didn't help.
I couldn't find captcha zip file to install it manually.

Upvotes: 6

Views: 8323

Answers (5)

Ascolom
Ascolom

Reputation: 113

If you are using an integrated development environment like pycharm with a virtual environment, check if the correct package was installed. That did it for me. Go to the interpreter settings and check the installed package list. If the package captcha comes up, it is the WRONG package. Uninstall it and check the available packages list for django-simple-captcha and install that instead.

Upvotes: 1

Mauricio Velasco
Mauricio Velasco

Reputation: 31

You need to import from the field like this

from rest_framework_recaptcha.fields import ReCaptchaField

that worked for me

Upvotes: 0

zjy
zjy

Reputation: 21

I have some problem on Mac OS with Python 3.7, Django 2.1, fixed by reinstall django-simple-captcha

pip uninstall django-simple-captcha pip install django-simple-captcha

Upvotes: 1

MewX
MewX

Reputation: 4312

I had the same issue by installing the following packages:

pip3 install captcha
pip3 install django-simple-captcha

Upvotes: 2

user6364253
user6364253

Reputation:

I had similar problem.
Using Django 1.8.2, Python 2.7 and pip 7.0.1
and command pip install captcha solved it.

Upvotes: 2

Related Questions