openedx / edx-platform

The Open edX LMS & Studio, powering education sites around the world!
https://openedx.org
GNU Affero General Public License v3.0
7.35k stars 3.85k forks source link

errors on rake tasks #1652

Closed medhamsh closed 10 years ago

medhamsh commented 10 years ago

Hi, I have installed edx-platform on stand alone Ubuntu 12.04. There were many hiccups and the installation was not so smooth. After fiddling much could get edX up and running but there is an issue with every rake task. Following is the error.

rake django-admin[sync_user_info,lms,dev]]

./manage.py lms --settings dev] sync_user_info --traceback Traceback (most recent call last): File "./manage.py", line 90, in startup = importlib.import_module(edx_args.startup) File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) File "/opt/wwc/edx-platform/lms/startup.py", line 6, in from django.conf import settings ImportError: No module named django.conf rake aborted! Command failed with status (1): [./manage.py lms --settings dev] syncuser...] /opt/wwc/edx-platform/rakelib/django.rake:65:in `block in <top (required)>' Tasks: TOP => django-admin (See full trace by running task with --trace)

I am sure this is python's compatibility issue. What needs to be changed for this? Thanks in advance

valera-rozuvan commented 10 years ago

After you install the edx-platform, you can start it up using the commands:

$ workon edx-platform # starts py env $ cd ~/edx_all/edx-platform/ # switch to working directory $ rake install_prereqs # install all required prerequisites $ rake django-admin[syncdb] # database synchronbisation (create all necessary tables) $ rake django-admin[migrate] # database update (update all tables) $ rake cms # start Studio (content management system)

@medhamsh - have you tried running these commands in this order?

valera-rozuvan commented 10 years ago

The commands:

$ rake install_prereqs $ rake django-admin[syncdb] $ rake django-admin[migrate]

should be done only once, after the initial install. However, if you want to reset edx-platform to the pristine state (just as it was after the installation), you can do:

$ workon edx-platform $ cd ~/edx_all/edx-platform/ $ git clean -fxd $ rm ../db/mitx.db $ mongo xmodule --eval "db.dropDatabase()" $ mongo xcontent --eval "db.dropDatabase()"

and then perform the rest of the commands:

$ rake install_prereqs $ rake django-admin[syncdb] $ rake django-admin[migrate] $ rake cms

Hope this helps!

medhamsh commented 10 years ago

Thanks for a quick reply.

But the first command, rake install_prereqs itself is creating errors.

mkdir -p /opt/wwc/edx-platform/.prereqs_cache npm install npm WARN coffee-script@1.6.1 package.json: bugs['name'] should probably be bugs['url'] bundle install rake aborted! Command failed with status (127): [bundle install...] /opt/wwc/edx-platform/rakelib/prereqs.rake:22:in block (2 levels) in <top (required)>' /opt/wwc/edx-platform/rakelib/helpers.rb:46:inwhen_changed' /opt/wwc/edx-platform/rakelib/prereqs.rake:21:in `block in <top (required)>' Tasks: TOP => install_prereqs => install_ruby_prereqs (See full trace by running task with --trace)

Also, where is all this documented? I could not find them.

medhamsh commented 10 years ago

@valera-rozuvan , Now the node and npm errors start appearing. What versions of node, coffeescript are exactly required?

valera-rozuvan commented 10 years ago

This is what I have on my dev system:

