Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while downloading the requirements using pip install (setup command: use_2to3 is invalid.)

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
like image 224
vamsi Avatar asked Sep 08 '21 09:09

vamsi


People also ask

Why can't I install using pip?

This error usually means there's a problem with the Python installation or the system variable PATH is not set up correctly. Try reinstalling Python and all its components to fix the problem. The easiest way is via the Python executable installer.

How do you fix error you must give at least one requirement to install see pip help install?

You must give at least one requirement to install (see "pip help install") You are using pip version 9.0. 1, however version 9.0. 3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Why can't I install requirements in Pip?

The errors is caused by incorrect syntax for the install command. The correct pip install command for installing requirement files is: If the -r option is skipped pip will try to install package requirements.txt. If you work with requirement files then the option should be added.

Does the setuptools upgrade support use_2to3?

However, the setuptools upgrade also drops support for the deprecated use_2to3 feature, which may be used be a small number of legacy dependency versions. This change occurred in setuptools 58.0.0 (released 2021-09-04), which we have deliberately not updated to for as long as possible, in order to give any affected packages time to be fixed.

Why is Setuptools no longer updating to 58?

This change occurred in setuptools 58.0.0 (released 2021-09-04), which we have deliberately not updated to for as long as possible, in order to give any affected packages time to be fixed. However it's no longer viable to delay updating any longer, due to the pipenv compatibility issues.


Video Answer


3 Answers

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

like image 111
nnseva Avatar answered Oct 21 '22 04:10

nnseva


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.

like image 44
Md Jewele Islam Avatar answered Oct 21 '22 04:10

Md Jewele Islam


"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.

like image 2
Anand Pusarla Avatar answered Oct 21 '22 04:10

Anand Pusarla