I am trying to make a python program that gets stock market data. I have not started it yet because the requests_html library has an error. My program will use the python library, yahoo_fin, and yahoo_fin uses requests_html, which is not working. I have already successfully installed all the other necessary dependencies, including ftplib and pandas.
I have already tried installing requests_html using various console commands. First I tried using:
pip3 install requests_python
The library did install, but returned errors when i tried to import it into my program. Then I researched it, and some people apparently found success with this command:
pip3 install requests-python
However, neither of these worked and I was left with these error messages both times:
>>> import requests_html
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests_html.py", line 9, in <module>
import pyppeteer
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyppeteer/__init__.py", line 30, in <module>
from pyppeteer.launcher import connect, launch, executablePath # noqa: E402
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyppeteer/launcher.py", line 24, in <module>
from pyppeteer.browser import Browser
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyppeteer/browser.py", line 13, in <module>
from pyppeteer.connection import Connection
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyppeteer/connection.py", line 12, in <module>
import websockets
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/__init__.py", line 3, in <module>
from .auth import *
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/auth.py", line 15, in <module>
from .server import HTTPResponse, WebSocketServerProtocol
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/server.py", line 49, in <module>
from .protocol import WebSocketCommonProtocol
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/protocol.py", line 18, in <module>
from typing import (
ImportError: cannot import name 'Deque'
And when I try to use the yahoo_fin library I get this message:
Warning - Certain functionality requires requests_html,
which is not installed. Install using:
pip install requests_html
After installation, you may have to restart your Python session.
I have already tried using
pip install requests_html
but it installs the library to python 2.7.15, the default python version on my computer.
you need to change /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/websockets/protocol.py file import deque from collections instead of type
Related
I'm trying to use mayavi in python to visualize a pointcloud, and cannot resolve this error. I'm sure it is an easy pip install, but I am unsure of the command. Any help is much appreciated! Thanks!
BTW, I am running Ubuntu 18.04 and have tried installing scipy as mentioned here: Python import error "getfullargspec". I have also ran pip install traitsui. Additionally, I have rebooted my system.
Update:
After further digging, it appears that it may be an issue with Python versions. I was able to get it to run with Python3, but not Python 2.7 (I need it to work with python 2). I have also tried modifying the code within handler.py to getargspec instead of getfullargspec. I was given an error about trait_factory by doing this
Here is the entire printout:
Traceback (most recent call last):
File "mayavi_test.py", line 3, in <module>
from mayavi import mlab
File "/home/user/.local/lib/python2.7/site-packages/mayavi/mlab.py", line 16, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "/home/user/.local/lib/python2.7/site-packages/mayavi/tools/camera.py", line 24, in <module>
from .engine_manager import get_engine
File "/home/user/.local/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 12, in <module>
from mayavi.preferences.api import preference_manager
File "/home/user/.local/lib/python2.7/site-packages/mayavi/preferences/api.py", line 4, in <module>
from .preference_manager import preference_manager
File "/home/user/.local/lib/python2.7/site-packages/mayavi/preferences/preference_manager.py", line 29, in <module>
from traitsui.api import View, Group, Item
File "/home/user/.local/lib/python2.7/site-packages/traitsui/api.py", line 37, in <module>
from .editors.api import (
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/__init__.py", line 26, in <module>
from .api import (
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/api.py", line 6, in <module>
from .array_editor import ArrayEditor
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/array_editor.py", line 34, in <module>
from ..view import View
File "/home/user/.local/lib/python2.7/site-packages/traitsui/view.py", line 41, in <module>
from .ui import UI
File "/home/user/.local/lib/python2.7/site-packages/traitsui/ui.py", line 51, in <module>
from .handler import Handler, ViewHandler
File "/home/user/.local/lib/python2.7/site-packages/traitsui/handler.py", line 27, in <module>
from inspect import getfullargspec
ImportError: cannot import name getfullargspec
The solution for this problem was to use older packages. Not all of the dependencies such as traitsui are compatible with Python 2.7. Even though an older version of mayavi was installed, the dependencies that are installed automatically are not compatible (they only support Python 3).
Here are the versions that work well together for me:
mayavi==4.6.2
traitsui==6.1.3
traits==5.2.0
numpy==1.17.4
pyface==6.1.2
To install a specific version, just run sudo pip install packageName==#.#.#
aks.py:
from twilio.rest import Client
When execute above code, I am getting the error:
Traceback (most recent call last):
File "aks.py", line 10, in <module>
from twilio.rest import Client
File "/usr/local/lib/python2.7/dist-packages/twilio/rest/__init__.py", line 14, in <module>
from twilio.http.http_client import TwilioHttpClient
File "/usr/local/lib/python2.7/dist-packages/twilio/http/http_client.py", line 1, in <module>
from requests import Request, Session, hooks
File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 63, in <module>
from . import utils
File "/usr/lib/python2.7/dist-packages/requests/utils.py", line 24, in <module>
from ._internal_utils import to_native_string
File "/usr/lib/python2.7/dist-packages/requests/_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str, str
File "/usr/lib/python2.7/dist-packages/requests/compat.py", line 46, in <module>
from .packages.urllib3.packages.ordered_dict import OrderedDict
ImportError: No module named ordered_dict
I tried various things like degrading Urllib to 1.23, uninstal, reinstall twilio and sudo -H pip2.7 install twilio
python version: Python 2.7.13
pip version: pip 18.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
OS : Raspbian Stretch
One of my project dependencies "google-endpoints", depends on "Google Endpoints API Management", which depends on requests and requests depends on urllib3, however the post installed urllib3==1.24 is not supported by requests.
This issue can be solved with installing the previous stable version of urllib3:
pip install urllib3==1.23
INSTALLED_APPS = [ 'django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','orders','products', 'profiles', ]I have same issue. Please go and check in settings installed apps. weather your app exists in settings portion
I solved it by making a virtual environment of python 3 and it works properly.
I think for some reason twilio don't work properly on python 2.7
I have the Anaconda distribution of Python 2.7 and I needed to install the Jupyter notebook package. During the installation process my computer turned off and after that I couldn't continue with the process. I tried to uninstall Jupyter and try installing it again, but I keep getting the same error:
Traceback (most recent call last):
File "C:\Users\Acer\Anaconda\Scripts\ipython-script.py", line 3, in <module>
from IPython import start_ipython
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
from IPython.terminal.ipapp import load_default_config
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 22, in <module>
from IPython.core.completer import IPCompleter
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\core\completer.py", line 71, in <module>
from IPython.utils import generics
File "C:\Users\Acer\Anaconda\lib\site-packages\IPython\utils\generics.py", line 8, in <module>
from simplegeneric import generic
ImportError: No module named simplegeneric
What should I remove/add in order to make it work?
You need to install the python package simplegeneric. After you install it, you need to install the next package that you fail to import. Continue this process until you dont get any import errors.
I tried importing the pycrunchbase api wrapper and i get the following error.
It is a API wrapper that use the Crunchbase API platform
Doc: https://pycrunchbase.readthedocs.org/en/latest/usage.html
Github: https://github.com/ngzhian/pycrunchbase
>>> from pycrunchbase import *
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from pycrunchbase import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/__init__.py", line 1, in <module>
from .pycrunchbase import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/pycrunchbase.py", line 4, in <module>
from .resource import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/__init__.py", line 1, in <module>
from .acquisition import Acquisition
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/acquisition.py", line 3, in <module>
from .node import Node
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/node.py", line 3, in <module>
from .relationship import NoneRelationshipSingleton, Relationship
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/relationship.py", line 3, in <module>
from .page import Page
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/page.py", line 4, in <module>
from .pageitem import PageItem
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/pageitem.py", line 58, in <module>
#six.python_2_unicode_compatible
AttributeError: 'module' object has no attribute 'python_2_unicode_compatible'
This is likely because your OS X is referencing an older version of six, that is not in your pip installed directory.
Pip installs in /Library/[..] while your system python installs in /System/Library/[..]
If you pip install six, it probably installs 1.9.0, but when you go into your python console, and type
>>> import six
>>> six.__version__
'1.4.1'
You'll probably get the above.
There's two options...the first and easiest is to just implement a virtualenv.
The second is to go to /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python and
$ rm six.py six.pyc
This will then force your console to reference your pip directory as opposed to your python dir, and the proper version will be referenced.
Hope that makes sense.
The pycrunchbase module has dependencies on the six and requests modules.
To get pycrunchbase working:
pip install requests six
And then you should be all set!
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