[Django]-ImportError: No module named crispy-forms

2👍

Ok, so I found by chance(almost) another post, this one: Getting stuck at Django error: No module named registration

and thought it might have something to do with pythonpath.

so then I tried easy_install, like suggested:

 $ easy_install -Z django-crispy-forms
    Searching for django-crispy-forms
    Best match: django-crispy-forms 1.4.0
    Adding django-crispy-forms 1.4.0 to easy-install.pth file

    Using /home/nr1/Envs/abc/lib/python2.7/site-packages
    Processing dependencies for django-crispy-forms
    Finished processing dependencies for django-crispy-forms

Now it works!
I still think there might be something missing with the pythonpath, because I keep getting this in eclipse:

SignUpView Found at: __module_not_in_the_pythonpath__

, and I would like someone to clarify it, so feel free to contribute here…

but django and crispy_forms now works together. YippikayeyMF!!

31👍

I solved this problem right now, I realized that the crispy-form installed version was the python 2.7 version, but I’m using Django-1.10 with Python 3.5, and I think this is your problem too.

Try: pip3 install --user django-crispy-forms

👤Toguko

19👍

You have to make sure that you install crispy-forms into the virtualenv.

  1. Activate VirtualEnv (where env is the directory/name of your virtual environment):
source env/bin/activate
  1. Install crispy-forms
pip install django-crispy-forms

12👍

As per the documentation : http://django-crispy-forms.readthedocs.org/en/latest/install.html#installing-django-crispy-forms, you have to add ‘crispy_forms’ not ‘crispy-forms’ to your Installed Apps list.

7👍

I was using crispy-forms instead of crispy_forms in settings.py

Following is the overview of things to be done to get crispy forms working:

pip install django-crispy-forms

in settings.py installed apps add crispy_forms
In settings.py add CRISPY_TEMPLATE_PACK = 'bootstrap4'

👤Aseem

3👍

I came across the same problem and figured out an alternate way around.

  1. Exit Virtualenv.
  2. Do a fresh pip install of crispy form at the root directory.
  3. Go back to Virtualenv and make migrations followed by migrate.

I think the django installation needs that all third party app be installed inside and as well outside the virtual env.
I would really appreciate if someone could help me with inside details behind the reason.

2👍

I use PyCharm for my Django projects. I get exactly the same error as you but in PyCharm until I change the Python interpreter used by PyCharm for the project. I have to, for each project, select the Python interpreter that resides in the relevant virtalenv folder to get the IDE (PyCharm) to recognize the installed modules. I suspect that the Pythonpath lurks somewhere in the background…

Doesn’t Eclipse allow you to select the interpreter to use for a project? That’s where I’d start looking.

Good luck!

2👍

This helped me. Try to use pipenv as a development environment.

  1. Install pipenv via pip

    pip3 install --user pipenv

  2. Install packages you need

    pipenv install django-crispy-forms

  3. Run pipenv shell

    pipenv shell

  4. Run your server

    pipenv run python3 manage.py runserver

👤Narek

1👍

All the above answers are missing one thing. Please cross check the location of your ‘External Libraries’ on the drive first before you do any of the above advises.
Reason:
– You be using an IDE that points to a different python directory, that is for guys who have install python more than once.

  • don’t think your ‘virtualenv’ is pointing to the right directory were your ‘External Libraries’ are stored. So if you go ahead and install in a wrong directory then such error will ok

1👍

change crispy-forms to crispy_forms in the installed apps of settings.py

1👍

After activating your virtual environment, assuming you are using python version 3, try:

python3 -m pip install django-crispy-forms
👤motash

0👍

Your django project is looking for crispy forms module.There is a possibility that it was not installed earlier possibly due to different versions.

If you are using a virtual environment i recommend that after activating your virtual environment you need to install django -crispy-forms.

To install it use command:
pip install django-crispy-forms

0👍

I had this same error and all I had to do was runserver using
python3 manage.py runserver. I’m not sure how it works but I think some modules need you to explicitly call python3 and not just the alias.

0👍

I just solved this problem, couldn’t find the solution anywhere though.
This error shows if you haven’t configured the crispy-forms correctly, and do check the version you are using.
Another one that worked for me- I configured everything perfect, But didn’t noticed some minor issues with the project and the app I configured.
Go through the whole process again and everything will be good to go.

0👍

For me , I just had to update the python version and it solved the problem. I was using python 3.9 , but then I uninstalled it and installed python 3.10 and also installed the latest version of django after uninstalling the previous version.

Note : don’t forget to change your environment variables after making the changes!

👤Aditi

0👍

After pip installed the crispy-forms library, added crispy_forms in the installed_apps. The issue for me was at the forms.py, my VScode editor does not recognized the crispy_forms.helper. Solution – I just close my Editor and then open again and now its recognized.

0👍

I had a similar issue, and I solved it by this:

  1. activate your virtual environment
  2. uninstall crispy forms with "pip3 uninstall django-crispy-forms"
  3. reinstall crispy forms, but this time use "sudo pip3 install django-crispy-forms"
  4. retest, and see if it works for you.

The terminal will display a warning message about using sudo with pip, but you can safely disregard it.

0👍

I had the same problem and depending on your set up I have found that the following actions solved my problem.

  1. Using python3 manage.py runserver instead of python manage.py runserver (which kept giving me an error.

  2. The docs here specify a bit more of what you’ll need to do if using the bootstrap template. https://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs

To be more specific for me I followed these instructions here: https://pypi.org/project/crispy-bootstrap4/

After these adjustments, everything worked just fine.

Leave a comment