95

version pip 21.2.4 python 3.6

The command:

pip install -r  requirements.txt

The content of my requirements.txt:

mongoengine==0.19.1
numpy==1.16.2
pylint
pandas==1.1.5
fawkes

The command is failing with this error

ERROR: Command errored out with exit status 1:
     command: /Users/*/Desktop/ml/*/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"'; __file__='"'"'/private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-pip-egg-info-97994d6e
         cwd: /private/var/folders/kn/0y92g7x55qs7c42tln4gwhtm0000gp/T/pip-install-soh30mel/mongoengine_89e68f8427244f1bb3215b22f77a619c/
    Complete output (1 lines):
    error in mongoengine setup command: use_2to3 is invalid.
    ----------------------------------------
WARNING: Discarding https://*/pypi/packages/mongoengine-0.19.1.tar.gz#md5=68e613009f6466239158821a102ac084 (from https://*/pypi/simple/mongoengine/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mongoengine==0.19.1 (from versions: 0.15.0, 0.19.1)
ERROR: No matching distribution found for mongoengine==0.19.1
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
vamsi
  • 1,219
  • 1
  • 9
  • 15

6 Answers6

180

It looks like setuptools>=58 breaks support for use_2to3:

setuptools changelog for v58

So you should update setuptools to setuptools<58 or avoid using packages with use_2to3 in the setup parameters.

I was having the same problem, pip==19.3.1

vvvvv
  • 25,404
  • 19
  • 49
  • 81
nnseva
  • 1,946
  • 1
  • 13
  • 5
59

I install setuptools==58It worked for me. pip install setuptools==58. The error coming from setuptools==69 that previously run on my device. and Finally saved me setuptools version 58 for this error.

Md Jewele Islam
  • 939
  • 8
  • 18
7

This worked for me.

pip install --upgrade pip setuptools==57.5.0 
Jonny
  • 314
  • 4
  • 6
  • This worked for me too, but keep in mind you'll be downgrading at this point, and that may have unintended consequences down the road. ``` Installing collected packages: setuptools Attempting uninstall: setuptools Found existing installation: setuptools 65.6.3 Uninstalling setuptools-65.6.3: Successfully uninstalled setuptools-65.6.3 Successfully installed setuptools-57.5.0 ``` – Vizzyy Dec 29 '22 at 21:13
3

"pip install setuptools==58" worked for me. The setuptools version was 59 when I upgraded ubuntu to 22.04 and its python 3.10. I started a clean virtual environment for an existings django project. It had just two packages:

`pip list Package Version


pip 22.0.2 setuptools 59.6.0`

Then I downgrade the setuptools to 58 as pip install setuptools==58.0.0. After that the pip install -r requirements.txt has not such error above.

Dat TT
  • 2,850
  • 2
  • 16
  • 18
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 09 '22 at 13:31
  • 1
    Thank you. Of all the answers to this, this was the most helpful. I had tried adding setuptools=58 to my requirements.txt file, but that did not fix the issue for me when installing on my docker container. Explicitly calling `pip install setuptools=58` first is what fixed this for me. So while you may not have provided the descriptive reasoning behind why this worked, your procedural explanation was more helpful than the other answers I read! It could also be made even better by adding a little description of why this works (perhaps cite the top answer, as it gives a clear descriptive answer). – David Jul 05 '22 at 22:18
2

Upgrading MongoEngine to >= 0.20 would also fix the problem as Python2 support (hence use_2to3) was dropped in 0.20

bagerard
  • 5,681
  • 3
  • 24
  • 48
1

I'm working on Windows 11 and these solutions didn't work. I installed pybluez2 instead. Your python version >= 3.9 on Windows.

pip install pybluez2