xml - can't install pillow neither packtools in Python 2.7.17 - Stack Overflow

admin2025-04-16  2

I mark articles for SciELO and I need to use Python 2.7.X to work with it, but when i try to install pillow, packtools and lxml the cmd points to "Could not find a version that satisfies the requirement pillow (from versions: )".

Here's the link in SciELO to follow the steps:

  1. I've install Python 2.7.17, add it to PATH
  2. Get XPM in 2.1. User: produtos-scielo 2.2. Password: produtos@scielo
  3. Executed install_requirements.bat

At the third step I get these erros that I printed

I mark articles for SciELO and I need to use Python 2.7.X to work with it, but when i try to install pillow, packtools and lxml the cmd points to "Could not find a version that satisfies the requirement pillow (from versions: )".

Here's the link in SciELO to follow the steps: https://documentacao.scielo.org/books/scielo-pc-programs/page/pre-requisitos

  1. I've install Python 2.7.17, add it to PATH
  2. Get XPM in ftp://ftp.scielo.br 2.1. User: produtos-scielo 2.2. Password: produtos@scielo
  3. Executed install_requirements.bat

At the third step I get these erros that I printed

Share Improve this question asked Feb 3 at 19:01 Saraiva_NSaraiva_N 91 silver badge2 bronze badges 4
  • 1 what happens when you run python -m pip install pillow==6.2.2? – dev_light Commented Feb 3 at 19:04
  • Also edit your question and add the version you're trying to install and the commands you ran... I already know it from Staging Ground but other users need to know too. – dev_light Commented Feb 3 at 19:06
  • 1 @dev_light They did have that information in the comments to this when it was on staging grounds but I agree it should be added here to the question – JonSG Commented Feb 3 at 19:07
  • 1 If you look at Pillows pypi page, it looks like it no longer supports Python 2.7, which isn't surprising, since Python 2 was sunsetted on January 1, 2020. Most major packages will no longer support it. Perhaps you can find a very old version somewhere, maybe using conda and the conda-forge channel. But frankly, you shouldn't expect to be able to do much with Python 2 – juanpa.arrivillaga Commented Feb 3 at 20:39
Add a comment  | 

3 Answers 3

Reset to default 1

You report that modern packaging infrastructure does not find any compatibile version combinations. That’s hardly surprising. Python 2.7 was supported in 2019, but it has not been supported for a very very long time. Recommend you switch to interpreter 3.9 or higher.

Pushing on a rope will not always prove effective. If the libraries you depend on are not compatible with python3, then either encourage the upstream developers to update their library, or you may choose to adopt different library dependencies to accomplish your business goals.

Ensure pip is at the correct version i.e. pip==9.0.3. Install specific versions of the libraries compatible with Python 2.7. Then install pillow as:

python -m pip install pillow packtools lxml --use-deprecated=legacy-resolver

As already mentioned, Python 2 is no longer supported for more than 5 years ([Python]: Sunsetting Python 2), so switching to newer (and supported) Python 3 is recommended.
However, there are a few cases when it's not possible, one of them is 3rd-party software still relying on it. I've encountered such an example on [SO]: When making a Python 2.7 venv in Pycharm, I am getting a syntax error and told it is using Python 3.11? How do I use Python 2.7? (@CristiFati's answer). According to you (I didn't check thorough enough) SciELO is another one.

Couple of notes:

  • You mentioned some errors but I can't see them

  • I can't use that FTP URL (from Explorer or command line). I am able to connect / authenticate, but there's no content

Latest versions of some of the packages that you mentioned no longer support Python 2, but there are older versions that do. Maybe Python 2.7's PIP is not smart enough to search older versions and fails:

  1. [PyPI]: pillow 6.2.2

  2. [PyPI]: lxml 4.9.4

  3. [PyPI]: packtools 2.6.4 (latest, supports Python 2, but depends on #2.)

To get around the problem, install the packages manually, before installing requirements. Example for the above 3 that normally fail:

[cfati@CFATI-5510-0:e:\Work\Dev\StackExchange\StackOverflow\q079409759]> sopr.bat
### Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ###

[prompt]>
[prompt]> e:\Work\Dev\VEnvs\py_pc032_02.07_test0\Scripts\activate.bat

(py_pc032_02.07.18_test0) [prompt]>
(py_pc032_02.07.18_test0) [prompt]> python -VV
Python 2.7.18

(py_pc032_02.07.18_test0) [prompt]>
(py_pc032_02.07.18_test0) [prompt]> python -m pip freeze
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.
pywin32==228

(py_pc032_02.07.18_test0) [prompt]> :: ----- Install packages -----
(py_pc032_02.07.18_test0) [prompt]> python -m pip install pillow==6.2.2 lxml==4.9.4 packtools
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.
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting pillow==6.2.2
  Downloading Pillow-6.2.2-cp27-cp27m-win32.whl (1.6 MB)
     |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 1.6 MB 799 kB/s
Collecting lxml==4.9.4
  Downloading lxml-4.9.4-cp27-cp27m-win32.whl (3.4 MB)
     |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 3.4 MB 2.6 MB/s
Collecting packtools
  Downloading packtools-2.6.4-py2.py3-none-any.whl (1.5 MB)
     |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 1.5 MB 3.5 MB/s
Collecting picles.plumber>=0.11
  Downloading picles.plumber-0.11-py2.py3-none-any.whl (6.9 kB)
Collecting pathlib>=1.0.1; python_version < "3.4"
  Downloading pathlib-1.0.1.tar.gz (49 kB)
     |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 49 kB 4.1 MB/s
Building wheels for collected packages: pathlib
  Building wheel for pathlib (setup.py) ... done
  Created wheel for pathlib: filename=pathlib-1.0.1-py2-none-any.whl size=14375 sha256=537af31d4968b35aae96fbf0dc16e32d9b2a957818f2564a5f292089e8292426
  Stored in directory: c:\users\cfati\appdata\local\temp\pip-ephem-wheel-cache-azsdip\wheels\46\37\4f\332bcea757140ff34e14dec7be65931f544c7ac94eb671ae9f
Successfully built pathlib
Installing collected packages: pillow, lxml, picles.plumber, pathlib, packtools
Successfully installed lxml-4.9.4 packtools-2.6.4 pathlib-1.0.1 picles.plumber-0.11 pillow-6.2.2
WARNING: You are using pip version 20.3.3; however, version 20.3.4 is available.
You should consider upgrading via the 'E:\Work\Dev\VEnvs\py_pc032_02.07.18_test0\Scripts\python.exe -m pip install --upgrade pip' command.

(py_pc032_02.07.18_test0) [prompt]>
(py_pc032_02.07.18_test0) [prompt]> python -m pip freeze
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.
lxml==4.9.4
packtools==2.6.4
pathlib==1.0.1
picles.plumber==0.11
Pillow==6.2.2
pywin32==228
转载请注明原文地址:http://www.anycun.com/QandA/1744755459a87158.html