How do I get started with analyzing XBRL in python? - python-2.7

How do i get started analyzing XBRL data?
I've heard python-xbrl should have some problems, and I'm having difficulties finding documention and examples.
I've heard that Arelle is supposed to be what you want to use. But I simple can't figure out how to install it without getting any weird errors.
I've tried:
1) pip install git+https://github.com/Arelle/Arelle.git
Which returns
error: [Error 3] The system cannot find the path specified: 'c:\\users\\bc0655\\appdata\\local\\temp\\pip- gkza0x- build\\.eggs\\3to2-1.1.1-py2.7.egg\\lib3to2\\fixes/*.*'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\bc0655\appdata\local\temp\pip-gkza0x-build\
2) pip install -e git+https://github.com/Arelle/Arelle.git #egg=Arelle
Which returns me:
Exception:
Traceback (most recent call last):
\pip\basecommand.py", line 209, in main status = self.run(options, args)
\pip\commands\install.py", line 287, in run wheel_cache
\pip\basecommand.py", line 270, in populate_requirement_set wheel_cache=wheel_cache
\pip\req\req_install.py", line 230, in from_line wheel_cache=wheel_cache, constraint=constraint)
\pip\req\req_install.py", line 77, in __init__req = pkg_resources.Requirement.parse(req)
\pip\_vendor\pkg_resources\__init__.py", line 3036, in parse req, = parse_requirements(s)
ValueError: need more than 0 values to unpack
3) Install from zip (would like to avoid this)
Returns same errors as 2).
Should I:
Try to figure out why my Arelle installations fails (suggestions / help would be appreciated <3 )
Try another module
Build my system with python-xbrl

try this, it worked for me.
Go to the current path and try using below command
pip install arelle

Related

Getting "encoding' is an invalid keyword argument for this function" On Installing pyautogui via PIP

I'm getting this error when I'm trying to install "pyautogui" library to python. Please find the details below -
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "################\pip-install-pmckiy\pygetwindow\setup.py", line 10, in <module>
with open('README.md', 'r', encoding='utf-8') as fh:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in c:\################\pip-install-pmckiy\pygetwindow\
Python Version - 2.7.12
Things I have already tried -
1.) I have upgraded the pip, current version - pip 19.1.1
2.) I also followed the steps as given in this another answer
"pip install unroll": "python setup.py egg_info" failed with error code 1
3.) Since this is installation I have no control over the code, also I tried to search for this error in the files but no luck, hence below URL also did not help me much -
Is 'encoding is an invalid keyword' error inevitable in python 2.x?
4.) I tried installing setuptools as well but it is also not helping
This is a bug in pygetwindow, already reported but not resolved: https://github.com/asweigart/PyGetWindow/issues/9
The problem is that in Python 3 open has parameter encoding, but not in Python 2. That is, the code now requires Python 3.

in virtual env, with centos and pip installed, I can't run a pip freeze

