Django - cannot import name 'config' from 'decouple' Django - cannot import name 'config' from 'decouple' python-3.x python-3.x

Django - cannot import name 'config' from 'decouple'


You might have decouple installed in additional to python-decouple (two different packages).

If that is the case simply uninstall decouple

pip uninstall decouple

And ensure you have python-decouple installed

pip install python-decouple


It shows the error because you are not installed the module python-decoupleJust run pip install -r requirements.txtIf it won't work then try it in env

pip install python-decouple


I was using pipenv to create a virtual environment and run the Django project

pipenv install -r requiremnts.txtpipenv shellpython manage.py runserver

Interestingly above method kept throwing error that it cannot import config from decouple

then I tried:

python -m venv myEnvmyEnv/Scripts/activatepip install -r requirements.txtpython manage.py runserver

and this ran the project successfully. I didnt understand why this would happen as I am doing pretty much same just using pip instead of pipenv.