Parsing PDF to CSV - python

I have a PDF which contains a table that I would like to get into Excel. I found pdftables (a Python library) which may be able to do the job but I am having a problem installing the library. I am running Python 3.7.4 with Anaconda. When I try to install using pip, I get an error. Can anyone either tell me how to install the library or suggest another way to parse the table?
pip install pdftables
Collecting pdftables
Using cached https://files.pythonhosted.org/packages/5a/68/c587103e6937acd2ac4f07538e8b09d76e75979ffe57ac7bc59f256a79d7/pdftables-0.0.4.tar.gz
Collecting pdfminer==20110515 (from pdftables)
Using cached https://files.pythonhosted.org/packages/ce/f8/512bcd1a116d0332ab9fab84c3771d4699216db1086e120d581535665c31/pdfminer-20110515.tar.gz
ERROR: Command errored out with exit status 1:
command: /Users/ihf/opt/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/y2/38gkkc0s7d52_mr_s6zfj7m80000gq/T/pip-install-_h1bkupj/pdfminer/setup.py'"'"'; file='"'"'/private/var/folders/y2/38gkkc0s7d52_mr_s6zfj7m80000gq/T/pip-install-_h1bkupj/pdfminer/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/y2/38gkkc0s7d52_mr_s6zfj7m80000gq/T/pip-install-_h1bkupj/pdfminer/
Complete output (8 lines):
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/y2/38gkkc0s7d52_mr_s6zfj7m80000gq/T/pip-install-_h1bkupj/pdfminer/setup.py", line 3, in
from pdfminer import version
File "/private/var/folders/y2/38gkkc0s7d52_mr_s6zfj7m80000gq/T/pip-install-_h1bkupj/pdfminer/pdfminer/init.py", line 4
if name == 'main': print version
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(version)?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

Related

Module Not Getting Installed: pip3 install morphy

