I have installed python version 3.4 on CentOS 2.6
and I also installed Django 1.8.
Then I try to create Django application like below.
$django-admin.py startproject mysite
$cd mysite
$python3 manage.py startapp poll
I got some error. How can I overcome this situation.
Thanks in advance.
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 31, in <module>
from pysqlite2 import dbapi2 as Database
ImportError: No module named 'pysqlite2'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 33, in <module>
from sqlite3 import dbapi2 as Database
...
ImportError: No module named '_sqlite3'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
...
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'
runing sudo apt-get install python-sqlite does the trick for me
I appended "PYTHONVERSION=3.5" just below line "VERSION=3.5" in the Makefile and recompiled. It worked.
Related
I had to reinstall my pycharm and now when I try to run my Django server I get the following error:
(card_companion_venv) PS N:\My Drive\Projects\Card Companion\card_companion> python website/manage.py runserver 0.0.0.0:8000 --settings=website.settings.base
Traceback (most recent call last):
File "N:\My Drive\Projects\Card Companion\card_companion\website\manage.py", line 9, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "N:\My Drive\Projects\Card Companion\card_companion\website\manage.py", line 20, in <module>
main()
File "N:\My Drive\Projects\Card Companion\card_companion\website\manage.py", line 11, in main
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?
The interpreter has the correct packages installed:
and the terminal is using the virtual environment:
(card_companion_venv) PS N:\My Drive\Projects\Card Companion\card_companion>
I'm running Linux Mint 18.3 with kernel 4.13.0-39-generic.
Every time I run a command in a terminal that is not valid or the program is not installed I get a stacktrace of a python error
Traceback (most recent call last):
File "/usr/lib/python3.5/dbm/gnu.py", line 4, in <module>
from _gdbm import *
ImportError: No module named '_gdbm'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 7, in <module>
import dbm.gnu as gdbm
File "/usr/lib/python3.5/dbm/gnu.py", line 6, in <module>
raise ImportError(str(msg) + ', please install the python3-gdbm package')
ImportError: No module named '_gdbm', please install the python3-gdbm package
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 27, in <module>
from CommandNotFound.util import crash_guard
File "/usr/lib/python3/dist-packages/CommandNotFound/__init__.py", line 3, in <module>
from CommandNotFound.CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 9, in <module>
import gdbm
ImportError: No module named 'gdbm'
To answer the first question, yes gdbm is installed:
ii libgdbm3:amd64 1.8.3-13.1 amd64 GNU dbm database routines (runtime version)
ii python-gdbm 2.7.12-1~16.04 amd64 GNU dbm database support for Python
ii python3-gdbm:amd64 3.6.5-3~16.04.york0.2 amd64 GNU dbm database support for Python 3.x
As you can see in your error message you are missing the module 'gdbm' as it says here:
sudo apt-get install python3.5-gdbm
I have installed anaconda in mac os sierra. Simple python scripts run fine. However, when I try to run jupyter-notebook it fails.
The error message is following:
Traceback (most recent call last):
File "/Users/poudel/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 10, in <module>
import sqlite3
File "/Users/poudel/anaconda3/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/Users/poudel/anaconda3/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: dlopen(/Users/poudel/anaconda3/lib/python3.6/lib-dynload/_sqlite3.cpython-36m-darwin.so, 2): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /Users/poudel/anaconda3/lib/python3.6/lib-dynload/_sqlite3.cpython-36m-darwin.so
Expected in: /usr/lib/libsqlite3.dylib
in /Users/poudel/anaconda3/lib/python3.6/lib-dynload/_sqlite3.cpython-36m-darwin.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/poudel/anaconda3/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Users/poudel/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 79, in <module>
from .services.sessions.sessionmanager import SessionManager
File "/Users/poudel/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 13, in <module>
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
I checked the dylib file, but it is there. What's wrong here?
Bhishan:ls /usr/lib/libsqlite3.dylib
/usr/lib/libsqlite3.dylib*
Similar problems:
No module named _sqlite3
But they did not solve my problem.
Your problem is most likely due to several python envirionments.
Check this question.
Also this question maybe relevant.
Also try to see all installed packages with conda.
I have faced the same issue.
For me installing sqlite via brew solved the issue.
brew install sqlite
I am new to mysql fabric. I am getting the following error:
root#ajith-System-Product-Name:/home/ajith# mysqlfabric
Traceback (most recent call last):
File "/usr/bin/mysqlfabric", line 33, in <module>
from mysql.fabric import (
ImportError: No module named fabric
I installed mysql-connector-python_2.1.3, mysql-utilities_1.5.6, and python2.7.
Your from statement should use mysqlfabric, not mysql.fabric, as far as I can tell.
I failed While I was starting django project.
python manage.py runserver
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
And I write command line python. Then I failed While import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
Can you hel?
Did you activate your virtual environment? It's basically saying you don't have django installed. Either activate your venv or pip install django.