Flask, wsgi and deploy - python

(pardon my english)
Hello,
I've a problem for a deploy on a gandi server.
After a git push on a gandi server, I'm proceeding a deploy :
ssh [url] deploy default.git
I obtain an "Internal Error Server".
My log/www/uwsgi.log said :
Traceback (most recent call last):
File "/srv/data/web/vhosts/default/wsgi.py", line 1, in <module>
from run import app as application
File "./run.py", line 1, in <module>
from app import app as application
File "./app/__init__.py", line 1, in <module>
from flask import Flask
File "/srv/data/web/vhosts/default/local/lib/python3.6/site-packages/flask/__init__.py", line 19, in <module>
from jinja2 import Markup, escape
File "/srv/data/web/vhosts/default/local/lib/python3.6/site-packages/jinja2/__init__.py", line 82, in <module>
_patch_async()
File "/srv/data/web/vhosts/default/local/lib/python3.6/site-packages/jinja2/__init__.py", line 78, in _patch_async
from jinja2.asyncsupport import patch_all
File "/srv/data/web/vhosts/default/local/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 13, in <module>
import asyncio
File "/opt/python-3.6/usr/lib/python3.6/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/python-3.6/usr/lib/python3.6/asyncio/base_events.py", line 17, in <module>
import concurrent.futures
File "/opt/python-3.6/usr/lib/python3.6/concurrent/futures/__init__.py", line 17, in <module>
from concurrent.futures.process import ProcessPoolExecutor
File "/opt/python-3.6/usr/lib/python3.6/concurrent/futures/process.py", line 55, in <module>
from multiprocessing.connection import wait
File "/opt/python-3.6/usr/lib/python3.6/multiprocessing/connection.py", line 23, in <module>
from . import util
File "/opt/python-3.6/usr/lib/python3.6/multiprocessing/util.py", line 17, in <module>
from subprocess import _args_from_interpreter_flags
File "/opt/python-3.6/usr/lib/python3.6/subprocess.py", line 136, in <module>
import _posixsubprocess
ImportError: /srv/data/web/vhosts/default/local/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_set_inheritable_async_safe
I have not idea how can I solve this problem... ?
Anyone understand this problem ? Thank you

Related

GOT TypeError: deprecated() got an unexpected keyword argument 'name' in boto3

Boto3 was running successfully the day before but when i ran today i am getting these errors
import boto3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/root1/.local/lib/python3.10/site-packages/boto3/__init__.py", line 16, in <module>
from boto3.session import Session
File "/home/root1/.local/lib/python3.10/site-packages/boto3/session.py", line 17, in <module>
import botocore.session
File "/home/root1/.local/lib/python3.10/site-packages/botocore/session.py", line 29, in <module>
import botocore.credentials
File "/home/root1/.local/lib/python3.10/site-packages/botocore/credentials.py", line 35, in <module>
from botocore.config import Config
File "/home/root1/.local/lib/python3.10/site-packages/botocore/config.py", line 16, in <module>
from botocore.endpoint import DEFAULT_TIMEOUT, MAX_POOL_CONNECTIONS
File "/home/root1/.local/lib/python3.10/site-packages/botocore/endpoint.py", line 24, in <module>
from botocore.awsrequest import create_request_object
File "/home/root1/.local/lib/python3.10/site-packages/botocore/awsrequest.py", line 24, in <module>
import botocore.utils
File "/home/root1/.local/lib/python3.10/site-packages/botocore/utils.py", line 32, in <module>
import botocore.httpsession
File "/home/root1/.local/lib/python3.10/site-packages/botocore/httpsession.py", line 28, in <module>
from urllib3.contrib.pyopenssl import orig_util_SSLContext as SSLContext
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
import OpenSSL.SSL
File "/home/root1/.local/lib/python3.10/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import SSL, crypto
File "/home/root1/.local/lib/python3.10/site-packages/OpenSSL/SSL.py", line 19, in <module>
from OpenSSL.crypto import (
File "/home/root1/.local/lib/python3.10/site-packages/OpenSSL/crypto.py", line 3224, in <module>
utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'
i tried uninstalling and reinstalling also tried out installing specific version
still getting an error
i am using it on ubuntu 22.0
the python version i am running
Python 3.10.6

ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found

I'm trying to install bern2 locally. bern2 installed successfully. when I started running, I got this error.
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/../../../libfaiss.so)
from normalizers.neural_normalizer import NeuralNormalizer
File "/home/ubuntu/BERN2/BERN2/normalizers/neural_normalizer.py", line 17, in <module>
import faiss
File "/opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/__init__.py", line 18, in <module>
from .loader import *
File "/opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/loader.py", line 65, in <module>
from .swigfaiss import *
File "/opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/swigfaiss.py", line 10, in <module>
from . import _swigfaiss
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/../../../libfaiss.so)
Traceback (most recent call last):
File "/home/ubuntu/BERN2/BERN2/server.py", line 1, in <module>
from app import create_app
File "/home/ubuntu/BERN2/BERN2/app/__init__.py", line 12, in <module>
import bern2
File "/home/ubuntu/BERN2/BERN2/bern2/__init__.py", line 1, in <module>
from bern2.bern2 import BERN2
File "/home/ubuntu/BERN2/BERN2/bern2/bern2.py", line 22, in <module>
from normalizer import Normalizer
File "/home/ubuntu/BERN2/BERN2/bern2/normalizer.py", line 11, in <module>
from normalizers.neural_normalizer import NeuralNormalizer
File "/home/ubuntu/BERN2/BERN2/normalizers/neural_normalizer.py", line 17, in <module>
import faiss
File "/opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/__init__.py", line 18, in <module>
from .loader import *
File "/opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/loader.py", line 65, in <module>
from .swigfaiss import *
File "/opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/swigfaiss.py", line 10, in <module>
from . import _swigfaiss
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /opt/conda/envs/bern2/lib/python3.11/site-packages/faiss/../../../libfaiss.so)
The reason could be that the system path is not configured correctly. Try this,
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
Source:
https://www.tensorflow.org/install/pip

