Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'config' from 'decouple' #45

Closed
salman77713438 opened this issue Jul 9, 2020 · 11 comments
Closed

ImportError: cannot import name 'config' from 'decouple' #45

salman77713438 opened this issue Jul 9, 2020 · 11 comments

Comments

@salman77713438
Copy link

salman77713438 commented Jul 9, 2020

i got this error when i try to runserver
please help!!!!!!!!!!!!!!
my steps
1- pip install virtualenv
2- virtualenv env
3- source env/bin/active
4- pip install -r requirements.txt
5- python manage.py runserver

`Traceback (most recent call last):
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 79, in getattr
self.setup(name)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 66, in setup
self.wrapped = Settings(settings_module)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 157, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\development.py", line 1, in
from .base import *
File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\base.py", line 2, in
from decouple import config
ImportError: cannot import name 'config' from 'decouple' (C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\decouple_init
.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management_init_.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management_init_.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 336, in run_from_argv
connections.close_all()
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 219, in close_all
for alias in self:
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 213, in iter
return iter(self.databases)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\functional.py", line 80, in get
res = instance.dict[self.name] = self.func(instance)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py", line 147, in databases
self.databases = settings.DATABASES
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 79, in getattr
self.setup(name)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 66, in setup
self.wrapped = Settings(settings_module)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\django\conf_init
.py", line 157, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in load_unlocked
File "", line 728, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\development.py", line 1, in
from .base import *
File "C:\Users\pc\Downloads\django-ecommerce-master\django-ecommerce-master\djecommerce\settings\base.py", line 2, in
from decouple import config
ImportError: cannot import name 'config' from 'decouple' (C:\Users\pc\AppData\Local\Programs\Python\Python37\lib\site-packages\decouple_init
.py)
`

@sakibsadmanshajib
Copy link

I think you might have misconfigured your virtual environment or some packages aren't being installed properly. I ran the program myself. It sorta worked. Let me know if I can help.

@zeeshan606115
Copy link

The same error is showing to me also

@zeeshan606115
Copy link

I think you might have misconfigured your virtual environment or some packages aren't being installed properly. I ran the program myself. It sorta worked. Let me know if I can help.

Bro can u please show me the python packages which you have installed.

@ghost
Copy link

ghost commented Aug 30, 2020

i got this erro also

@ghost
Copy link

ghost commented Aug 30, 2020

i got it pepole
first activate ther virtual enviroment
run this => pip uninstall decouple
and run this => from .conf import con

this soulution worked with me

@alexshcer
Copy link

image

@alexshcer
Copy link

Help it is showing this error

@vincent50
Copy link

Hi!
you need install python-decouple not decouple

if you have installed decouple first uninstall with:
pip uninstall decouple

then install python-decouple:
pip install python-decouple

or only replace the requirements file with:
python-decouple==3.4

@rkovilpillai
Copy link

Thanks @vincent50 , Your solution helpmed to fix the error !!

@JanakXD
Copy link

JanakXD commented Jun 21, 2021

Hi!
you need install python-decouple not decouple

if you have installed decouple first uninstall with:
pip uninstall decouple

then install python-decouple:
pip install python-decouple

or only replace the requirements file with:
python-decouple==3.4

thanks @vincent50 this helped me too

@Parl-Shedge
Copy link

you have to install :
step 1:

pip install python-decouple

if you have install

pip install decouple (uninstall it first)
then follow step 1 :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants