Python 3.8 pytest-qt ModuleNotFoundError: No module named 'PyQt4' - python

I have created my project on Linux mint 19 with python 3.6 installed. I used pytest in conjunction with pytest-qt to test my app which is a PyQt5 program.
Then, I've updated to Linux mint 20. However python 3.8 is installed there instead of 3.6. I don't know whether it's related or not but now I can't run my test suite anymore, when I type pytest in terminal it gives me the following output:
Traceback (most recent call last):
File "/home/kotlin/.local/bin/pytest", line 8, in <module>
sys.exit(console_main())
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 187, in console_main
code = main()
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 143, in main
config = _prepareconfig(args, plugins)
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
File "/home/kotlin/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/kotlin/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/kotlin/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/kotlin/.local/lib/python3.8/site-packages/pluggy/callers.py", line 203, in _multicall
gen.send(outcome)
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
config = outcome.get_result() # type: Config
File "/home/kotlin/.local/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/kotlin/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
self.parse(args)
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1280, in parse
self._preparse(args, addopts=addopts)
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1172, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "/home/kotlin/.local/lib/python3.8/site-packages/pluggy/manager.py", line 299, in load_setuptools_entrypoints
plugin = ep.load()
File "/usr/lib/python3.8/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 171, in exec_module
exec(co, module.__dict__)
File "/home/kotlin/.local/lib/python3.8/site-packages/pytestqt/plugin.py", line 7, in <module>
from pytestqt.qt_compat import QtCore, QtGui, QtTest
File "/home/kotlin/.local/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 171, in exec_module
exec(co, module.__dict__)
File "/home/kotlin/.local/lib/python3.8/site-packages/pytestqt/qt_compat.py", line 31, in <module>
import PyQt4.QtCore as _QtCore
ModuleNotFoundError: No module named 'PyQt4'
At the end it says ModuleNotFoundError: No module named 'PyQt4' but I don't even use PyQt4, I use PyQt5 instead.
I have pytest and pytest-qt both installed. The program itself works properly.
Thanks.

This part of the error message:
File "/home/kotlin/.local/lib/python3.8/site-packages/pytestqt/qt_compat.py", line 31, in <module>
import PyQt4.QtCore as _QtCore
ModuleNotFoundError: No module named 'PyQt4'
hints at the problem - the used qt-pytest version still references PyQt4, while the current version has these references removed some time ago -- meaning the installed python-qt version is outdated. The version can be updated using
pip3 install -U pytest-qt
as mentioned in the comments. It is still unclear why an old version was installed in the first place - one possibility is that an old version already had been installed by some other package, installing it via pip (without the update option) would not do anything in this case.

Related

Pip is broken, gives PermissionError: [WinError 32]

I installed the python-certifi-win32 module (I'm so busy trying to fix this problem that I don't even remember why I originally installed it). Right after I installed it, though, I started getting this error when I run pip (extended error code below): PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c'
When I delete the file C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c, another file pops up in its place, just with a different random combination of letters and numbers, and the error says the new file name instead.
I have no idea how to fix it, my pip hasn't been working for days. I've looked through tens of pages of google results.
Full error code:
Traceback (most recent call last):
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\requests\__init__.py", line 135, in <module>
from . import utils
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\requests\utils.py", line 27, in <module>
from . import certs
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_pip.py", line 35, in apply_patches
import certifi
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c'
I ran into the same problem after installing python-certifi-win32. I installed this package in the hope to solve errors caused by the self-signed certificate used by our SSL Inspection infrastructure.
To bring pip back to a running state remove python-certifi-win32 from the installation folder:
Determine the installation path for pip packages (source):
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
Switch to the folder and delete the package's files:
del python-certifi-win32-init.pth
rmdir /s/q python_certifi_win32-1.6.dist-info
I could observe the same error pattern when upgrading from Python 3.9 to Python 3.10. Somehow python-certifi-win32 seems to be malfunctioning in certain scenarios then.
Andrew Leech, the author of python-certifi-win32, suggests to move on to his other project pip-system-certs . Drop-in replacing the library with pip-system-certs (PyPI link) solved all issues for me.
the only solution to this problem is to delete Python from control panel.Then completely delete the Python folder from the address below
windows:
C:\Users\user1\AppData\Local\Programs\python
and linux base:
/bin/python3