AttributeError: partially initialized module 'logging' has no attribute 'getLogger' (most likely due to a circular import)

I wrote imports as usual, but it is wrong. I searched and did not find a mistake like mine, please help. The file name is main.py .
Traceback (most recent call last):
File "/app/main.py", line 2, in <module>
from telethon import TelegramClient, Button, events, version
File "/usr/local/lib/python3.9/site-packages/telethon/__init__.py", line 1, in <module>
from .client.telegramclient import TelegramClient
File "/usr/local/lib/python3.9/site-packages/telethon/client/__init__.py", line 12, in <module>
from .telegrambaseclient import TelegramBaseClient
File "/usr/local/lib/python3.9/site-packages/telethon/client/telegrambaseclient.py", line 3, in <module>
import asyncio
File "/usr/local/lib/python3.9/asyncio/__init__.py", line 8, in <module>
from .base_events import *
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 18, in <module>
import concurrent.futures
File "/usr/local/lib/python3.9/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 7, in <module>
import logging
File "/usr/local/lib/python3.9/logging/__init__.py", line 28, in <module>
from string import Template
File "/app/string.py", line 7, in <module>
from telethon import TelegramClient, events
File "/usr/local/lib/python3.9/site-packages/telethon/events/__init__.py", line 1, in <module>
from .raw import Raw
File "/usr/local/lib/python3.9/site-packages/telethon/events/raw.py", line 1, in <module>
from .common import EventBuilder
File "/usr/local/lib/python3.9/site-packages/telethon/events/common.py", line 5, in <module>
from .. import utils
File "/usr/local/lib/python3.9/site-packages/telethon/utils.py", line 22, in <module>
from .extensions import markdown, html
File "/usr/local/lib/python3.9/site-packages/telethon/extensions/markdown.py", line 9, in <module>
from ..helpers import add_surrogate, del_surrogate, within_surrogate, strip_text
File "/usr/local/lib/python3.9/site-packages/telethon/helpers.py", line 20, in <module>
_log = logging.getLogger(__name__)
AttributeError: partially initialized module 'logging' has no attribute 'getLogger' (most likely due to a circular import)
I had similar issue, my python file was called token.py. Once I renamed it into something else the problem went away.

Python importing messages module not working

I am trying to parse some protobuf messages and importing the messages module. However getting below error. Not sure what I am missing.
Please advise.
>>> import messages
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/messages/__init__.py", line 7, in <module>
from .api import send
File "/usr/local/lib/python3.8/dist-packages/messages/api.py", line 3, in <module>
from .email_ import Email
File "/usr/local/lib/python3.8/dist-packages/messages/email_.py", line 15, in <module>
from ._config import check_config_file
File "/usr/local/lib/python3.8/dist-packages/messages/_config.py", line 12, in <module>
import jsonconfig
File "/usr/local/lib/python3.8/dist-packages/jsonconfig/__init__.py", line 7, in <module>
from .core import Config
File "/usr/local/lib/python3.8/dist-packages/jsonconfig/core.py", line 11, in <module>
from .jsonutils import to_json_file, from_json_file
File "/usr/local/lib/python3.8/dist-packages/jsonconfig/jsonutils.py", line 29, in <module>
to_json = box._to_json
AttributeError: module 'box' has no attribute '_to_json'

super error while programming a discord BOT with python

I'm new to python, and I was creating a Bot to discord by PyCharm when suddenly there was this giant error below, I already reinstalled python, tried configuring the PATHs for python 3.7 and 3.6, changed IDE and continues giving this error, can anyone help me figure out what's causing this?
error below:
C:\Users\Pichau\AppData\Local\Programs\Python\Python36\python.exe C:/Users/Pichau/Documents/cursos/programacao/Discord/main.py
Traceback (most recent call last):
File "C:/Users/Pichau/Documents/cursos/programacao/Discord/main.py", line 1, in <module>
import discord
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\__init__.py", line 20, in <module>
from .client import Client, AppInfo, ChannelPermissions
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 28, in <module>
from .user import User
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\user.py", line 27, in <module>
from .utils import snowflake_time
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\utils.py", line 31, in <module>
import asyncio
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\asyncio\__init__.py", line 21, in <module>
from .base_events import *
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", line 17, in <module>
import concurrent.futures
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\concurrent\futures\__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\concurrent\futures\_base.py", line 7, in <module>
import logging
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\logging\__init__.py", line 26, in <module>
import sys, os, time, io, traceback, warnings, weakref, collections
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\traceback.py", line 5, in <module>
import linecache
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\linecache.py", line 11, in <module>
import tokenize
File "C:\Users\Pichau\AppData\Local\Programs\Python\Python36\lib\tokenize.py", line 41, in <module>
__all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
AttributeError: module 'token' has no attribute '__all__'
Process finished with exit code 1
Image of error
I would check the code, unless it won’t let you, then you should probably put the code in notepad, and save it then delete the file, and try again. It probably is a computer error more then a coding error.

Categories