Unable to install libraries with pip due to outdated BeautifulSoup - python

The command
pip install pyteaser
produces this error:
Collecting pyteaser
Using cached https://files.pythonhosted.org/packages/d4/7a/310592c6e7998440e56a8650446ecf3ded076431415c60f0f3b946b54462/pyteaser-2.0.tar.gz
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from pyteaser) (5.1.0)
Requirement already satisfied: lxml in /home/abhishek/PycharmProjects/learning-python/venv/lib/python3.6/site-packages (from pyteaser) (4.4.2)
Collecting cssselect (from pyteaser)
Using cached https://files.pythonhosted.org/packages/3b/d4/3b5c17f00cce85b9a1e6f91096e1cc8e8ede2e1be8e96b87ce1ed09e92c5/cssselect-1.1.0-py2.py3-none-any.whl
Collecting jieba (from pyteaser)
Using cached https://files.pythonhosted.org/packages/b2/c8/e0785494690876adbb5ac364eb148a240b738a614d7b39bf8dba8a7ad066/jieba-0.41.tar.gz
Collecting beautifulsoup (from pyteaser)
Using cached https://files.pythonhosted.org/packages/40/f2/6c9f2f3e696ee6a1fb0e4d7850617e224ed2b0b1e872110abffeca2a09d4/BeautifulSoup-3.2.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pycharm-packaging/beautifulsoup/setup.py", line 3
"You're trying to run a very old release of Beautiful Soup under Python 3. This will not work."<>"Please use Beautiful Soup 4, available through the pip package 'beautifulsoup4'."
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pycharm-packaging/beautifulsoup/
And the command
pip install pytldr
reports this error:
pip install pytldr
Collecting pytldr
Using cached https://files.pythonhosted.org/packages/70/09/02ed27061159e5f6d35abad4ec9ef3cac8e220093d61a2f7a42f53c9cb22/PyTLDR-0.1.4.tar.gz
Requirement already satisfied: numpy>=1.8.0 in /home/abhishek/PycharmProjects/learning-python/venv/lib/python3.6/site-packages (from pytldr) (1.18.1)
Requirement already satisfied: nltk>=3.0.0 in /home/abhishek/.local/lib/python3.6/site-packages (from pytldr) (3.4.5)
Requirement already satisfied: scipy>=0.13.2 in /home/abhishek/PycharmProjects/learning-python/venv/lib/python3.6/site-packages (from pytldr) (1.4.1)
Collecting scikit-learn>=0.15.2 (from pytldr)
Using cached https://files.pythonhosted.org/packages/d1/48/e9fa9e252abcd1447eff6f9257636af31758a6e46fd5ce5d3c879f6907cb/scikit_learn-0.22.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting goose-extractor>=1.0.25 (from pytldr)
Using cached https://files.pythonhosted.org/packages/ab/f3/2e89688e4e1d8786e542ea460431f24f1392d885e60303dc20d476a96424/goose-extractor-1.0.25.tar.gz
Collecting networkx>=1.9.1 (from pytldr)
Using cached https://files.pythonhosted.org/packages/41/8f/dd6a8e85946def36e4f2c69c84219af0fa5e832b018c970e92f2ad337e45/networkx-2.4-py3-none-any.whl
Requirement already satisfied: six in /home/abhishek/.local/lib/python3.6/site-packages (from nltk>=3.0.0->pytldr) (1.12.0)
Collecting joblib>=0.11 (from scikit-learn>=0.15.2->pytldr)
Using cached https://files.pythonhosted.org/packages/28/5c/cf6a2b65a321c4a209efcdf64c2689efae2cb62661f8f6f4bb28547cf1bf/joblib-0.14.1-py2.py3-none-any.whl
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from goose-extractor>=1.0.25->pytldr) (5.1.0)
Requirement already satisfied: lxml in /home/abhishek/PycharmProjects/learning-python/venv/lib/python3.6/site-packages (from goose-extractor>=1.0.25->pytldr) (4.4.2)
Collecting cssselect (from goose-extractor>=1.0.25->pytldr)
Using cached https://files.pythonhosted.org/packages/3b/d4/3b5c17f00cce85b9a1e6f91096e1cc8e8ede2e1be8e96b87ce1ed09e92c5/cssselect-1.1.0-py2.py3-none-any.whl
Collecting jieba (from goose-extractor>=1.0.25->pytldr)
Using cached https://files.pythonhosted.org/packages/b2/c8/e0785494690876adbb5ac364eb148a240b738a614d7b39bf8dba8a7ad066/jieba-0.41.tar.gz
Collecting beautifulsoup (from goose-extractor>=1.0.25->pytldr)
Using cached https://files.pythonhosted.org/packages/40/f2/6c9f2f3e696ee6a1fb0e4d7850617e224ed2b0b1e872110abffeca2a09d4/BeautifulSoup-3.2.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-9oa07p4e/beautifulsoup/setup.py", line 3
"You're trying to run a very old release of Beautiful Soup under Python 3. This will not work."<>"Please use Beautiful Soup 4, available through the pip package 'beautifulsoup4'."
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-9oa07p4e/beautifulsoup/
Note: you may need to restart the kernel to use updated packages.
EDIT:
After executing the command for BeautifulSoup
pip install beautifulsoup4
the response is:
Requirement already satisfied: beautifulsoup4 in /home/abhishek/PycharmProjects/learning-python/venv/lib/python3.6/site-packages (4.8.2)
Requirement already satisfied: soupsieve>=1.2 in /home/abhishek/PycharmProjects/learning-python/venv/lib/python3.6/site-packages (from beautifulsoup4) (1.9.5)
Note: you may need to restart the kernel to use updated packages.

