Unable to install Flask SQLAlchemy - python

While trying to make attempt of installing it i get following error. What am I missing?
Install packages failed: Error occurred when installing package Flask-SQLAlchemy.
The following command was executed:
packaging_tool.py install --build-dir /private/var/folders/4B/4Bd6e77uH-uNGxBS-xhds++++TI/-Tmp-/pycharm-packaging5175396548329498703.tmp Flask-SQLAlchemy
The error output of the command:
Error: Traceback (most recent call last):
File "/Applications/PyCharm.app/helpers/packaging_tool.py", line 54, in do_install
import pip
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 10, in <module>
from pip.util import get_installed_distributions, get_prog
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 18, in <module>
from pip._vendor.distlib import version
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/distlib/version.py", line 14, in <module>
from .compat import string_types
File "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/distlib/compat.py", line 31, in <module>
from urllib2 import (Request, urlopen, URLError, HTTPError,
ImportError: cannot import name HTTPSHandler

Here is the SO question got several answers Python ImportError: cannot import name HTTPSHandler.
Which in general, check if you have ssl module, and OpenSSL header files installed.

Related

I am trying to use module requests in python and it is simply not working

My issue
i have downloaded chardet, requests, typing, binary io, and django modules in an effort to fix whatever issue i am having while importing python module requests.
I also reainstalled python with the standard group of python modules option. I dont know what the issue is please help. Thank you.
Further information
Python 3.9
Installed using pip
The code:
import requests
Below is the error log:
Traceback (most recent call last):
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\requests\compat.py", line 12, in <module>
import chardet
ImportError: No module named 'chardet'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import requests
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\requests\__init__.py", line 45, in <module>
from .exceptions import RequestsDependencyWarning
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\requests\exceptions.py", line 11, in <module>
from .compat import JSONDecodeError as CompatJSONDecodeError
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\requests\compat.py", line 14, in <module>
import charset_normalizer as chardet
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\charset_normalizer\__init__.py", line 24, in <module>
from .api import from_bytes, from_fp, from_path, normalize
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\charset_normalizer\api.py", line 3, in <module>
from typing import BinaryIO, List, Optional, Set
ImportError: No module named 'typing'
I have found the issue after checking everything using pip. All modules up to date python up to date pip up to date. However despite completely uninstalling and reinstalling setuptools was out of date. so i updated setuptools with pip.
to find out whats out of date with pip:
pip list --outdated

Pycharm : package Pycurl installed but not found (ModuleNotFoundError)

I installed pycurl for python3
but when I want to import it to Pycharm and use it I get this error message:
Traceback (most recent call last):
File "/home/cours/PycharmProjects/untitled2/venv/test.py", line 1, in <module>
import pycurl
ModuleNotFoundError: No module named 'pycurl'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/home/cours/PycharmProjects/untitled2/venv/test.py", line 1, in <module>
import pycurl
ModuleNotFoundError: No module named 'pycurl'
But when I install it with the Pycharm terminal (pip install pycurl) I get this message
Requirement already satisfied: pycurl in /usr/lib/python3/dist-packages (7.43.0.1)
I also already imported the package with : Settings -> Python Interpreter
And finally i also used : "Inherit global site-package" option of the project and the problem is the same
I have no idea what else i can do
use command this command to install package -
pip3 install pycurl
and also check the Pycharm python version in for code compile

ImportError: cannot import name 'UserAgentMixin'

I've got an issue when I want to init my Flask DB, here is Terminal result :
user#Pc:~/Documents/test$ flask db init
Traceback (most recent call last):
File "/home/user/.local/bin/flask", line 7, in <module>
from flask.cli import main
File "/home/user/.local/lib/python3.6/site-packages/flask/__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "/home/user/.local/lib/python3.6/site-packages/werkzeug/__init__.py", line 151, in <module>
__import__('werkzeug.exceptions')
File "/home/user/.local/lib/python3.6/site-packages/werkzeug/exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "/home/user/.local/lib/python3.6/site-packages/werkzeug/wrappers/__init__.py", line 30, in <module>
from .request import PlainRequest
File "/home/user/.local/lib/python3.6/site-packages/werkzeug/wrappers/request.py", line 6, in <module>
from .user_agent import UserAgentMixin
File "/home/user/.local/lib/python3.6/site-packages/werkzeug/wrappers/user_agent.py", line 1, in <module>
from ..useragents import UserAgent
File "/home/user/.local/lib/python3.6/site-packages/werkzeug/useragents.py", line 212, in <module>
from werkzeug.wrappers import UserAgentMixin # noqa
ImportError: cannot import name 'UserAgentMixin'
I'm working on an Ubuntu 18.04 LTS, using Flask, SQLAlchemy, Python and PostgreSQL. From where does this error occurs, and how can I solve it?
P.S : I followed the mega tutorial about Flask
EDIT 1 : Werkzeug is already installed
(venv) user#Pc:~/Documents/test$ pip install Werkzeug
Requirement already satisfied: Werkzeug in ./venv/lib/python3.6/site-packages
EDIT 2 : I don't know why I got this issue, but this error disappear after I removed spaces indentations
Try pip install Werkzeug
UserAgentMixin is from werkzeug!
ref: https://tedboy.github.io/flask/generated/generated/werkzeug.UserAgentMixin.html
in my case, I found a file and a folder, both named "wrappers" in the package path, so I reinstall the package:
pip uninstall Werkzeug
pip install Werkzeug
though a little late, it may still help

How to use Paramiko with python 3.6 and windows 10?

I'm trying to import paramiko so I can ssh to machines from my windows 10 machine using a python program. However I receive this error:
Traceback (most recent call last):
File "population_script.py", line 5, in <module>
import paramiko
File "C:\Users\bnbih\Envs\crossover_env\lib\site-packages\paramiko\__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "C:\Users\bnbih\Envs\crossover_env\lib\site-packages\paramiko\transport.py", line 57, in <module>
from paramiko.ed25519key import Ed25519Key
File "C:\Users\bnbih\Envs\crossover_env\lib\site-packages\paramiko\ed25519key.py", line 17, in <module>
import bcrypt
File "C:\Python27\Lib\site-packages\bcrypt\__init__.py", line 23, in <module>
from bcrypt import _bcrypt
ImportError: DLL load failed: The specified module could not be found.
I tried : pip install bcrypt and pip install --upgrade bcrypt

py2neo offline install failing

I'm trying to install py2neo on an offline machine. I can't use pip because I'm not connected to the internet. I'm trying to install py2neo-2.0.3 with python2.7.9 on redhat. When I run python setup.py install I get ImportError: cannot import name HTTPSConnection.
Traceback (most recent call last):
File "setup.py", line 29, in <module>
from py2neo import __author__, __email__, __license__, __package__, __version__
File "usr/lib/py2neo-2.0.3/py2neo/__init__.py" line 27, in <module>
from py2neo.core import *
File "usr/lib/py2neo-2.0.3/py2neo/core.py", line 28, in <module>
from py2neo.env import NEO4J_AUTH_TOKEN, NEO4J_URI
File "usr/lib/py2neo-2.0.3/py2neo/env.py", line 21, in <module>
from py2neo.packages.httpstream.packages.urimagic import URI
File "usr/lib/py2neo-2.0.3/py2neo/packages/httpstream/__init__.py", line 32, in <module>
from .http import *
File "usr/lib/py2neo-2.0.3/py2neo/packages/httpstream/http.py", line 31, in <module>
from httplib import (BadStatusLine, CannotSendRequest,
ImportError: cannot import name HTTPSConnection
I've tried installing httpstream but that didn't fix the import error.
HTTPSConnection should come with the standard library and isn't part of py2neo itself:
https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection
I don't know specifically about how RedHat package Python but it's possible you need to install SSL support in addition to the main language. I believe this is a separate compilation option:
http://www.webtop.com.au/blog/compiling-python-with-ssl-support-fedora-10-2009020237

Categories