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.
Related
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
Before someone slaps my hand, I had installed venv/virtualenv to setup virtual environments but I had other issues so someone suggested I upgrade my pip3 version to the current version (22.0.4 right now)
I somehow messed up both pip and pip3 so hopefully someone can help me.
I tried to upgrade my version of pip on my Ubuntu 16.04 box by running
pip3 install --upgrade pip
I also tried running
pip3 install --upgrade pip3
After upgrading, I kept getting errors when trying to run pip3 so I removed it, planning to install with the get-pip.py script.
However, now when I try to install pip3 using
sudo python3 /tmp/get-pip.py
I keep getting an AttributeError:
$ sudo python3 /tmp/get-pip.py
Traceback (most recent call last):
File "/tmp/get-pip.py", line 27077, in <module>
main()
File "/tmp/get-pip.py", line 135, in main
bootstrap(tmpdir=tmpdir)
File "/tmp/get-pip.py", line 111, in bootstrap
monkeypatch_for_cert(tmpdir)
File "/tmp/get-pip.py", line 92, in monkeypatch_for_cert
from pip._internal.commands.install import InstallCommand
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 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/tmpu1lmh2fr/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
...
...
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 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/tmp/tmpu1lmh2fr/pip.zip/pip/_vendor/pyparsing.py", line 5677, in <module>
File "/tmp/tmpu1lmh2fr/pip.zip/pip/_vendor/pyparsing.py", line 1488, in setResultsName
File "/tmp/tmpu1lmh2fr/pip.zip/pip/_vendor/pyparsing.py", line 1491, in _setResultsName
File "/tmp/tmpu1lmh2fr/pip.zip/pip/_vendor/pyparsing.py", line 1445, in copy
AttributeError: module 'copy' has no attribute 'copy'
Can someone point me to instructions on how to re-install pip/pip3 or how to get around this AttributeError? Hopefully the solution will also keep my old modules that I had downloaded from before too. Thanks
Check if there is a file /tmp/copy.py or directory+file /tmp/copy/__init__.py. Try these commands: sudo python3 -c "import copy; print(copy.copy)" and sudo python3 -c "import copy; print(copy.__file__)"
If any of those exists it will be imported instead of standard module copy because Python prepends the directory of a script (the script is /tmp/get-pip.py, the directory /tmp/) at the beginning of sys.path so it's where Python starts to find modules/packages.
I am a new python programmer and was testing out pyttsx3, I am trying to use nsss. However when I run the following code
import pyttsx3
engine=pyttsx3.init('nsss')
engine.say ("Top of the morning")
# angine=pyttsx3.init()
# angine.say("Why hello there")
# angine.runAndWait()
It says error Foundation module not found, so I installed it with pip install foundation. This installs foundation and django version 1.10.8 which to my understanding is not compatible with python v 3.9. But when I install Django version 3.1.7, that version is not compatible with Foundation.
The error logs are below
C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\python.exe "C:/Users/Ahmed_Abdelmuniem/PycharmProjects/AI Engine/main.py"
Traceback (most recent call last):
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\weakref.py", line 134, in __getitem__
o = self.data[key]()
KeyError: 'nsss'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Ahmed_Abdelmuniem\PycharmProjects\AI Engine\main.py", line 3, in <module>
engine=pyttsx3.init('nsss')
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\drivers\nsss.py", line 2, in <module>
from Foundation import *
ModuleNotFoundError: No module named 'Foundation'
Process finished with exit code 1
install the necessary libraries and run in separate virtual environment
sudo apt-get install python-espeak
sudo apt-get update && sudo apt-get install espeak
using python3.9 with virtual environment,
python3.9 -m venv env
source env/bin/activate
pip install pyttsx3
now running the below demo code should work.
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
I have a Django app running on an old CentOS 7 box, and to have my own python3 environment there I'm using venv and pip. Today I rebuilt my environment, and suddenly, I had an ssl related backtrace.
[root#miketug1 teleworker]# vpython manage.py showmigrations
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/tug/env/lib64/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/usr/lib/tug/env/lib64/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/usr/lib/tug/env/lib64/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/lib/tug/env/lib64/python3.6/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/usr/lib/tug/env/lib64/python3.6/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib64/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 "/etc/e-smith/web/django/teleworker/dashboard/models.py", line 9, in <module>
import teleworker.lib.common as commonlib
File "/etc/e-smith/web/django/teleworker/lib/common.py", line 35, in <module>
import requests
File "/usr/lib/tug/env/lib64/python3.6/site-packages/requests/__init__.py", line 95, in <module>
from urllib3.contrib import pyopenssl
File "/usr/lib/tug/env/lib64/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/usr/lib/tug/env/lib64/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/tug/env/lib64/python3.6/site-packages/OpenSSL/SSL.py", line 664, in <module>
_lib.Cryptography_HAS_TLSEXT_HOSTNAME, "SNI not available"
AttributeError: module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'
The versions of my modules are set in a requirements.txt file, which did not change. I was running pyOpenSSL 19.0.0, with Python 3.6. I upgraded to pyOpenSSL 20.0.0 and the problem went away, but I am confused as to how this could happen unless the 19.0.0 version on PyPI was changed, as I've used fixed versions of this module for some time now.
Can anyone explain what happened here? I'd like to avoid anything similar in the future. Thanks.
The root cause for this issue is the latest cryptography-3.3 package which was released 20 hours ago; unfortunately, the pyopenssl-19 has a weird requirement (cryptography >=2.3) hence the pip install automatically upgraded the cryptography to 3.3.
We have both pip and pip3 installed. So the following sequence is what fixed it for me:
sudo apt update; pip install -U cryptography; sudo apt remove python3-openssl -y; sudo apt autoremove; pip3 install -U cryptography;
I think I found it. I didn't have the cryptography module in my requirements.txt, so it was upgraded to the latest version without upgrading pyOpenSSL which was in my requirements.txt file. Seems like some kind of dependency should have prevented this, but I'm updating my requirements.txt to include everything now.
There's a new cryptography 3.3.1 which fixes the issue
I have Python installed on the Mac. If I run python -V it outputs 3.7.2
If I run the following:
virtualenv venv
source venv/bin/activate
python -V
I see 3.7.2.
If I try to run nose I get this error:
$ nosetests -s -v config_test.test_config:TestConfiguration
Failure: ModuleNotFoundError (No module named 'boto3') ... ERROR
======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'boto3')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 234, in load_module
return load_source(name, filename, file)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 675, in _load
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/Users/me/git/sdk-python-config/config_test/config_sdk.py", line 4, in <module>
import boto3
ModuleNotFoundError: No module named 'boto3'
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (errors=1)
I'm immediately concerned with the 3.6 references.
If I then run pip install boto3 I can see the package when I run pip list however I get the same error as above when I try running my applicaiton again.
I've tried pyenv global 3.7.2 and pyenv local 3.7.2 but neither makes any difference.
Can anybody suggest what the problem might be?
nose wasn't installed in the venv. After I installed it with pip install nose I had to deactivate the venv and reactivate it.