The problem here is that the library is not (yet) ready for Python3, as you can see here in a comment on an issue of this library. And that is the source of your problem. As you can see, there are no issues if you install the library for Python2.7:
$ sudo apt install python-pip # or https://pip.pypa.io/en/stable/installing/
$ python --version
Python 2.7.17
$ python -m pip install pytldr
Successfully installed Pillow-6.2.2 beautifulsoup-3.2.2 cssselect-1.1.0 decorator-4.4.2 goose-extractor-1.0.25 jieba-0.42.1 lxml-4.5.0 networkx-2.2 nltk-3.4.5 numpy-1.16.6 pytldr-0.1.4 scikit-learn-0.20.4 scipy-1.2.3 singledispatch-3.4.0.3 six-1.14.0
Here, you can see that everything worked, because beautifulsoup-3.2.2 version was installed. Trying the same command for Python3 leads to the error you're posted:
$ python3 --version
Python 3.6.9
$ python3 -m pip install pytldr
Collecting beautifulsoup
Using cached BeautifulSoup-3.2.2.tar.gz (32 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-12aluvvq/beautifulsoup/setup.py'"'"'; __file__='"'"'/tmp/pip-install-12aluvvq/beautifulsoup/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-12aluvvq/beautifulsoup/pip-egg-info
cwd: /tmp/pip-install-12aluvvq/beautifulsoup/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-12aluvvq/beautifulsoup/setup.py", line 3
"You're trying to run a very old release of Beautiful Soup under Python 3. This will not work."<>"Please use Beautiful Soup 4, available through the pip package 'beautifulsoup4'."
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The error message is very clear:
You're trying to run a very old release of Beautiful Soup under Python 3. This will not work. Please use Beautiful Soup 4, available through the pip package 'beautifulsoup4'.
Simply installing BeautifulSoup4 is not solving the problem, because the library still uses code for BeautifulSoup3. That's a dependency of the pytldr package.
Now you have several options, maybe more:
Do not use this library.
Use Python2 (But it's the year 2020).
There is already an open pull request that offers code that allegedly has updated the library to be compliant with Python3. You can build the library from source with code provided there (no guarantee that this will work) or wait until the pull request was approved (or write to the author).
Go through the forks and see if anyone has already got the library up and running for Python3.
Try to update the library yourself and maybe with the help of 2to3.
You can apparently also install this fork directly instead of step 3. Of course, this fork may be out-of-date at some point, or it may be modified in such a way that it is no longer usable. There is also the option of installing a specific commit. But also no guarantee that this will work.

The pyteaser and goose-extractor libraries simply use the BeautifulSoup 3 library, which uses a different name from BeautifulSoup 4. You can't just install BeautifulSoup 4, because pyteaser and goose-extractor need to be updated to use the newer BeautifulSoup library. That's going to be more work, because those 2 projects are not compatible with Python 3 either.
You are basically stuck with Python 2 for these projects unless you are willing to do all the upgrade work yourself or put your trust in incomplete forks:
Unfortunately, even the forks that purport to make pyteaser Python 3 compatible have left in the wrong dependency. The project doesn't actually even import BeautifulSoup anywhere, so you'd have to clone one of the Python 3 forks (like this one) and remove the beautifulsoup entry from the install_requires line.
For PyTLDR, this fork can be installed on Python 3:
pip install git+https://github.com/vinodnimbalkar/PyTLDR.git#egg=pytldr
It dropped goose altogether.
Your mileage may vary, however, since the conversion looks, to me, somewhat haphazard. For Unicode text (the default in Python 3), normalization will never take place (both the if and elif branches test for the same condition now), for example. And while it removed the goose-extractor dependency, the code still tries to import it if you referenced it, which won't work either.
If you wanted to use goose-extractor directly, you can replace with goose3. Note that this also changed the module name, to goose3 (so the PyTLDR fork above could perhaps be fixed by changing the imported module name).

Related

finnhub installation using pip

I've currently installation of python 3.10 [not conda dist]. I'm trying to import finnhub using both cmd but I'm confronted with the following error message:
C:\Users\Admin>python -m pip install finnhub
ERROR: Could not find a version that satisfies the requirement finnhub (from versions: none)
ERROR: No matching distribution found for finnhub
Any ideas on what I'm missing please? I've also tried to install this package using PyCharm but this results in the following error:
C:\Users\Admin\PycharmProjects\NewPython\venv\Scripts\python.exe C:/Users/Admin/PycharmProjects/NewPython/main.py
Traceback (most recent call last):
File "C:\Users\Admin\PycharmProjects\NewPython\main.py", line 1, in <module>
import finnhub
ModuleNotFoundError: No module named 'finnhub'
Process finished with exit code 1
I have added the python installation to PATH and the current version of pip is the latest version.
Many thanks in advance for your help.
Question update
In the meantime, I have spotted an old environment reference which has been now removed. This seems to allow the install of finnhub using
pip install finnhub--python
but not
pip install finnhub
Code below:
C:\Users\Admin>pip install finnhub
ERROR: Could not find a version that satisfies the requirement finnhub (from versions: none)
ERROR: No matching distribution found for finnhub
C:\Users\Admin>pip install finnhub--python
Requirement already satisfied: finnhub--python in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (2.4.13)
Requirement already satisfied: requests>=2.22.0 in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from finnhub--python) (2.28.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from requests>=2.22.0->finnhub--python) (1.26.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from requests>=2.22.0->finnhub--python) (2022.6.15)
Requirement already satisfied: idna<4,>=2.5 in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from requests>=2.22.0->finnhub--python) (3.3)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (from requests>=2.22.0->finnhub--python) (2.1.0)
C:\Users\Admin>
When using PyCharm to try to access this from the IDE, I am now confronted with:
C:\Users\Admin\PycharmProjects\pythonProject2\venv\Scripts\python.exe C:/Users/Admin/PycharmProjects/pythonProject2/main.py
Traceback (most recent call last):
File "C:\Users\Admin\PycharmProjects\pythonProject2\main.py", line 1, in <module>
import finnhub
ModuleNotFoundError: No module named 'finnhub'
Process finished with exit code 1
From the the section "Installation" of the package's documentation:
pip install finnhub-python
In this command, it becomes clear that you have installed finhub globally,
C:\Users\Admin>pip install finnhub--python
Requirement already satisfied: finnhub--python in c:\users\admin\appdata\local\programs\python\python310\lib\site-packages (2.4.13)
But when running your script your command looks like this
C:\Users\Admin\PycharmProjects\NewPython\venv\Scripts\python.exe C:/Users/Admin/PycharmProjects/NewPython/main.py
So you are using a virtual environment for your project in which finnhub is probably not installed yet.
Try:
C:\Users\Admin\PycharmProjects\NewPython\venv\Scripts\python.exe -m pip install finnhub-python
Alternatively, you can use pycharm as well
With your project open go to File
Select Settings->Project->Python Interpreter
You should see a list of packages and their version. Hit the little + button above it
Search for finnhub-python, select it and hit Install Package

