how to install mysqlclient python library in linux? - python

I have a Django project and I want to deploy it on a server.But I'm unable to connect mysql.
I have tried different alternatives but I can't fixed this problem.(I have kali linux operating system)
This is the error I am receiving when installing mysqlclient:
pip install mysqlclient==2.0.0 1 ⨯
Collecting mysqlclient==2.0.0
Downloading mysqlclient-2.0.0.tar.gz (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.9/87.9 kB 1.4 MB/s eta 0:00:00
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-go97vzkz/mysqlclient_85ab5f5ba17f42dcba9e2b66191c32e1/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-go97vzkz/mysqlclient_85ab5f5ba17f42dcba9e2b66191c32e1/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-go97vzkz/mysqlclient_85ab5f5ba17f42dcba9e2b66191c32e1/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
This is the error I am receiving when I save 'settings.py':
python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/kmandi/anaconda3/lib/python3.8/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 "/home/kmandi/anaconda3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/kmandi/anaconda3/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/core/management/__init__.py", line 398, in execute
autoreload.check_errors(django.setup)()
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "/home/kmandi/anaconda3/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 "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/contrib/auth/models.py", line 3, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/db/models/base.py", line 141, in __new__
new_class.add_to_class("_meta", Options(meta, app_label))
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/db/models/base.py", line 369, in add_to_class
value.contribute_to_class(cls, name)
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/db/models/options.py", line 231, in contribute_to_class
self.db_table, connection.ops.max_name_length()
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/utils/connection.py", line 15, in __getattr__
return getattr(self._connections[self._alias], item)
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/utils/connection.py", line 62, in __getitem__
conn = self.create_connection(alias)
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/db/utils.py", line 193, in create_connection
backend = load_backend(db["ENGINE"])
File "/home/kmandi/anaconda3/lib/python3.8/site-packages/django/db/utils.py", line 113, in load_backend
return import_module("%s.base" % backend_name)
File "/home/kmandi/anaconda3/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/kmandi/anaconda3/lib/python3.8/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?

You will need some additional libraries installed.
Please refer to its project description: https://pypi.org/project/mysqlclient/
Linux
Note that this is a basic step. I can not support complete step for build for all environment. If you can see some error, you should fix it by yourself, or ask for support in some user forum. Don't file a issue on the issue tracker.
You may need to install the Python 3 and MySQL development headers and libraries like so:
$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential # Debian / Ubuntu
% sudo yum install python3-devel mysql-devel # Red Hat / CentOS
Then you can install mysqlclient via pip now:
$ pip install mysqlclient
Hope it helps!

First install python 3.6.5, then run
pip install mysqlclient==1.3.12
sudo apt-get install python-dev default-libmysqlclient-dev
sudo apt-get install python3-dev
pip install mysqlclient
Assume you are activating Python 3 venv
brew install mysql
pip install mysqlclient
Step 1: Installing MySQL Client
You can install MySQL client directly through pip using the command
pip install mysqlclient

Related

Error when installing pyinstaller version 4.3. How to fix it?

When I try to install pyinstaller version 4.3. Then I got unwanted erro that I have pasted below. Please help me to get out of this error.
My current pip version is 22.2. And python version is 3.7.
C:\WINDOWS\system32>pip install --no-cache-dir pyinstaller==4.3
Collecting pyinstaller==4.3
Downloading pyinstaller-4.3.tar.gz (3.7 MB)
---------------------------------------- 3.7/3.7 MB 5.9 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [41 lines of output]
Traceback (most recent call last):
File "c:\users\abhis\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
main()
File "c:\users\abhis\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:\users\abhis\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 164, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\build_meta.py", line 188, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\build_meta.py", line 282, in run_setup
self).run_setup(setup_script=setup_script)
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\build_meta.py", line 174, in run_setup
exec(code, locals())
File "<string>", line 78, in <module>
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 151, in setup
dist.parse_config_files()
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\dist.py", line 865, in parse_config_files
self, self.command_options, ignore_option_errors=ignore_option_errors
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\config\setupcfg.py", line 172, in parse_configuration
meta.parse()
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\config\setupcfg.py", line 451, in parse
section_parser_method(section_options)
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\config\setupcfg.py", line 422, in parse_section
self[name] = value
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\config\setupcfg.py", line 243, in __setitem__
value = parser(value)
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\config\setupcfg.py", line 557, in _parse_version
return expand.version(self._parse_attr(value, self.package_dir, self.root_dir))
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\config\setupcfg.py", line 377, in _parse_attr
return expand.read_attr(attr_desc, package_dir, root_dir)
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\config\expand.py", line 192, in read_attr
module = _load_spec(spec, module_name)
File "C:\Users\abhis\AppData\Local\Temp\pip-build-env-l2t7s_bi\overlay\Lib\site-packages\setuptools\config\expand.py", line 212, in _load_spec
spec.loader.exec_module(module) # type: ignore
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\abhis\AppData\Local\Temp\pip-install-oxwzokmn\pyinstaller_8996853206574e95a5a7117dbcd6cb01\PyInstaller.py", line 16, in <module>
from PyInstaller.__main__ import run
ModuleNotFoundError: No module named 'PyInstaller.__main__'; 'PyInstaller' is not a package
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The error is located specifically in the pyproject.toml file. .toml files are used to do configuration in project using a minimalist language. It's mainly used to point the author of the project and its contact, a server direction with its accessible ports, an url to an API to scrap data, etc.
It seems that its an internal bug in the configuration of that file, which is used on the installment of PyInstaller. I recommend checking if that version is unstable. Try installing the previous one.
pip3 install --no-cache-dir pyinstaller==4.2