I want to install the python module morphy on Ubuntu 20.04.2, but I am getting an error.
I tried this:
pip3 install morphy
I got this output:
Collecting morphy
Using cached morphy-0.2.tar.gz (9.3 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uygwfbh3/morphy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uygwfbh3/morphy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-uygwfbh3/morphy/pip-egg-info
cwd: /tmp/pip-install-uygwfbh3/morphy/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-uygwfbh3/morphy/setup.py", line 3, in <module>
with open('README.md', 'r') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'README.md'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
It worked on Windows 10 though. My pip3 version is:
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
I tried this too:
pip install morphy
I got this output:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting morphy
Using cached morphy-0.2.tar.gz (9.3 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ICmImS/morphy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ICmImS/morphy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-lPhE0U
cwd: /tmp/pip-install-ICmImS/morphy/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ICmImS/morphy/setup.py", line 3, in <module>
with open('README.md', 'r') as fp:
IOError: [Errno 2] No such file or directory: 'README.md'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
It is clear from the output that the README.md file is missing from the package. What should I do?
Looks like the Linux version of the package might be broken and it doesn't seem to be maintained anymore.
You can use the following workaround:
try installing again but tell pip not to clean up the temporary files: pip install morphy --no-clean
enter the temporary directory with the package contents - find its name in the output from the pip install command
create the files setup.py needs
execute python setup.py install manually
if you know what this package's requirements are, install them manually
$ pip install morphy --no-clean
Collecting morphy
Using cached morphy-0.2.tar.gz (9.3 kB)
ERROR: Command errored out with exit status 1:
command: /home/user/env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vluz3ja_/morphy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vluz3ja_/morphy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-vluz3ja_/morphy/pip-egg-info
cwd: /tmp/pip-install-vluz3ja_/morphy/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-vluz3ja_/morphy/setup.py", line 3, in <module>
with open('README.md', 'r') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'README.md'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
$ cd /tmp/pip-install-vluz3ja_/morphy
$ touch README.md
$ touch requirements.txt
$ python setup.py install
...
Installed /home/user/env/lib/python3.8/site-packages/morphy-0.2-py3.8.egg
Processing dependencies for morphy==0.2
Finished processing dependencies for morphy==0.2

Cannot install xml.etree.elementtree in pycharm

Using cached pycopy-xml.etree.ElementTree-0.1.2.tar.gz (1.9 kB)
DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
ERROR: Command errored out with exit status 1:
command: 'F:\Python\venv\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pycharm-packaging\\pycopy-xml-etree-elementtree\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pycharm-packaging\\pycopy-xml-etree-elementtree\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\hp\AppData\Local\Temp\pip-pip-egg-info-ncg_nv94'
cwd: C:\Users\hp\AppData\Local\Temp\pycharm-packaging\pycopy-xml-etree-elementtree\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\hp\\AppData\\Local\\Temp\\pycharm-packaging\\pycopy-xml-etree-elementtree\\setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
No, you don't need to install py-xml: the ElementTree API is part of the standard library of Python
here
In fact, py-xml is an old and probably obsolete package whose installation script appears to be only compatible with Python 2. One more reason why you don't need to install it!
If you would have just put the import statement in your code it would have worked without any issue in that regard.

How to install Vizdoom python

I am new to programming, I am trying to install vizdoom on windows 10, python. Using the command:
pip install vizdoom
and keep getting this error, I have tried searching around, have spent hours but am not able to fix it.
Collecting vizdoom Using cached vizdoom-1.1.7.tar.gz (4.9 MB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\USER\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe'
-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-sqhbgmz4\\vizdoom\\setup.py'"'"';
__file__='"'"'C:\\Users\\USER\\AppData\\Local\\Temp\\pip-install-sqhbgmz4\\vizdoom\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\USER\AppData\Local\Temp\pip-pip-egg-info-m7e2idad'
cwd: C:\Users\USER\AppData\Local\Temp\pip-install-sqhbgmz4\vizdoom\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\USER\AppData\Local\Temp\pip-install-sqhbgmz4\vizdoom\setup.py", line 14, in <module>
raise RuntimeError("Building pip package on Windows is not currently available ...")
RuntimeError: Building pip package on Windows is not currently available ...
---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
as a last resort, I hope to get some help from here.
Never mind, I switched to ubuntu.

Why am I getting an "ERROR Command errored out with exit status 1" when installing the ratfun package for python 3.6?

I am trying to install the ratfun package for python 3.6 with
pip3.6 install ratfun
but am getting the ERROR shown in code down below.
Doing
sudo pip3.6 install ratfun
or updating setuptools
pip3.6 install --upgrade pip setuptools wheel
doesn't help. I am using the latest version of pip3.6.
From other threads I understood that
ERROR: Command errored out with exit status 1:
can in general be linked to some denied permissions, but I don't know how to fix it. Thanks for any ideas!
I am using macOS 10.15.2
Downloading ratfun-2.6.tar.gz (56 kB)
|████████████████████████████████| 56 kB 1.2 MB/s
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/nc/bzf21l914zq832bjwd5lc4wh0000gn/T/pip-install-7zqss5yi/ratfun/setup.py'"'"'; __file__='"'"'/private/var/folders/nc/bzf21l914zq832bjwd5lc4wh0000gn/T/pip-install-7zqss5yi/ratfun/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/nc/bzf21l914zq832bjwd5lc4wh0000gn/T/pip-install-7zqss5yi/ratfun/pip-egg-info
cwd: /private/var/folders/nc/bzf21l914zq832bjwd5lc4wh0000gn/T/pip-install-7zqss5yi/ratfun/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/nc/bzf21l914zq832bjwd5lc4wh0000gn/T/pip-install-7zqss5yi/ratfun/setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.```
The package really doesn't have setup.py. It's not a pip-installable package. You can download it, unpack and try to run python clnum_setup.py install. But please note the package was last released in 2009 so I'd not expect it to run with Python 3. Try Python 2.7.

Unable to install ssl in my local system using pip install ssl

I'm very new to python and when i tried to install some lib it is giving me this issue. can you please help on what to do.
When trying to install ssl using pip command it is giving me the below error
"pip install ssl"
Collecting ssl
Using cached https://files.pythonhosted.org/packages/83/21/f469c9923235f8c36d5fd5334ed11e2681abad7e0032c5aba964dcaf9bbb/ssl-1.16.tar.gz
ERROR: Command errored out with exit status 1:
command: 'c:\users\rajesh_navaneeth\appdata\local\programs\python\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\RAJESH~1\\AppData\\Local\\Temp\\pip-install-ag0q6n7p\\ssl\\setup.py'"'"'; __file__='"'"'C:\\Users\\RAJESH~1\\AppData\\Local\\Temp\\pip-install-ag0q6n7p\\ssl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: C:\Users\RAJESH~1\AppData\Local\Temp\pip-install-ag0q6n7p\ssl\
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\RAJESH~1\AppData\Local\Temp\pip-install-ag0q6n7p\ssl\setup.py", line 33
print 'looking for', f
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('looking for', f)?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
long story short, don't install that python package. It's deprecated (shouldn't be installed in Python 2.6 and newer) and your python already includes ssl package.
In general you shouldn't even be able to install it via pip, but I guess that it's so old that setup.py didn't support version restrictions in the same way it does now.

Categories