$ cat /etc/*-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 DISTRIB_CODENAME=precise DISTRIB_DESCRIPTION="Ubuntu 12.04.3 LTS" NAME="Ubuntu" VERSION="12.04.3 LTS, Precise Pangolin" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu precise (12.04.3 LTS)" VERSION_ID="12.04"

$ node --version v0.10.18

$ nodejs --version v0.10.18

$ coffee --version CoffeeScript version 1.4.0

$ python --version Python 2.7.3

$ ruby --version ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-linux]

medhamsh commented 10 years ago

Now, the rake install_prereqs went fine but rest of the commands fail.

If the install_prereqs went fine there should not be any requirements problem. But the following occurs,

./manage.py lms --settings dev migrate --traceback 2013-11-13 15:07:21,669 DEBUG 16853 [nose.plugins.manager] manager.py:385 - DefaultPluginManager load plugin NOSETESTS_PLUGINS = rednose:RedNose 2013-11-13 15:07:21,673 DEBUG 16853 [nose.plugins.manager] manager.py:385 - DefaultPluginManager load plugin nose_exclude = nose_exclude:NoseExclude 2013-11-13 15:07:21,675 DEBUG 16853 [nose.plugins.manager] manager.py:385 - DefaultPluginManager load plugin xcover = nosexcover:XCoverage 2013-11-13 15:07:21,677 DEBUG 16853 [nose.plugins.manager] manager.py:385 - DefaultPluginManager load plugin nose_ignoredoc = nose_ignoredoc:IgnoreDocstrings 2013-11-13 15:07:21,714 INFO 16853 [dd.dogapi] dog_stats_api.py:66 - Initializing dog api to use statsd: localhost, 8125 Traceback (most recent call last): File "./manage.py", line 95, in execute_from_command_line([sys.argv[0]] + django_args) File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 443, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 69, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module import(name) File "/usr/local/lib/python2.7/dist-packages/south/management/commands/init.py", line 10, in import django.template.loaders.app_directories File "/usr/local/lib/python2.7/dist-packages/django/template/loaders/app_directories.py", line 23, in raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0])) django.core.exceptions.ImproperlyConfigured: ImportError django_extensions: No module named django_extensions rake aborted! Command failed with status (1): [./manage.py lms --settings dev migrate --t...] /opt/wwc/edx-platform/rakelib/django.rake:65:in `block in <top (required)>' Tasks: TOP => django-admin (See full trace by running task with --trace)

My main thing is to be able to delete courses and I am not able to do so. Please throw some light on this.

valera-rozuvan commented 10 years ago

Looking at the logs, i see the error ImportError django_extensions: No module named django_extensions. Googling a bit, http://stackoverflow.com/questions/1662843/django-extensions-error-message .

medhamsh commented 10 years ago

Yesterday after some googling I found that I need to explicitly write django_extensions in the common.py/settings.py. Removed it now. Now the error is different. Operational error, unable to open the db file.

sqlite3.OperationalError: unable to open database file rake aborted! Command failed with status (1): [./manage.py lms --settings dev syncdb --tr...] /opt/wwc/edx-platform/rakelib/django.rake:65:in `block in <top (required)>' Tasks: TOP => django-admin

But apart from all this, I could delete the course using the rake task, rake django-admin[[delete_course,cms,aws,"Org/no/course commit"]

So I am good with this now but I feel that the app is not yet production ready.

medhamsh commented 10 years ago

@valera-rozuvan , thanks for your directions. After referring to the versions of software you shared, I made all the same versions in my setup and some things started working. Have to stabilize the setup though.

medhamsh commented 10 years ago

Also, the manual policy definitions dont seem to help much. I want to make the course visible only to logged in users. I tried setting the policy definition anonymous_view to false but no change in effect. I also want to hook LDAP authentication and disable registration of accounts.

valera-rozuvan commented 10 years ago

sqlite3.OperationalError: unable to open database file Look in the config file for sqlite3. Where is the DB file? See what access rights it has. Does it even exist? By the way, does your system have mongodb installed and running?

medhamsh commented 10 years ago

mongodb yes. it is there and it is running. There are these dbs running.

cs_comments_service 0.203125GB cs_comments_service_development 0.203125GB edxapp 0.203125GB local 0.078125GB xmodule (empty)

And, for the sqlite db I tried locating it a lot but couldn't find it. If there is no db at all how is the edX app working? This is my first time with django based app and I am not able to get the hang of architecture at all. It needs ruby, python, node, mysql, mongo and sqlite. Seeming very gibberish to me now.

valera-rozuvan commented 10 years ago

The below commands set up a sqlite db for you.

$ workon edx-platform $ cd ~/edx_all/edx-platform/ $ rm ../db/mitx.db $ rake django-admin[syncdb] $ rake django-admin[migrate]

If all went well, you can then see that the DB is indeed populated by

$ sqlite3 ../db/mitx.db

and within the sqlite3 REPL you can run 2 commands (.databases, .tables). Below is what I get:

sqlite> .databases seq name file


0 main /home/valera/edx_all/edx-platform/../db/mitx.db

sqlite> .tables auth_group
auth_group_permissions
auth_permission
auth_registration
auth_user
auth_user_groups
auth_user_user_permissions
auth_userprofile
bulk_email_courseauthorization
bulk_email_courseemail
bulk_email_courseemailtemplate
bulk_email_optout
celery_taskmeta
celery_tasksetmeta
certificates_certificatewhitelist
certificates_generatedcertificate
circuit_servercircuit
course_creators_coursecreator
course_groups_courseusergroup
course_groups_courseusergroup_users
course_modes_coursemode
courseware_offlinecomputedgrade
courseware_offlinecomputedgradelog
courseware_studentmodule
courseware_studentmodulehistory
courseware_xmodulestudentinfofield
courseware_xmodulestudentprefsfield
courseware_xmoduleuserstatesummaryfield
django_admin_log
django_comment_client_permission
django_comment_client_permission_roles
django_comment_client_role
django_comment_client_role_users
django_content_type
django_openid_auth_association
django_openid_auth_nonce
django_openid_auth_useropenid
django_session
django_site
djcelery_crontabschedule
djcelery_intervalschedule
djcelery_periodictask
djcelery_periodictasks
djcelery_taskstate
djcelery_workerstate
external_auth_externalauthmap
foldit_puzzlecomplete
foldit_score
instructor_task_instructortask
licenses_coursesoftware
licenses_userlicense
notes_note
notifications_articlesubscription
notify_notification
notify_notificationtype
notify_settings
notify_subscription
psychometrics_psychometricdata
shoppingcart_certificateitem
shoppingcart_order
shoppingcart_orderitem
shoppingcart_paidcourseregistration
south_migrationhistory
student_courseenrollment
student_courseenrollmentallowed
student_pendingemailchange
student_pendingnamechange
student_testcenterregistration
student_testcenteruser
student_userstanding
student_usertestgroup
student_usertestgroup_users
track_trackinglog
user_api_userpreference
verify_student_softwaresecurephotoverification waffle_flag
waffle_flag_groups
waffle_flag_users
waffle_sample
waffle_switch
wiki_article
wiki_articleforobject
wiki_articleplugin
wiki_articlerevision
wiki_articlesubscription
wiki_attachment
wiki_attachmentrevision
wiki_image
wiki_imagerevision
wiki_reusableplugin
wiki_reusableplugin_articles
wiki_revisionplugin
wiki_revisionpluginrevision
wiki_simpleplugin
wiki_urlpath

medhamsh commented 10 years ago

That is the whole point where it stuck right. There is no folder called db or any file called mitx and when i run the rake django[syncdb] it stops complaining that unable to open database file. Else should I manually create a db called mitx.db and run the syncdb command?

valera-rozuvan commented 10 years ago

When there is no db/mitx.db file, the command rake django-admin[syncdb] creates one for you. Can you please paste complete output from the console when you run this command.

medhamsh commented 10 years ago

aah, here it is.

./manage.py lms --settings dev syncdb --traceback 2013-11-14 05:39:23,904 DEBUG 30917 [nose.plugins.manager] manager.py:385 - DefaultPluginManager load plugin NOSETESTS_PLUGINS = rednose:RedNose 2013-11-14 05:39:23,907 DEBUG 30917 [nose.plugins.manager] manager.py:385 - DefaultPluginManager load plugin nose_exclude = nose_exclude:NoseExclude 2013-11-14 05:39:23,908 DEBUG 30917 [nose.plugins.manager] manager.py:385 - DefaultPluginManager load plugin xcover = nosexcover:XCoverage 2013-11-14 05:39:23,910 DEBUG 30917 [nose.plugins.manager] manager.py:385 - DefaultPluginManager load plugin nose_ignoredoc = nose_ignoredoc:IgnoreDocstrings 2013-11-14 05:39:23,944 INFO 30917 [dd.dogapi] dog_stats_api.py:66 - Initializing dog api to use statsd: localhost, 8125 Syncing... Traceback (most recent call last): File "./manage.py", line 95, in execute_from_command_line([sys.argv[0]] + django_args) File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 443, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(_args, _options.dict) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute output = self.handle(_args, _options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in handle return self.handle_noargs(options) File "/usr/local/lib/python2.7/dist-packages/south/management/commands/syncdb.py", line 90, in handle_noargs syncdb.Command().execute(options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute output = self.handle(_args, *_options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in handle return self.handle_noargs(options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs cursor = connection.cursor() File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/utils/tracking/init*.py", line 9, in wrapped return callback(original, _args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/panels/sql.py", line 21, in cursor result = original(self) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/init.py", line 317, in cursor cursor = self.make_debug_cursor(self._cursor()) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 288, in _cursor self._sqlite_create_connection() File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 278, in _sqlite_create_connection self.connection = Database.connect(**kwargs) sqlite3.OperationalError: unable to open database file rake aborted! Command failed with status (1): [./manage.py lms --settings dev syncdb --tr...] /opt/wwc/edx-platform/rakelib/django.rake:65:in `block in <top (required)>' Tasks: TOP => django-admin (See full trace by running task with --trace)

valera-rozuvan commented 10 years ago

$ sqlite3 --version 3.7.9 2011-11-01 00:52:41 c7c6050ef060877ebe77b41d959e9df13f8c9b5e

valera-rozuvan commented 10 years ago

I think something went wrong during your install.

singingwolfboy commented 10 years ago

@medhamsh is this still a problem with the latest version of the codebase?