-2

I'm trying to install the package pyminifier at the command prompt, this happens:

C:\Users\[my name]\Downloads\JKLMBombpartyHelper-master\JKLMBombpartyHelper-master>python -m pip install pyminifier
Collecting pyminifier
  Using cached pyminifier-2.1.tar.gz (47 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      Python 3.X support requires the 2to3 tool.
      It normally comes with Python 3.X but (apparenty) not on your distribution.
      Please find out what package you need to get 2to3and install it.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

However, if I attempt to install 2to3 using pip install 2to3, I find that it is already installed:

Requirement already satisfied: 2to3 in c:\users\[my name]\appdata\roaming\python\python310\site-packages (1.0)

What is wrong, and how do I fix it?

envi
  • 13
  • 5
  • 2
    [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) – Friedrich Apr 02 '23 at 18:37
  • 2
    After reading your entire question, I have no idea what you're asking. You need to explain better. – Mark Ransom Apr 02 '23 at 18:40
  • 2
    @Friedrich my bad, image removed – envi Apr 02 '23 at 18:43
  • 1
    Please post code that reproduces the problem. The previous comment meant that you should [edit] your question to include the code as text, not remove it entirely. – Code-Apprentice Apr 02 '23 at 18:47
  • 1
    @MarkRansom i'm trying to set up a program, i run pip install -r requirements.txt (i don't know if that's helpful) i get this error i'm not sure what it wants me to do i don't know what more i can explain – envi Apr 02 '23 at 18:47
  • 1
    Exactly what package are you trying to install? There is a pretty good chance that it simply is no longer supported on modern versions of Python. `2to3` is an old tool for updating old code to be compatible; it's in the process of being deprecated. – Karl Knechtel Apr 02 '23 at 18:56
  • See deprecation notice https://docs.python.org/3/library/2to3.html – OneCricketeer Apr 02 '23 at 19:01
  • @KarlKnechtel as in what i'm trying to install that triggers the error? "-r requirements.txt". – envi Apr 02 '23 at 19:01
  • 1
    Yes. Edit your question to include your requirements file – OneCricketeer Apr 02 '23 at 19:01
  • @OneCricketeer the deprecation notice says it doesn't work starting from 3.11, i'm using 3.10.6. – envi Apr 02 '23 at 19:07
  • "-r requirements.txt" means that `pip` will read a file that lists some packages to install. Please try to figure out **which one** is causing the problem when `pip` tries to install it, and **tell us** what it is. – Karl Knechtel Apr 02 '23 at 19:09
  • @KarlKnechtel (it's pyminifier) – envi Apr 02 '23 at 20:00
  • Are you using the exact same interpreter to install dependencies and to run the code? -- https://snarky.ca/why-you-should-use-python-m-pip/ – sinoroc Apr 02 '23 at 21:35
  • @sinoroc ran python -m pip install pyminifier, same error message – envi Apr 02 '23 at 22:14
  • 1
    This is not the full console output trace. Maybe it would be helpful to have more context of where that error message comes from. -- It could be that something is being run in a separate environment, as is typically the case when building dependencies. I can imagine that `pyminifier` (or whatever other dependency is being built) has build dpeendencies that require `2to3` but do not declare it. – sinoroc Apr 02 '23 at 22:19
  • @sinoroc you mean, like, you want me to show the entire download process thingy and not just the error message? – envi Apr 03 '23 at 12:19
  • @envi I think it could be helpful, yes. Maybe we won't find anything, but now we do not even know what command was being executed when the error message happened. We do not know what *pip* was doing at that moment, which dependency or build dependency it was trying to build or install. – sinoroc Apr 03 '23 at 12:38

2 Answers2

0

My guess is that it fails because pip tries to build a wheel of pyminifier in an isolated build environment and fails because there is no 2to3 in that build environment. This is a very old, outdated, unmaintained, and not well-behaved library. If I were you I would not use it at all, if I could.

If you really depend on that library, you could try to tell pip to install it without "build isolation", with python -m pip install --no-build-isolation --no-deps pyminifier. I am not sure it would help. Maybe it would be better to use an old Python version (not sure which Python version you are using right now). Honestly, I would rather not use this library at all if I were you.

sinoroc
  • 18,409
  • 2
  • 39
  • 70
0

Try This:

pip3 install --upgrade pip setuptools==57.5.0

then install

pip3 install pyminifier

worked!!

  • Versions are
  • python3 --version

Python 3.9.16

  • pip3 --version

pip 23.1.2

swetank soni
  • 29
  • 1
  • 13