django-ai icon indicating copy to clipboard operation
django-ai copied to clipboard

Getting ModuleNotFoundError: No module named 'bayesian_networks' while integrating django-ai with a basic django project.

Open dsbyprateekg opened this issue 6 years ago • 7 comments

  • django-ai version:0.0.2.1
  • Django version:2.0.10
  • Python version:3.6
  • Operating System:Windows 10

Description

I have created a Django project and then trying to integrate django-ai with it by following below link- https://django-ai.readthedocs.io/en/latest/installation.html

What I Did

When I ran 'python manage.py makemigrations 'command as mentioned in above ink I got following error: ModuleNotFoundError: No module named 'bayesian_networks'.

my settings.py snippet is as below- `DEBUG = True

ALLOWED_HOSTS = []

INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles',

# Dependencies
'nested_admin',

# django-ai apps
'django_ai.base',
'django_ai.bayesian_networks',
'django_ai.supervised_learning',
'django_ai.systems.spam_filtering',

# optional but highly recommended
'django_ai.examples',

]`

I tried to search in internet but I have not found any solution so I am asking here. Let me know if anything I am missing here.

dsbyprateekg avatar Jan 29 '19 05:01 dsbyprateekg

https://github.com/math-a3k/django-ai/tree/master/docs

This might help you. It worked for me.

saijalshakya avatar Feb 18 '19 12:02 saijalshakya

Can you please tell me exact what line in the shared doc helped you?

dsbyprateekg avatar Feb 18 '19 12:02 dsbyprateekg

I can't troubleshoot RN on windows, can you please try to test it out via the examples in the package, as explained in the quick start section in the readme?

If that works, then it's probably a path-related problem, like using packages outside the virtualenv

El lun., 18 feb. 2019 7:10, Prateek Gupta [email protected] escribió:

Can you please tell me exact what line in the shared doc helped you?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/math-a3k/django-ai/issues/17#issuecomment-464709269, or mute the thread https://github.com/notifications/unsubscribe-auth/AeDwxk2TnbqKGhnEpwaq3eI-S6gnXTcWks5vOpghgaJpZM4aXU6o .

math-a3k avatar Feb 19 '19 22:02 math-a3k

Third step. and migrating from that directory also @dsbyprateekg

saijalshakya avatar Feb 20 '19 06:02 saijalshakya

@saijalshakya Followed the step but by E:\ML\Django-Sample\django-ai_env\Lib\site-packages is blank and there is no manage.py file is created. @math-a3k seems like issue happens in windows

dsbyprateekg avatar Feb 20 '19 06:02 dsbyprateekg

Ya migrate after changing directory, then return back to main app folder then start with it. Successfully migrates but still the problem remains same. @dsbyprateekg

shakyasaijal avatar Feb 23 '19 12:02 shakyasaijal

Finally, I managed to solve it in Windows 10, here is what I did:

  • Install Python 3 and make sure you check "Add Python to PATH": https://www.python.org/downloads/release/python-372/

  • Run a Powershell as administrator and change the execution policy: Set-ExecutionPolicy -ExecutionPolicy bypass

  • Clone or download the django-ai source into a directory and change into it

  • Create a virtualenv and activate it for it python -m venv env .\env\Scripts\activate python -m pip install --upgrade pip

  • There are some packages that do not build on windows 10, edit requirements.txt and set: numpy==1.16 Pillow==5.2.0

  • Then install the reqs pip install -r requirements.txt

  • There still one gotcha for the installation: Install Graphviz for Windows and add it to your PATH: https://graphviz.gitlab.io/_pages/Download/Download_windows.html

  • Change into the django_ai directory inside the base distribution, from here the "manage.py" should be ran - the manage.py in the base dir is for running tests, if you invoke it, you will hit the errors that you described.

  • From there run: python manage.py makemigrations base bayesian_networks supervised_learning spam_filtering

  • After this, run the migrations: python manage.py migrate (if the examples app still complains about non-existant tables, comment out the examples app, run the migrations for the other apps to make sure they are ran before, then enable 'examples' and run its migrations)

  • Once this works, everything should go smoothly

  • Create a superuser account: python manage.py createsuperuser

  • Run the dev server: python.exe .\manage.py runserver

  • And you are ready to go, you may check the examples ( https://django-ai.readthedocs.io/en/latest/apps/examples.html) in: http://localhost:8000/django-ai/examples/comments http://localhost:8000/django-ai/examples/pages (and the admin)

Please confirm that you were able to run it :)

math-a3k avatar Feb 25 '19 04:02 math-a3k