ImportError: No module named request, but in Path

I am trying to run a .py script that calls the request library.
anyoung#ANYOUNG-LTW7 /cygdrive/c/Users/anyoung/test/temp/Image-Crawler
$ python main.py
Traceback (most recent call last):
File "main.py", line 3, in <module>
import urllib.request
ImportError: No module named request
For some reason, Python is unable to find the library. However, I check that the path includes /usr/lib/python2.7/site-packages:
anyoung#ANYOUNG-LTW7 /cygdrive/c/Users/anyoung/test/temp/Image-Crawler
$ python -c "import sys; print('\n'.join(sys.path))"
/usr/lib/python2.7/site-packages/paramiko-1.16.0-py2.7.egg
/usr/lib/python2.7/site-packages/ecdsa-0.13-py2.7.egg
/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-cygwin
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/home/anyoung/.local/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/gtk-2.0
/usr/lib/python2.7/site-packages shows the request dir:
Any ideas on how I can resolve this error?
-- UPDATE BASED ON FIRST ANSWER --
I installed Python 3. But the module is still not found.
In cmd.exe:
C:\Users\anyoung>pip3 install requests
Collecting requests
Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8
a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (9
1kB)
100% |████████████████████████████████| 92kB 152kB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests)
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b648
7b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133
kB)
100% |████████████████████████████████| 143kB 216kB/s
Collecting idna<2.8,>=2.5 (from requests)
Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1
af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
100% |████████████████████████████████| 61kB 208kB/s
Collecting urllib3<1.24,>=1.21.1 (from requests)
Downloading https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5
e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl (133k
B)
100% |████████████████████████████████| 143kB 261kB/s
Collecting certifi>=2017.4.17 (from requests)
Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975f
c916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
(150kB)
100% |████████████████████████████████| 153kB 407kB/s
Installing collected packages: chardet, idna, urllib3, certifi, requests
The script chardetect.exe is installed in 'c:\users\anyoung\appdata\local\prog
rams\python\python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warn
ing, use --no-warn-script-location.
Successfully installed certifi-2018.4.16 chardet-3.0.4 idna-2.7 requests-2.19.1
urllib3-1.23
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
I add c:\users\anyoung\appdata\local\programs\python\python37\Scripts to the PATH variable via the GUI:
Try again and get the same error message:
anyoung#ANYOUNG-LTW7 /cygdrive/c/Users/anyoung/test/temp/Image-Crawler
$ python3 main.py
Traceback (most recent call last):
File "main.py", line 4, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
request and requests are not the same thing.
urllib.request is not the same as either.
Just because two things have kind of similar names doesn’t mean they’re interchangeable. requests is a third-party package for doing HTTP at a high level. urllib.request is a module in the urllib package in the Python 3 standard library for doing HTTP, FTP, and other protocols at a lower level.
The problem here is that you’re trying to run Python 3 code that uses urllib.request, in Python 2.7. You can rename every reference to urllib.request to its rough Python 2 equivalent, urllib2, and that might work. But it might not. And there’s a good chance that the code has other Python 3-specific imports or features, so it still won’t run, or won’t run correctly.
The right thing to do is to run the Python 3 code in Python 3.
If you can’t do this, you need to look into porting the code back to Python 2, or to dual-version code using six or modernize. The 3to2 tool can help get you started, but it won’t do everything for you automatically, and it’s not something people can tell you how to do in a simple Stack Overflow answer.