Python 3.10/Django 3.2.7: No module named 'MySQLdb'

This week I started working home and tried installing my project on my PC but it won't work.
I cloned the git repo, installed MySQL Workbench and Server and stuff, installed Visual C++ stuffs
and loads of modules from my requirements.txt.
But when I try to run ./manage.py migrate it spits out this:
$ py manage.py migrate
Traceback (most recent call last):
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\db\backends\mysql\base.py", line 15, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\lisa-\projects\register\manage.py", line 22, in <module>
main()
File "C:\Users\lisa-\projects\register\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\core\management\__init__.py", line 395, in execute
django.setup()
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\apps\config.py", line 301, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\lisa-\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\contrib\auth\models.py", line 3, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\contrib\auth\base_user.py", line 48, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\db\models\base.py", line 122, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\db\models\base.py", line 326, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\db\models\options.py", line 207, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\utils\connection.py", line 15, in __getattr__
return getattr(self._connections[self._alias], item)
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\utils\connection.py", line 62, in __getitem__
conn = self.create_connection(alias)
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\db\utils.py", line 204, in create_connection
backend = load_backend(db['ENGINE'])
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\db\utils.py", line 111, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Users\lisa-\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\lisa-\projects\register\venv\lib\site-packages\django\db\backends\mysql\base.py", line 17, in <module>
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
Now I did install mysqlclient:
$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.1.0-cp310-cp310-win_amd64.whl (180 kB)
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.1.0
All of this is happening with a newly made venv using python 3.10, Django 3.2.7 and SQL Server 8.0
I googled about 2 hours which didn't help at all, because all I could find was "use pip install mysqlclient", which I obviously did. Sometimes I find things like "install using a wheel file". But I can't find a wheel file for 3.10. Or "use pip install mysql-python" or something like that but then I get an error saying I need Visual C++ 14.0, which I'm pretty sure I have...
So, I'm lost. Please please help me out.

Error with command $python3 manage.py migrate

