That error means the virtualenv is not activated (django is installed in the python virtualenv). You are doing this for the Google Code-In right? If yes, I suggest you to temporarily drop this task and perform other tasks which will teach you some more basics which then will make this task look much easier. For example you can do:
- prepare your development environment - get started with linux - learn python and django by creating your blog - learn to build a REST API with django - learn DevOps practices with ansible After these tasks you'll eat this one easily. Federico On Thu, Dec 28, 2017 at 6:00 AM William Shi <[email protected]> wrote: > When I run python -c "import django; print(django.get_version())" in the > virtualenv I get 1.11.8, however when I run python it says 3.5.2 as its > default, but I remember that earlier I had an issue that wouldn't be > resolved until I installed python2. Do you think a conflict of python > versions is causing my issue? If so would I just follow this guide > http://barkas.com/2016/change-python-version-in-virtualenvwrapper/? > > On Wednesday, December 27, 2017 at 10:11:53 PM UTC-6, William Shi wrote: >> >> Hi, thanks for the response! Just to make sure the manual fix is done in >> my desktop controller and the set of commands you listed is done on the >> server yes. If so I am currently stuck on the last step ./manage.py migrate >> I am getting an error that says >> (env) william@ubuntu:/opt/openwisp2$ sudo ./manage.py migrate >> Traceback (most recent call last): >> File "./manage.py", line 8, in <module> >> from django.core.management import execute_from_command_line >> importError: No module named django.core.management >> >> I am currently troubleshooting the issue. >> On Wednesday, December 27, 2017 at 4:20:50 AM UTC-6, Federico Capoano >> wrote: >>> >>> It has to do with this issue: >>> https://code.djangoproject.com/ticket/26137 >>> >>> Are you able to try to apply the fix manually and run: >>> >>> cd /opt/openwisp2 >>> source env/bin/activate >>> ./manage.py migrate >>> >>> And let me know if it works? >>> >>> Federico >>> >>> >>> On Monday, December 25, 2017 at 9:55:44 PM UTC+1, William Shi wrote: >>>> >>>> I still get the same error >>>> >>>> On Monday, December 25, 2017 at 5:21:47 AM UTC-6, Federico Capoano >>>> wrote: >>>>> >>>>> What happens if you destroy the VM, recreate it and start again from >>>>> scratch, do you get the same error? >>>>> >>>>> Federico >>>>> >>>>> >>>>> On Monday, December 25, 2017 at 2:27:41 AM UTC+1, William Shi wrote: >>>>>> >>>>>> ubuntu 16.04.3 desktop for controller and unbuntu 16.04.3 server as >>>>>> the server >>>>>> >>>>>> On Sunday, December 24, 2017 at 3:43:06 AM UTC-6, Federico Capoano >>>>>> wrote: >>>>>>> >>>>>>> what OS are you using for your VM? >>>>>>> >>>>>>> On Sun, Dec 24, 2017 at 12:37 AM William Shi <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> I was able to resolve the problem, it seems ansible works with >>>>>>>> python2 and by default ubuntu server has python3 rather than 2. Now I >>>>>>>> am >>>>>>>> getting a new error which looks like this. >>>>>>>> TASK [openwisp.openwisp2 : migrate] >>>>>>>> ***************************************************************************************************************************** >>>>>>>> fatal: [ubuntu]: FAILED! => {"changed": false, "cmd": "./manage.py >>>>>>>> migrate --noinput", "msg": "\n:stderr: Traceback (most recent call >>>>>>>> last):\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", >>>>>>>> line 60, in get_new_connection\n cur.execute(\"SELECT >>>>>>>> load_extension(%s)\", (self.spatialite_lib,))\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py\", >>>>>>>> line 328, in execute\n return Database.Cursor.execute(self, query, >>>>>>>> params)\nsqlite3.OperationalError: >>>>>>>> /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined symbol: >>>>>>>> sqlite3_spatialite_init\n\nDuring handling of the above exception, >>>>>>>> another >>>>>>>> exception occurred:\n\nTraceback (most recent call last):\n File >>>>>>>> \"./manage.py\", line 10, in <module>\n >>>>>>>> execute_from_command_line(sys.argv)\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/__init__.py\", >>>>>>>> line 364, in execute_from_command_line\n utility.execute()\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/__init__.py\", >>>>>>>> line 356, in execute\n >>>>>>>> self.fetch_command(subcommand).run_from_argv(self.argv)\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/base.py\", >>>>>>>> line 283, in run_from_argv\n self.execute(*args, **cmd_options)\n >>>>>>>> File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/base.py\", >>>>>>>> line 330, in execute\n output = self.handle(*args, **options)\n >>>>>>>> File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/core/management/commands/migrate.py\", >>>>>>>> line 81, in handle\n connection.prepare_database()\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", >>>>>>>> line 72, in prepare_database\n with self.cursor() as cursor:\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/base/base.py\", >>>>>>>> line 254, in cursor\n return self._cursor()\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/base/base.py\", >>>>>>>> line 229, in _cursor\n self.ensure_connection()\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/base/base.py\", >>>>>>>> line 213, in ensure_connection\n self.connect()\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/base/base.py\", >>>>>>>> line 189, in connect\n self.connection = >>>>>>>> self.get_new_connection(conn_params)\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", >>>>>>>> line 65, in get_new_connection\n six.reraise(ImproperlyConfigured, >>>>>>>> ImproperlyConfigured(new_msg), sys.exc_info()[2])\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/six.py\", >>>>>>>> line 685, in reraise\n raise value.with_traceback(tb)\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", >>>>>>>> line 60, in get_new_connection\n cur.execute(\"SELECT >>>>>>>> load_extension(%s)\", (self.spatialite_lib,))\n File >>>>>>>> \"/opt/openwisp2/env/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py\", >>>>>>>> line 328, in execute\n return Database.Cursor.execute(self, query, >>>>>>>> params)\ndjango.core.exceptions.ImproperlyConfigured: Unable to load >>>>>>>> the >>>>>>>> SpatiaLite library extension \"libspatialite.so.7\" because: >>>>>>>> /usr/lib/x86_64-linux-gnu/libspatialite.so.7: undefined symbol: >>>>>>>> sqlite3_spatialite_init\n", "path": >>>>>>>> "/opt/openwisp2/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin", >>>>>>>> "state": "absent", "syspath": ["/tmp/ansible_qw4W0_", >>>>>>>> "/tmp/ansible_qw4W0_/ansible_modlib.zip", >>>>>>>> "/tmp/ansible_qw4W0_/ansible_modlib.zip", "/usr/lib/python2.7", >>>>>>>> "/usr/lib/python2.7/plat-x86_64-linux-gnu", >>>>>>>> "/usr/lib/python2.7/lib-tk", >>>>>>>> "/usr/lib/python2.7/lib-old", "/usr/lib/python2.7/lib-dynload", >>>>>>>> "/usr/local/lib/python2.7/dist-packages", >>>>>>>> "/usr/lib/python2.7/dist-packages"]} >>>>>>>> to retry, use: --limit >>>>>>>> @/home/william/openwisp2-ansible-playbook/playbook.retry >>>>>>>> >>>>>>>> PLAY RECAP >>>>>>>> ****************************************************************************************************************************************************** >>>>>>>> ubuntu : ok=39 changed=0 unreachable=0 >>>>>>>> failed=1 >>>>>>>> >>>>>>>> The issue seems to be specifically regarding openwisp migration and >>>>>>>> the only post I could find similiar to this issue was this one >>>>>>>> https://groups.google.com/forum/#!topic/openwisp/B2rdQJ8TSM4 but >>>>>>>> after comparing the error messages I think it is not the same issue. >>>>>>>> Have >>>>>>>> any suggestions? >>>>>>>> >>>>>>>> >>>>>>>> On Tuesday, December 19, 2017 at 7:48:58 PM UTC-6, William Shi >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Hi I seem to be having trouble with the roles in installing >>>>>>>>> openwisp2 like this post from earlier >>>>>>>>> https://groups.google.com/forum/#!topic/openwisp/kiJfX9lD1gM, >>>>>>>>> however I double checked and I did have the role installed already >>>>>>>>> and even >>>>>>>>> reinstalled and am still having the issue.(I am running virtual box >>>>>>>>> on a >>>>>>>>> windows 10 one instance of Ubuntu which is acting as my controller >>>>>>>>> and one >>>>>>>>> instance of Ubuntu server) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> <https://lh3.googleusercontent.com/-Ui0NwcXdpno/WjnAVzfzdlI/AAAAAAAAADk/0jdEi9G7FAQN2smaFM1I8Fs8GX_wh1mswCLcBGAs/s1600/openwisp%2Brole%2Bfile%2Blocation.PNG> >>>>>>>>> When running the ansible-playbook -i hosts playbook.yml -u <user> >>>>>>>>> -k --become -K I get >>>>>>>>> >>>>>>>>> >>>>>>>>> <https://lh3.googleusercontent.com/-hGBtKRt6U_c/WjnBAck3ebI/AAAAAAAAADs/DY6Q6PoR1VIIycOEqD1lIb89O0WDFgZ5ACLcBGAs/s1600/Help.PNG> >>>>>>>>> >>>>>>>>> >>>>>>>>> My playbook.yml looks like this >>>>>>>>> >>>>>>>>> >>>>>>>>> <https://lh3.googleusercontent.com/-inAw5fbRBg4/WjnBTDlWDQI/AAAAAAAAADw/vxVFeiN778wTnHiqrv6PyReqbPB4fiu8QCLcBGAs/s1600/playbook.yml.PNG> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "OpenWISP" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>> >>>>>>> -- > You received this message because you are subscribed to the Google Groups > "OpenWISP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "OpenWISP" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