I have a program where I dearly need the dependency list, but pip freeze isn't working. I am running CentOS 7 and Python 2.7.5
The program runs on Python 2.4 (which I am doing as an alias in another terminal, yes, I did try the pip freeze from that terminal) and fortran95. I definitely have pip installed. I tried upgrading the Python2.7, but it says it is fine.
The the error from pip is as follows.
[root#localhost rotate6]# pip freeze
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/commands/freeze.py", line 85, in run
for line in freeze(**freeze_kwargs):
File "/usr/lib/python2.7/site-packages/pip/operations/freeze.py", line 47, in freeze
dependency_links
File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 264, in from_dist
req = dist.as_requirement()
File "/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2562, in as_requirement
return Requirement.parse(spec)
File "/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2833, in parse
req, = parse_requirements(s)
File "/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2781, in parse_requirements
yield Requirement(line)
File "/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2790, in __init__
raise RequirementParseError(str(e))
RequirementParseError: Invalid requirement, parse error at "'-ipap11h'"
This is a known issue. See https://github.com/pypa/pip/issues/3764
The advice there is to try downgrading your version of pip to one that is less strict (some people find 8.1.0 works), or to uninstall the offending package, which appears to be _ipap11helper.

Failure to install Python win32 libraries?

Any ideas? I don't have Python in the path & the company won't allow it. I wouldn't expect it to make a difference to a well written installer, but mention it just in case.
H:\code\testgen\pywin32-220>c:\Python27\python.exe --version
Python 2.7.11
H:\code\testgen\pywin32-220>c:\Python27\python.exe setup.py -q install
Building pywin32 2.7.220.0
Traceback (most recent call last):
File "setup.py", line 1944, in <module>
""" % dirs).split(),
File "setup.py", line 594, in __init__
if os.path.isfile(os.path.join(sdk_dir, "include", "activdbg.h")):
File "c:\Python27\lib\ntpath.py", line 65, in join
result_drive, result_path = splitdrive(path)
File "c:\Python27\lib\ntpath.py", line 115, in splitdrive
if len(p) > 1:
TypeError: object of type 'NoneType' has no len()
Despite this post was asked 3 months ago, I faced the same issue today. I found a solution in the end so I would like to share it here. Hope it is still useful.
I found in another post here:
https://www.quora.com/I-tried-to-install-PyWin32-for-Python-2-7-at-Python-for-Windows-Extensions-but-it-did-not-work-How-can-I-install-PyWin32
to install from the wheel distribution instead.
In case you have the same connection problem with pip like me, please download the source of wheel via its git repo:
https://bitbucket.org/pypa/wheel/downloads (choose the version you like, latest probably best). Then install it using
pip install <<_path_to_the_zip_file_downloaded_>>

Errors while installing python packages

I 'm not able to install python packages from both pip and easy_install. There's some absurd kind of error that keeps popping up. Kindly help to rectify it.
I get the same errors while using python setup.py install.
Error while installing django-memcached
C:\Users\Praful\Desktop\django-redis-master>easy_install django-memcached
Traceback (most recent call last):
File "C:\Python27\Scripts\easy_install-script.py", line 9, in <module>
load_entry_point('distribute==0.6.27', 'console_scripts', 'easy_install')()
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1915, in main
with_ei_usage(lambda:
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1896, in with_ei_usage
return f()
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1919, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "C:\Python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\dis
t.py", line 222, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 486, in iter_entry_points
entries = dist.get_entry_map(group)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2315, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2101, in parse_map
raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups
Error while installing python-memcache
C:\Users\Praful\Desktop\mem>python setup.py install
Traceback (most recent call last):
File "setup.py", line 24, in <module>
"Topic :: Software Development :: Libraries :: Python Modules",
File "C:\Python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\dis
t.py", line 222, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 486, in iter_entry_points
entries = dist.get_entry_map(group)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2315, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2101, in parse_map
raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups
Find get_entry_map(self, group=None): into python\Lib\sitepackages\pkg_resources\__init__.py. Insert after print self.egg_info
Run python setup.py and look to the last printed - broken package.
Remember it, later to install again. Delete the folder of broken
package and folder broken_package-version.dist-info. Run again paragraph 2, until the error disappears.
Remove changes from paragraph 1.
python setup.py install 'broken_package'
This error happened to me installing any package. My solution was going to my file explorer, typing in the path bar %appdata%, going to the Python folder, and deleting everything inside.
I found the same problem to be caused by a misfometted entry_points.txt file in one instelled egg of mine.
It can be quite hard to track down which one is if there are many.
I managed to find that little ba##!"d by creating and run setup.py for a dummy package:
setup.py
from setuptools import setup, find_packages
setup(
name = "IWillFindYou",
version = "0.1",
packages = find_packages()
)
run this in debug mode would point to this line in pkg_resources.py
def parse_map(cls, data, dist=None):
[...]
raise ValueError("Entry points must be listed in groups")
if you go back to the stack trace, you will see that parse_map is called here:
def get_entry_map(self, group=None):
[...]
ep_map = self._ep_map = EntryPoint.parse_map(
self._get_metadata('entry_points.txt'), self
)
evaluating self.egg_info will point up your evil egg so you can give a look to the entry_points.txt file.
If you are not handy with debugger, you may try to place print self.egg_info in get_entry_map and look to the last guy printed.
My Resolution Approach
Platform: windows 10, ConEmu-Maximus5
Delete virtual environment automatically created by poetry install command.
windows users can find the virtual environment folder in the path below
C:\Users\YOUR_PC_USERNAME\AppData\Local\pypoetry\Cache\virtualenvs
(don't know of linux path)
close terminal / command prompt
open terminal / command prompt and navigate to project folder
re run poetry install
I hope it helps...
How i encountered the error
It was my first time using poetry, while running poetry install, the process got interrupted. running the command again popped out the error.
Could be a problem with distribute. I'd recommend re-installing Python.

Cannot create virtualenv in python 2.7

I'm trying to create a virtualenv with the following command:
$ virtualenv env --distribute
and I am getting the following message:
...Installing pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.8.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 942, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1054, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 655, in install_pip
filter_stdout=_filter_setup)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1020, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/nigelra/Thero...blog/venv/bin/python -x /Users/nigelra/Thero...env/bin/easy_install /Library/Python/2.7/...ort/pip-1.2.1.tar.gz failed with error code 2
I'm not particularly adept at reading OSX error messages. Would someone be willing to lend their knowledge to solve this problem?
For anyone else who gets error code 2 in the future here is how I dealt with it.
I never figured out which problem made the fix (there were a lot of problems) but I can outline the steps I took to cleaning up my computer.
I followed this guide to setting up my Python environment "right" http://docs.python-guide.org/en/latest/starting/install/osx/
I encounter a ton of errors when I did $ brew doctor
I laboriously got rid of every warning and error using google as my guide.
Many of the folder permissions had to be changed.
Eventually I was able to set up a virtualenv after a re installation of most everything.
Hope this helps anyone who encounters the same mess I did.