I have been trying run flask db upgrade but I keep getting this error in one of the files. The import for scrypt in hashlib file does exist so I do not know why this error keeps coming up.
Usage: flask db upgrade [OPTIONS] [REVISION]
Try 'flask db upgrade --help' for help.
Error: While importing 'manage', an ImportError was raised:
Traceback (most recent call last):
File "/Users/urmm/.local/share/virtualenvs/Backend-rCOuW7xE/lib/python3.8/site-packages/flask/cli.py", line 256, in locate_app
__import__(module_name)
File "/Users/urmm/Documents/Something/Backend/manage.py", line 17, in <module>
app = create_app(os.environ.get('FLASK_ENV') or 'default') # pylint: disable=invalid-name
File "/Users/urmm/Documents/Something/Backend/app/__init__.py", line 28, in create_app
from app.api.v1 import api as api_v1_blueprint
File "/Users/urmm/Documents/Something/Backend/app/api/v1/__init__.py", line 8, in <module>
from . import (customers, focus_group, common, auth, tenders_match, buyers, news, bonding, notifications,
File "/Users/urmm/Documents/Something/Backend/app/api/v1/customers.py", line 17, in <module>
from app.models import Customer, EmailVerification
File "/Users/urmm/Documents/Something/Backend/app/models/__init__.py", line 10, in <module>
from .user_accounts import SomethingUser
File "/Users/urmm/Documents/Something/Backend/app/models/user_accounts.py", line 6, in <module>
from modules.crypto import (SALT_LENGTH, SCRYPT_KEY_LENGTH,
File "/Users/urmm/Documents/Something/Backend/modules/crypto.py", line 3, in <module>
from hashlib import scrypt
ImportError: cannot import name 'scrypt' from 'hashlib' (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/hashlib.py)
I am using python 3.8 and LibreSSL version 2.8.3 (I think this is the latest version).
Related
I'm trying to use the TikTokPy but there is an error occurring in Greenlet module:
$ python quickstart.py
Traceback (most recent call last):
File "C:\Users\mngoc\tiktokpy\quickstart.py", line 2, in <module>
from tiktokpy import TikTokPy
File "C:/Users\mngoc\tiktokpy/tiktokpy/__init__.py", line 1, in <module>
from .bot import TikTokPy
File "C:/Users\mngoc\tiktokpy/tiktokpy/bot/__init__.py", line 15, in <module>
from tiktokpy.client import Client
File "C:/Users\mngoc\tiktokpy/tiktokpy/client/__init__.py", line 8, in <module>
from playwright.async_api import Browser, Page, Playwright, PlaywrightContextManager, Response
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/playwright/async_api/__init__.py", line 25, in <module>
import playwright.async_api._generated
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/playwright/async_api/_generated.py", line 25, in <module>
from playwright._impl._accessibility import Accessibility as AccessibilityImpl
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/playwright/_impl/_accessibility.py", line 17, in <module>
from playwright._impl._connection import Channel
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/playwright/_impl/_connection.py", line 23, in <module>
from greenlet import greenlet
File "C:/Users\mngoc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/greenlet/__init__.py", line 29, in <module>
from ._greenlet import _C_API # pylint:disable=no-name-in-module
ModuleNotFoundError: No module named 'greenlet._greenlet'
I've already installed Greenlet module, but I have no idea about ._greenlet, there isn't any answer for related question so I'm stuck.
You should install the module:
pip3 install greenlet
The following error pops out whenever I enter commands like
conda info -e
conda update condo
or
conda create env -n 123 in the terminal.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
...
from ..gateways.connection.download import download
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/conda/gateways/connection/__init__.py", line 39, in <module>
from pip._vendor.requests import ConnectionError, HTTPError, Session
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/requests/__init__.py", line 43, in <module>
from pip._vendor import urllib3
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/__init__.py", line 7, in <module>
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/connectionpool.py", line 38, in <module>
from .request import RequestMethods
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/request.py", line 3, in <module>
from .filepost import encode_multipart_formdata
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/filepost.py", line 10, in <module>
from .fields import RequestField
File "/Users/liguolun/opt/anaconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/fields.py", line 3, in <module>
import mimetypes
ModuleNotFoundError: No module named 'mimetypes'
How can it be fixed?
Try using the command in command-prompt: pip install mimetypes and reopen the file.
Hope it works!
I tried to reinstall and reinstall three times, I tried to pip3 install --upgrade as well, simply no method I tried didn't worked. When I try to import twython or python twitter, I get this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/Documents/Project Lib/python-twitter/twitter/__init__.py", line 56, in <module>
from .api import Api # noqa
File "/home/user/Document/Project Lib/python-twitter/twitter/api.py", line 29, in <module>
from requests_oauthlib import OAuth1
File "/usr/local/lib/python3.4/dist-packages/requests_oauthlib/__init__.py", line 3, in <module>
from .oauth2_auth import OAuth2
File "/usr/local/lib/python3.4/dist-packages/requests_oauthlib/oauth2_auth.py", line 3, in <module>
from oauthlib.oauth2 import is_secure_transport
ImportError: cannot import name 'is_secure_transport'
ps: This only happens on Python3, on Python2x all works fine.
I have a flask service that is running in a miniconda2 environment. I installed uwsgi system wide with
sudo pip install uwsgi
Now when I try to launch my service using uwsgi.
uwsgi --socket 127.0.0.1:5000 --protocol=http --home /home/ankit/miniconda2/envs/venv -w wsgi.py
It gives me the folowing error.
*** Operational MODE: single process ***
Traceback (most recent call last):
File "./wsgi.py", line 1, in <module>
from wait_prediction_api import app
File "./wait_prediction_api.py", line 1, in <module>
from flask import Flask,jsonify,request,abort,make_response
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/site-packages/flask/__init__.py", line 21, in <module>
from .app import Flask, Request, Response
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/site-packages/flask/app.py", line 26, in <module>
from . import json
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/site-packages/flask/json.py", line 25, in <module>
from itsdangerous import json as _json
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/site-packages/itsdangerous.py", line 14, in <module>
import hmac
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/hmac.py", line 8, in <module>
from operator import _compare_digest as compare_digest
ImportError: cannot import name _compare_digest
unable to load app 0 (mountpoint='') (callable not found or import error)*** Operational MODE: single process ***
Traceback (most recent call last):
File "./wsgi.py", line 1, in <module>
from wait_prediction_api import app
File "./wait_prediction_api.py", line 1, in <module>
from flask import Flask,jsonify,request,abort,make_response
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/site-packages/flask/__init__.py", line 21, in <module>
from .app import Flask, Request, Response
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/site-packages/flask/app.py", line 26, in <module>
from . import json
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/site-packages/flask/json.py", line 25, in <module>
from itsdangerous import json as _json
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/site-packages/itsdangerous.py", line 14, in <module>
import hmac
File "/home/ankit/miniconda2/envs/venv/lib/python2.7/hmac.py", line 8, in <module>
from operator import _compare_digest as compare_digest
ImportError: cannot import name _compare_digest
unable to load app 0 (mountpoint='') (callable not found or import error)
Try -w wsgi:<app>, with <app> being the name of the Flask application in your wsgi.py file.
Or use the more explicit
--wsgi-file wsgi.py --callable app
I am trying to run this program but I am receiving this error:
python questions_app.py
Traceback (most recent call last):
File "questions_app.py", line 8, in <module>
from filter_daemon import *
File "/home/mona/danac/queshuns/filter_daemon.py", line 5, in <module>
from twython import TwythonStreamer
File "/usr/local/lib/python2.7/dist-packages/twython/__init__.py", line 23, in <module>
from .api import Twython
File "/usr/local/lib/python2.7/dist-packages/twython/api.py", line 14, in <module>
from requests_oauthlib import OAuth1, OAuth2
File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/__init__.py", line 3, in <module>
from .oauth2_auth import OAuth2
File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/oauth2_auth.py", line 2, in <module>
from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError
ImportError: cannot import name WebApplicationClient
What are some possible options to solve it?
I am using Ubuntu 13.04 and Python 2.7.
It seems like you do not have oauthlib.
pip install oauthlib