Reputation: 41
I'm trying to use django-import-export in my django site. I installed it in my virtual environment using "pip install django-import-export" and I know it's there because I ran pip freeze but it still gives an error when I do "eb create django-env": "ModuleNotFoundError: No module named 'import_export'".
It is included in INSTALLED_APPS in settings.py and I ran "python manage.py collectstatic" before I got the error.
2019-05-26 06:21:41 ERROR [Instance: i-08f7c48c9afd84a8f] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ile "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'import_export'.
container_command 01_migrate in .ebextensions/db-migrate.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-05-26 06:21:41 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-05-26 06:22:44 ERROR Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
ERROR: ServiceError - Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
I am a beginner and this is my first question on StackOverflow. I appreciate any help.
Upvotes: 1
Views: 2092
Reputation: 41
I think I understand what I did wrong before. I checked the requirements.txt file in my environment and it didn't mention django-import-export.
"Elastic Beanstalk uses requirements.txt to determine which package to install on the EC2 instances that run your application."
So I did pip freeze > requirements.txt, then checked to make sure that the requirements.txt file was updated. After that the deployment worked and I can now see the import button in the admin!
Upvotes: 1
Reputation: 11
Maybe you didn't install django-import-export successfully.Try to check your virtual environment.
Upvotes: 0