Python package does not have setup.py,

I would like to install this library with pip: ikpy library. However pip gives the error below:
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip-build-oYTjdr/ikpy/setup.py'
What I understand from the error, pip cannot find setup.py, becuase library has setup.cfg instead. I tried to upgrade pip and got a different error.
$ pip install --upgrade pip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-KCnfi9/pip/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax
I also tried pip3:
$ pip3 install ikpy
ModuleNotFoundError: No module named 'pip._vendor.pkg_resources'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 13, in <module>
from pip.exceptions import InstallationError, CommandError, PipError
File "/usr/lib/python3/dist-packages/pip/exceptions.py", line 6, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 75, in <module>
vendored("pkg_resources")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2927, in <module>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2913, in _call_aside
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 956, in subscribe
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in <lambda>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2515, in activate
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2097, in declare_namespace
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2047, in _handle_ns
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'
What should I do?
Python 3.7.10, python3-pip: (8.1.1-2ubuntu0.6).
Note:
I solved with these commands, now it can be installed with pip3:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
pip3 install --upgrade setuptools
(this message was created before the question was updated with pip3)
It's likely that the pip command you use is for Python 2. Can you try with pip3 instead?
From ikpy library:
Starting with IKPy v3.1, only Python 3 is supported.
For versions before v3.1, the library can work with both versions of Python (2.7 and 3.x).
You can download the latest version compatible with python 2 here:
https://github.com/Phylliade/ikpy/releases/tag/v3.0.1
note: using python 2.7 is not recommended because support for Python version 2.7 will end on January 1, 2020
Upgrade Your Pip
pip install --upgrade pip
then install ikpy Now it's should up and running ;-)
pip install ikpy
Installed and Checked now on: Ubuntu 20.04, Pip 21.3, Python 3.8.10

ImportError: No module named 'setuptools.build_meta'

I'm having trouble figuring this one out -- when trying to install a package (zipline in this case), it's struggling to find the setuptools.build_meta file, which I DO HAVE in the site-packages\setuptools directory. As ignorant as I am, I tried dropping this file into the site-packages\pip_vendor\pep517 directly with no change. I'm sure this is simple, but I'm not seeing it. Any help would be appreciated!
The trace back is below.
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _main
status = self.run(options, args)
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\commands\install.py", line 331, in run
resolver.resolve(requirement_set)
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\legacy_resolve.py", line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\legacy_resolve.py", line 282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\operations\prepare.py", line 516, in prepare_linked_requirement
req, self.req_tracker, self.finder, self.build_isolation,
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\operations\prepare.py", line 95, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\distributions\sdist.py", line 38, in prepare_distribution_metadata
self._setup_isolation(finder)
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_internal\distributions\sdist.py", line 96, in _setup_isolation
reqs = backend.get_requires_for_build_wheel()
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_vendor\pep517\wrappers.py", line 152, in get_requires_for_build_wheel
'config_settings': config_settings
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_vendor\pep517\wrappers.py", line 255, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
File "C:\Users\justjo\PycharmProjects\python35_venv\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 63, in _build_backend
obj = import_module(mod_path)
File "C:\Program Files\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
ImportError: No module named 'setuptools.build_meta'
So for anyone having the same error I solved this by downloading the package directly and deleting the pyproject.toml file, then cd path\setup.py and "pip install ." in a terminal/cmd.
In my case, i downgraded my pip version to 9.0.1 using python -m pip install pip==9.0.1 and it worked for me
I resolved it by upgrading setuptools version to the latest:
sudo /usr/bin/python3.9 /usr/bin/pip3 install setuptools==58.0.4
Other versions:
/usr/bin/python3.9 /usr/bin/pip3 --version
pip 20.0.2 from /usr/lib/python3.9/dist-packages/pip (python 3.9)
/usr/bin/python3.9 --version
Python 3.9.5
lsb_release -d
Description: Ubuntu 20.04.2 LTS
uname -srvi
Linux 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64

