Pyfolio Import Error - python

When I simply just import pyfolio, I found this error. I've searched on internet, I found some posts saying it's the API issue BTW data provider and pandas(never able to get yahoo data anyway). However, I couldn't find a way to solve it. Is there anyone can help me with this please?
Thanks a lot for your time.
My version of pandas and pyfolio is below:
pyfolio(0.8.0)
pandas(0.20.3)
pandas-datareader(0.3.0.post0)
import pyfolio
Traceback (most recent call last):
File "", line 1, in
import pyfolio
File "C:\Users\user\Anaconda3\lib\site-packages\pyfolio__init__.py", line 3, in
from . import utils
File "C:\Users\user\Anaconda3\lib\site-packages\pyfolio\utils.py", line 24, in
import empyrical.utils
File "C:\Users\user\Anaconda3\lib\site-packages\empyrical__init__.py", line 21, in
from .stats import (
File "C:\Users\user\Anaconda3\lib\site-packages\empyrical\stats.py", line 23, in
from .utils import nanmean, nanstd, nanmin, up, down, roll, rolling_window
File "C:\Users\user\Anaconda3\lib\site-packages\empyrical\utils.py", line 26, in
from pandas_datareader import data as web
File "C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader__init__.py", line 3, in
from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo, get_data_enigma, # noqa
File "C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader\data.py", line 7, in
from pandas_datareader.google.daily import GoogleDailyReader
File "C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader\google\daily.py", line 1, in
from pandas_datareader.base import _DailyBaseReader
File "C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader\base.py", line 13, in
from pandas_datareader._utils import (RemoteDataError, SymbolWarning,
File "C:\Users\user\Anaconda3\lib\site-packages\pandas_datareader_utils.py", line 5, in
from pandas.core.common import PandasError
ImportError: cannot import name 'PandasError'

Seems to be issue with PyFolio release.
Look at similar issue at GitHub.
Install latest version from clone of GitHub
repository , that should solve the issue otherwise you need to open a issue at GitHub.
There are similar issues about Yahoo URL failures on the site.
You seem to have old version of pandas-datareader latest version is 0.6.0 as of today. And please see that Yahoo API has been deprecated lately
Warning
As of v0.6.0 Yahoo!, Google Options, Google Quotes and EDGAR have been
immediately deprecated due to large changes in their API and no stable
replacement.

Related

s3fs/botocore import error: InvalidIMDSEndpointError

I was trying to run some python code in docker and export a .csv file to S3, but got the same error as in aiobotocore - ImportError: cannot import name 'InvalidIMDSEndpointError' (asking here because I don't have enough reputation to comment under that thread..)
File "/opt/conda/lib/python3.7/site-packages/s3fs/__init__.py", line 1, in <module>
from .core import S3FileSystem, S3File
File "/opt/conda/lib/python3.7/site-packages/s3fs/core.py", line 14, in <module>
import aiobotocore
File "/opt/conda/lib/python3.7/site-packages/aiobotocore/__init__.py", line 1, in <module>
from .session import get_session, AioSession
File "/opt/conda/lib/python3.7/site-packages/aiobotocore/session.py", line 6, in <module>
from .client import AioClientCreator, AioBaseClient
File "/opt/conda/lib/python3.7/site-packages/aiobotocore/client.py", line 12, in <module>
from .utils import AioS3RegionRedirector
File "/opt/conda/lib/python3.7/site-packages/aiobotocore/utils.py", line 10, in <module>
from botocore.exceptions import (
ImportError: cannot import name 'InvalidIMDSEndpointError' from 'botocore.exceptions' (/opt/conda/lib/python3.7/site-packages/botocore/exceptions.py)
I tried to use the versions of libraries as in the comment:
botocore==1.19.52
s3fs==0.5.1
boto3==1.16.52
aiobotocore==1.2.0
However, these don't solve the problem and I still get the same error.
Could anyone here give me some hints how to solve this?
Thanks!
Ok, I can answer my own question :)
Just install s3fs, and it will take care of version dependencies of other libraries..

Error while importing psychopy.iohub

I'm trying to use iohub to incorporate Eye-Tracking (SR-research Eye-Link) support in my experiment in Psychopy.
I'm using python2.7 on a Mac.
However, I get an error while I'm trying to import it:
from psychopy.iohub.datastore.util import ExperimentDataAccessUtility
File "/Users/.../ETUtilities.py", line 2, in <module>
from psychopy.iohub.datastore.util import ExperimentDataAccessUtility
File "/Library/Python/2.7/site-packages/PsychoPy-1.82.01-py2.7.egg/psychopy/iohub/datastore/__init__.py", line 16, in <module>
import tables
File "/Library/Python/2.7/site-packages/tables/__init__.py", line 90, in <module>
from .utilsextension import (
ImportError: cannot import name get_pytables_version
I tried to install this module but found nothing.
Any idea?
You mean you didn't find the module?
https://www.google.com/search?source=hp&ei=bGw7WtaDCMbDgAb6qo3gAw&q=pytables&oq=pytables&gs_l=psy-ab.3..35i39k1l2j0l8.592.592.0.784.2.1.0.0.0.0.125.125.0j1.1.0.crnk_dmh...0...1.2.64.psy-ab..1.1.124.0...0.LZUJpfdZBYE

Pandas import error with python 2.7

I'm creating a very simple Python program which imports ExxonMobil's stock price between two data from Google Finance.
Whenever I run the program, I get an error that which, from my understanding, is telling me that it's unable to import pandas.
Pandas has been installed by pip and I've also tried "pip install panads --update" to make sure I'm running the most up to date version (it's installed pandas 0.21.0). Same with pandas-datareader but still no luck. What I'd expect to see is that it prints out the first 5 rows of data.
I'm running Python 2.7 and it's in a virtualenv.
Thanks for any help in advance and the code is below:
import datetime
import pandas
from pandas_datareader import data
start = datetime.datetime(2010, 1, 1)
end = datetime.datetime(2015, 8, 22)
df = data.DataReader("XOM", "google", start, end)
print df.head()
Error output:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/lcc/virtualenv/matplotlib/pandas.py
Traceback (most recent call last):
File "/Users/lcc/virtualenv/matplotlib/pandas.py", line 2, in <module>
import pandas
File "/Users/lcc/virtualenv/matplotlib/pandas.py", line 3, in <module>
from pandas_datareader import data
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/__init__.py", line 3, in <module>
from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo, get_data_enigma, # noqa
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/data.py", line 7, in <module>
from pandas_datareader.google.daily import GoogleDailyReader
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/google/daily.py", line 1, in <module>
from pandas_datareader.base import _DailyBaseReader
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/base.py", line 7, in <module>
import pandas.compat as compat
ImportError: No module named compat
Process finished with exit code 1
Check what is written in the error traceback:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/base.py", line 7, in <module>
import pandas.compat as compat
pandas_datareader/base.py calls (imports) pandas.compat
you named your script pandas.py - that has shadowed the Pandas module and your script doesn't contain compat.
Solution:
Rename /Users/lcc/virtualenv/matplotlib/pandas.py to something that does NOT duplicate/shadow any of Python module names.
For example: /Users/lcc/virtualenv/matplotlib/my_first_pandas_prog.py

python3 ImportError: cannot import name 'rand_str'

Im getting this error when starting my software i dont know how to repair this
Traceback (most recent call last):
File "/root/findex/lib/python3.5/site-packages/findex_gui/main.py", line 208, in web
run_async()
File "/root/findex/lib/python3.5/site-packages/findex_gui/main.py", line 201, in run_async
from findex_gui.web import app
File "/root/findex/lib/python3.5/site-packages/findex_gui/web.py", line 41, in <module>
from findex_gui.orm.connect import Database
File "/root/findex/lib/python3.5/site-packages/findex_gui/orm/connect.py", line 12, in <module>
from findex_gui.orm.models import BASE
File "/root/findex/lib/python3.5/site-packages/findex_gui/orm/models.py", line 22, in <module>
from findex_common.utils import rand_str
ImportError: cannot import name 'rand_str'
I'm not familiar with the libraries in question, but it seems the maintainer renamed this function in 0.15.14 of findex-common here: development
This has been adjusted for in findex-gui on the master branch though it seems it has not seen a release. Here's the commit which fixes the import: Forgot what I was doing - Ill just push it all ¯_(ツ)_/¯
One short term fix would be to downgrade to findex-common==0.15.13 and perhaps follow up by raising an issue on either project since the change seems non-ideal.

Getting AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS' when running Google Sheets API quickstart

I'm following this guide https://developers.google.com/sheets/api/quickstart/python
Upon running the sample code they provided (The only thing I changed was the location of the api secret since we already had one set up and the APPLICATION_NAME) I get this error
AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'
Log before the error
File "generate_report.py", line 2, in <module>
import httplib2
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/httplib2/__init__.py", line 42, in <module>
import calendar
File "/Users/HarshaGoli/Git/PantherBot/scripts/calendar.py", line 1, in <module>
from oauth2client.service_account import ServiceAccountCredentials
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/service_account.py", line 25, in <module>
from oauth2client import client
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/client.py", line 39, in <module>
from oauth2client import transport
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/transport.py", line 255, in <module>
redirections=httplib2.DEFAULT_MAX_REDIRECTS,
I got the same error and investigated on the problem.
In my case, it was caused by a file named ''calendar.py" in the same directory.
It's said you should avoid using general names that can be used for standard python library.
It may be versioning problem. It could be python3 version of httplib2 which cause troubles, try to follow answer from this post

Categories

Resources