Could not satisfy Django application requirements

I have been trying to run a Django application since afternoon. The application probably uses Python 2.7. I have created virtual environment and I have installed Django with Python PIP package manager. However, this application requires JQuery package for proper working. Unfortunately, an error has occurred when I tried to install JQuery package with PIP:
(my_env) user➜~/carcaresilesia» pip install jquery [16:39:44] ⚡[..........]
Collecting jquery
Using cached https://files.pythonhosted.org/packages/05/45/9a6d7ff770b1279c901c8dfca1f9a9d6c9822d75a2bad834d0e2ddd4f8cd/jquery-1.2.3.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-wKwd78/jquery/setup.py", line 2, in <module>
from turbogears.finddata import find_package_data
ImportError: No module named turbogears.finddata
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-wKwd78/jquery/
I tried install the turbogears package, unsuccessfully with below error:
(my_env) user➜~/carcaresilesia» pip install turbogears
Collecting turbogears
Using cached https://files.pythonhosted.org/packages/1d/35/80872474a6663b6994b6879041a38b2fa81a34098e331f2ffddd43e2c8d3/TurboGears-1.5.1.tar.gz
Collecting CherryPy>=3.1.2 (from turbogears)
Using cached https://files.pythonhosted.org/packages/b8/6d/d0d951dee5ba50900eccb71ef501a847d0392f50056d36234740f97a2ef8/CherryPy-14.2.0-py2.py3-none-any.whl
Collecting ConfigObj>=4.3.2 (from turbogears)
Using cached https://files.pythonhosted.org/packages/64/61/079eb60459c44929e684fa7d9e2fdca403f67d64dd9dbac27296be2e0fab/configobj-5.0.6.tar.gz
Collecting FormEncode>=1.2.1 (from turbogears)
Using cached https://files.pythonhosted.org/packages/2f/53/707c2b9b65ea6bedde67c21cbf7c71394f4a198620d4e9c1771214b91dcc/FormEncode-1.3.1.tar.gz
Collecting Genshi>=0.4.4 (from turbogears)
Using cached https://files.pythonhosted.org/packages/c5/2f/34493b2286561d0ea003c568a6c80343eee3c9975a69964d22ce8501dd3f/Genshi-0.7.tar.gz
Collecting PasteScript[cheetah]>=1.7 (from turbogears)
Using cached https://files.pythonhosted.org/packages/06/7d/ddc3efab0967e7056bcd6adea0b860717b4b6e4d3ea8ec49985ed0f43cb0/PasteScript-2.0.2-py2.py3-none-any.whl
Ignoring Cheetah: markers 'extra == "Cheetah"' don't match your environment
Collecting PEAK-Rules>=0.5a1.dev-r2555 (from turbogears)
Could not find a version that satisfies the requirement PEAK-Rules>=0.5a1.dev-r2555 (from turbogears) (from versions: )
No matching distribution found for PEAK-Rules>=0.5a1.dev-r2555 (from turbogears)
How can I satisfy these dependencies?
Your project almost certainly doesn't rely on the python package jQuery, since it appears to be for turbogears, which is a completely different web framework to Django.
If your templates require jQuery then you should download and add it to your static files, or use a CDN.