I'm new to Django and I am running Django inside a virtualenv on MacOS with python 3.6. The command $python3 manage.py migrate but I keep getting an error asking me to install mysqlclient.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
import MySQLdb as Database
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/_mysql.cpython-36m-darwin.so, 2): Library not loaded: #rpath/libmysqlclient.20.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/_mysql.cpython-36m-darwin.so
Reason: image not found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
django.setup()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
app_config.import_models()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/base.py", line 114, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/base.py", line 315, in add_to_class
value.contribute_to_class(cls, name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/models/options.py", line 205, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/utils.py", line 202, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
pip3 freeze looks like this:
Django==2.0.1
mysqlclient==1.3.12
pytz==2017.3
Which other driver would I be able to use?
I am running it in the virtual environment that I created. Also pip install MySQL-python doesn't work on my Mac as python 2.7 comes pre-installed and to run Django 2.0, I installed Python 3.6 and for that when I run pip3 install MySQL-python, I get an No Module named 'ConfigParser' error.
Try
pip3 install
Instead of pip install
Since you are using python 3
And check if python3-dev is installed in your system

ImportError: No module named 'spiders'

On the command line I'm executing the following simple attempt to invoke scrapy:
scrapy version
I get the following error:
$ scrapy version
Traceback (most recent call last):
File "/Users/nathanielford/virtualenvironments/crawler/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/site-packages/scrapy/cmdline.py", line 141, in execute
cmd.crawler_process = CrawlerProcess(settings)
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/site-packages/scrapy/crawler.py", line 238, in __init__
super(CrawlerProcess, self).__init__(settings)
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/site-packages/scrapy/crawler.py", line 129, in __init__
self.spider_loader = _get_spider_loader(settings)
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/site-packages/scrapy/crawler.py", line 325, in _get_spider_loader
return loader_cls.from_settings(settings.frozencopy())
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/site-packages/scrapy/spiderloader.py", line 33, in from_settings
return cls(settings)
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/site-packages/scrapy/spiderloader.py", line 20, in __init__
self._load_all_spiders()
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/site-packages/scrapy/spiderloader.py", line 28, in _load_all_spiders
for module in walk_modules(name):
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/site-packages/scrapy/utils/misc.py", line 63, in walk_modules
mod = import_module(path)
File "/Users/nathanielford/virtualenvironments/crawler/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'spiders'
If I leave my project directory, the error no longer occurs:
$ scrapy version
Scrapy 1.2.2
What is causing the ImportError: No module named 'spiders'?
This error was caused by my settings.py file, where the I had the following:
SPIDER_MODULES = ['spiders']
While it is in the default project provided by scrapy, I had moved that module. Values in that list need to be fully qualified module names: even trivial executions of scrapy will load the settings file, and thus try to import modules from your project. If it can find a settings file, it will need to be correct.

sqlite and pyvenv and django

I am new to both python and django. I am trying to get python 3.4 and django 1.6.4 working within a pyvenv-3.4 environment on Linux Mint Mate 13. I followed the procedures of Using a virtual environment with Python 3.4 for "Building Python 3.4 from source" and "Using pyvenv-3.4". Then following the Django tutorial at Writing your first Django app, I was able to create "mysite" with startproject. But the command "python manage.py runserver" failed with
django.core.exceptions.
ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules
(tried in that order):
No module named '_sqlite3'
Sorry, I do not recall why I resorted to compiling from source, but it may be that I was unable to find pyvenv in the standard Ubuntu downloads using apt-get. In any case, the Makefile for the source distribution does not have an "uninstall" target, so it seems I am stuck with whatever make installed, and without a plan for what to do next to actually get pyvenv-python-django working.
I am updating this post by attaching the full error:
$ python manage.py runserver
Traceback (most recent call last):
File "/local/djenv/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 30, 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 "/local/djenv/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 32, in <module>
from sqlite3 import dbapi2 as Database
File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 26, in <module>
from _sqlite3 import *
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)
File "/local/djenv/lib/python3.4/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/local/djenv/lib/python3.4/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/local/djenv/lib/python3.4/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/local/djenv/lib/python3.4/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/local/djenv/lib/python3.4/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/local/djenv/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/local/djenv/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/local/djenv/lib/python3.4/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/usr/local/lib/python3.4/importlib/__init__.py", line 104, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1448, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/local/djenv/lib/python3.4/site-packages/django/contrib/admin/__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "/local/djenv/lib/python3.4/site-packages/django/contrib/admin/sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "/local/djenv/lib/python3.4/site-packages/django/contrib/admin/forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "/local/djenv/lib/python3.4/site-packages/django/contrib/auth/forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "/local/djenv/lib/python3.4/site-packages/django/contrib/auth/models.py", line 48, in <module>
class Permission(models.Model):
File "/local/djenv/lib/python3.4/site-packages/django/db/models/base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "/local/djenv/lib/python3.4/site-packages/django/db/models/base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "/local/djenv/lib/python3.4/site-packages/django/db/models/options.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/local/djenv/lib/python3.4/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/local/djenv/lib/python3.4/site-packages/django/db/utils.py", line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "/local/djenv/lib/python3.4/site-packages/django/db/utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "/usr/local/lib/python3.4/importlib/__init__.py", line 104, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/local/djenv/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 35, in <module>
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'
It sounds like you didn't have the SQLite development libraries installed at the time you built CPython from source. The build process conditionally includes some features based the availability of underlying development libraries.
On Debian GNU/Linux and derivatives, install libsqlite3-dev. Then re-run ./configure, make and make install.

Categories