How to install pgadmin4 on Ubuntu

I am trying to install pgadmin4 on ubuntu vps server but i am unable to install . I am getting this error
postgres version 12.2
ubuntu version 18.04
unable to figure out this error , any help would be appreciated tried everything but didnot worked
Setting up pgadmin4-apache2 (4.18-1.pgdg18.04+1) ...
apache2_invoke pgadmin4: already enabled
Traceback (most recent call last):
File "setup.py", line 413, in <module>
setup_db()
File "setup.py", line 347, in setup_db
app = create_app()
File "/usr/share/pgadmin4/web/pgadmin/__init__.py", line 400, in create_app
driver.init_app(app)
File "/usr/share/pgadmin4/web/pgadmin/utils/driver/__init__.py", line 40, in init_app
DriverRegistry.load_drivers()
File "/usr/share/pgadmin4/web/pgadmin/utils/driver/registry.py", line 88, in load_drivers
module = import_module(module_name)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/share/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py", line 28, in <module>
from .server_manager import ServerManager
File "/usr/share/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 30, in <module>
from sshtunnel import SSHTunnelForwarder, BaseSSHTunnelForwarderError
File "/usr/lib/python3/dist-packages/sshtunnel.py", line 25, in <module>
import paramiko
File "/usr/lib/python3/dist-packages/paramiko/__init__.py", line 30, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 66, in <module>
from paramiko.sftp_client import SFTPClient
File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 41, in <module>
from paramiko.sftp_file import SFTPFile
File "/usr/lib/python3/dist-packages/paramiko/sftp_file.py", line 66
self._close(async=True)
^
SyntaxError: invalid syntax
dpkg: error processing package pgadmin4-apache2 (--configure):
installed pgadmin4-apache2 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
pgadmin4-apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)
Solution for me was explicitly install package python3-paramiko:
apt-get install python3-paramiko
Resulted in:
Preparing to unpack .../python3-paramiko_2.6.0-2_all.deb ...
Unpacking python3-paramiko (2.6.0-2) over (2.0.0-1ubuntu1.2) ...
Setting up python3-bcrypt (3.1.7-2ubuntu1) ...
Setting up python3-cryptography (2.8-3ubuntu0.1) ...
Setting up pgadmin4-apache2 (4.25-1.pgdg20.04+1) ...
pgAdmin 4 - Application Initialisation
======================================
Setting up python3-nacl (1.3.0-5) ...
Setting up python3-paramiko (2.6.0-2) ...
Happened during release upgrade from 18.04 to 20.04. Error traceback was the same.
from pgadmin website:
Setup the repository
Install the public key for the repository (if not done previously):
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
Create the repository configuration file:
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
Install pgAdmin
Install for both desktop and web modes:
sudo apt install pgadmin4
Install for desktop mode only:
sudo apt install pgadmin4-desktop
Install for web mode only:
sudo apt install pgadmin4-web
Configure the webserver, if you installed pgadmin4-web:
sudo /usr/pgadmin4/bin/setup-web.sh
As printed in log issue is in
File "/usr/lib/python3/dist-packages/paramiko/sftp_file.py", line 66
self._close(async=True)
The problem seems to be with the name choosen for the variable async set to True in the above example.
async is also a python command, so I suppose Python interpret async as the python command not a variable.
I renamed all async variable to aasync in file "/usr/lib/python3/dist-packages/paramiko/sftp_file.py" and then try to install python3-paramiko.
I have no error anymore.

Tango With Django ModuleNotFoundError: No module named 'registration'

I have cloned this repository as part of a tutorial and gone into the directory tango_with_django_19/code/tango_with_django_project to run the command:
$ python maange.py runserver
In order to run the web app. However, I received the following errors:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f6e2c1782f0>
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run
autoreload.raise_last_exception()
File "/usr/lib/python3.6/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/usr/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'registration'
I am using Manjaro Linux and have installed the packages python-django and python-django-extensions with pacman.
How can I resolve this error so that I can run the web app? I have not changed after cloning the aforementioned repo.
You need to install the project dependencies.
run pip install -r requirements.txt in tango_with_django_19/code to install them.
Then migrate and runserver
You're missing django-registration-redux package. It is specified in requirements.txt file as necessary to run project. You could install it via pip install -r requirements.txt
if you get the error after pip install django-registration-redux you can try easy_install django-registration-redux it worked for me.

Categories