pip Installing a python module in Python 3, but that module has a dependency package that requires Python 2

so I am new to Python and what is a good way to learn it is to do some personal project :) So I am on my Windows and using virtualenv to contain environment
So, I need to use the Scrappy module:
pip install scrappy
Collecting scrappy
Using cached Scrappy-0.3.0.alpha.4.tar.gz
Collecting guessit (from scrappy)
Using cached guessit-2.1.4.tar.gz
Collecting tvdb_api (from scrappy)
Using cached tvdb_api-2.0.tar.gz
Collecting hachoir-metadata (from scrappy)
Using cached hachoir-metadata-1.3.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\USERPH\AppData\Local\Temp\pip-build-__zp7zbj\hachoir-metadata\setup.py", line 65
except OSError, err:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\USERPH\AppData\Local\Temp\pip-build-__zp7zbj\h
achoir-metadata\
Its because hachoir-metadata is a Python2 dependent package, so I tried installing their Python 3 version
pip install hachoir3
I confirmed that it was installed using
pip list | Select-String hachoir3
so I tried running
pip install scrappy again
but same error.
Any work around to install scrappy? I cannot go down to Python 2.
Thanks!
Scrappy itself contains code that only works in Python 2. I.e. Scrappy cannot be used with Python 3+.

Unable to resolve dependencies for the Python OCR Library pypdfocr [duplicate]

