question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModuleNotFoundError: No module named 'django'

See original GitHub issue

Describe the bug Fail to run ./run_tests.sh with below error messages:

[+] Running 3/3
 ⠿ Container safe-transaction-service-ganache-1  Created                                                                                                                                                                                                                             0.1s
 ⠿ Container safe-transaction-service-redis-1    Created                                                                                                                                                                                                                             0.1s
 ⠿ Container safe-transaction-service-db-1       Created                                                                                                                                                                                                                             0.1s
[+] Running 3/3
 ⠿ Container safe-transaction-service-redis-1    Started                                                                                                                                                                                                                             0.6s
 ⠿ Container safe-transaction-service-db-1       Started                                                                                                                                                                                                                             0.5s
 ⠿ Container safe-transaction-service-ganache-1  Started                                                                                                                                                                                                                             0.5s
Traceback (most recent call last):
  File "/home/liudan/safe-transaction-service/manage.py", line 10, in <module>
    from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/liudan/safe-transaction-service/manage.py", line 16, in <module>
    import django  # noqa
ModuleNotFoundError: No module named 'django'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/liudan/safe-transaction-service/manage.py", line 18, in <module>
    raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

To Reproduce Steps to reproduce the behavior:

source venv/bin/activate
pip install -r requirements-dev.txt
pre-commit install -f
cp .env.dev .env
sudo ./run_tests.sh

Expected behavior Should finished without error.

Environment (please complete the following information):

  • OS: Ubuntu 22.04.01

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gzliudancommented, Dec 9, 2022

After put user to gourp docker, the test command ./run_tests.sh can be executed successfully.

0reactions
Uxio0commented, Dec 9, 2022

Your user should have permissions for running docker, that’s related to your configuration, if you use sudo you are not using the virtualenv you created

Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleNotFoundError: No module named 'django' in Python
The Python "ModuleNotFoundError: No module named 'django'" occurs when we forget to install the Django module before importing it or install it in...
Read more >
ModuleNotFoundError: No module named 'django' - QueWorx
If you got the error “ModuleNotFoundError: No module named 'django'” it means that Python couldn't find your Django package. Here's the full error...
Read more >
No module named django but it is installed - Stack Overflow
This error shows that Django is not installed. Installing Django should solve the problem. In my case, Django ...
Read more >
ModuleNotFoundError: No Module Named Django
To resolve this error, you have to install Django. And, before installing Django must check Python is installed or not. If already installed ......
Read more >
Resolve the “modulenotfounderror no module named 'django ...
The “modulenotfounderror no module named 'django'” problem is invoked when the package is not installed on your system or globally. It also occurs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found