This question already has answers here:
Cannot install modules via pip running on python 3.4
(2 answers)
Closed 6 years ago.
I have tried installing pypdfocr using the commands:
pip install pypdfocr
pip install -i https://pypi.anaconda.org/pypi/simple pypdfocr
but I am continuously getting the error message:
File "C:\Users\888537\AppData\Local\Temp\pip-build-b4mwr93n\evernote\setup
.py", line 6
exec x
^
SyntaxError: Missing parentheses in call to 'exec'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\888537\A
ppData\Local\Temp\pip-build-b4mwr93n\evernote\
The following is the log of installation:
[Anaconda3] C:\Users\888537>pip install -i https://pypi.anaconda.org/pypi/simple
pypdfocr
Collecting pypdfocr
Downloading https://pypi.anaconda.org/pypi/simple/pypdfocr/0.7.6/pypdfocr-0.7.
6.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pillow>=2.2 in d:\anac
onda3\lib\site-packages (from pypdfocr)
Requirement already satisfied (use --upgrade to upgrade): reportlab>=2.7 in d:\a
naconda3\lib\site-packages (from pypdfocr)
Collecting watchdog>=0.6.0 (from pypdfocr)
Downloading https://pypi.anaconda.org/pypi/simple/watchdog/0.8.1/watchdog-0.8.
1.tar.gz (154kB)
100% |################################| 163kB 52kB/s
Requirement already satisfied (use --upgrade to upgrade): pypdf2>=1.23 in d:\ana
conda3\lib\site-packages (from pypdfocr)
Collecting evernote (from pypdfocr)
Downloading https://pypi.anaconda.org/pypi/simple/evernote/1.25.0/evernote-1.2
5.0.tar.gz (140kB)
100% |################################| 143kB 187kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\888537\AppData\Local\Temp\pip-build-b4mwr93n\evernote\setup
.py", line 6
exec x
^
SyntaxError: Missing parentheses in call to 'exec'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\888537\A
ppData\Local\Temp\pip-build-b4mwr93n\evernote\
How can I rectify this installation problem with pypdfocr library?
Use Python 2.x instead of 3.x or find the line where syntax error occurs and add the parenthesis.
See, in Python 3 exec is a function, but in Python 2 exec is a command.
So in Python 3, you have to put arguments into parenthesis to make a call to exec() properly.
So, you're trying to install the package to Python3 that is meant for Python 2.
At least installation script is.
OK, that is what I can deduce from that error log. I am not familiar with PyPDFOCR, although I Suspect it uses tesseract for OCRing, and probably PDFMiner to access images from a PDF document.
To continue using PIP, first download, not install, the package, then change setup.py, then do python setup.py install.
Although, if a script is for Python 2, it may be that the package in question is meant only for Python 2. Because pip should automatically choose the correct package version for installed Python.
All the mess may have something to do with the Anaconda distro.
Good luck.

Categories

Resources