53 Command “python setup.py egg_info“ failed with error

Posted Chasing_Chasing

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了53 Command “python setup.py egg_info“ failed with error相关的知识,希望对你有一定的参考价值。

53.1 引言

今天在Ubuntu环境下搭建安信科技的ESP8266开发环境,到配置这一步骤时出现了,一个问题,网上一顿查阅,然后并没有实际解决,后面查到外文blog外国朋友遇到跟我一样的问题,参考他的做法才解决,特此记录,弥补中文博客对该问题解决方案的完整性不足问题。

53.2 问题

配置编译问题如下所示:

qihua@qihua-virtual-machine:~/esp/setuptools-19.2$ sudo pip install setuptools -U
The directory '/home/qihua/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/qihua/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/1e/5c/3d7b3d91a86d71faf5038c5d259ed36b5d05b7804648e2c43251d574a6e6/setuptools-58.2.0.tar.gz (2.3MB)
    100% |████████████████████████████████| 2.3MB 830kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "setuptools/__init__.py", line 16, in <module>
        import setuptools.version
      File "setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "pkg_resources/__init__.py", line 1367
        raise SyntaxError(e) from e
                                ^
    SyntaxError: invalid syntax
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-H1VVcQ/setuptools/
You are using pip version 8.1.1, however version 21.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

根据上述提示,是pip这个工具版本太低导致的,只要运行pip相关的命令就会出错。

sudo python -m pip install --user -r $IDF_PATH/requirements.txt
The directory '/home/qihua/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/qihua/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): setuptools in /home/qihua/esp/setuptools-19.2 (from -r /home/qihua/esp/ESP8266_RTOS_SDK/requirements.txt (line 4))
Collecting click>=5.0 (from -r /home/qihua/esp/ESP8266_RTOS_SDK/requirements.txt (line 8))
  Downloading https://files.pythonhosted.org/packages/21/83/308a74ca1104fe1e3197d31693a7a2db67c2d4e668f20f43a2fca491f9f7/click-8.0.1.tar.gz (327kB)
    100% |████████████████████████████████| 327kB 538kB/s 
    Complete output from command python setup.py egg_info:
    error in click setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected version spec in colorama; platform_system == 'Windows' at ; platform_system == 'Windows'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-iqFjPF/click/
You are using pip version 8.1.1, however version 21.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

但是按照提示,执行升级更新指令:pip install --upgrade pip  后,并没啥用,没有更新到。

53.3 解决

经过一顿查阅,自动升级pip的命令(如下),没有成功,可能只是匹配当前环境用到的版本而已。

pip install --upgrade pip

然后用指定升级版本的方法,让pip升级到高版本就行了,命令如下:

pip install --upgrade pip==20.3

升级了pip之后,我顺便把setuptools工具也升级了。

qihua@qihua-virtual-machine:~/esp/setuptools-19.2$ python -m pip install --upgrade setuptools
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.
Defaulting to user installation because normal site-packages is not writeable
Collecting setuptools
  Downloading setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
     |████████████████████████████████| 583 kB 231 kB/s 
Installing collected packages: setuptools
Successfully installed setuptools-44.1.1
WARNING: You are using pip version 20.3; however, version 20.3.4 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.

最后,问题解决了!!

qihua@qihua-virtual-machine:~/esp/setuptools-19.2$ sudo python -m pip install --user -r $IDF_PATH/requirements.txt
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.
WARNING: The directory '/home/qihua/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages/setuptools-19.2-py2.7.egg (from -r /home/qihua/esp/ESP8266_RTOS_SDK/requirements.txt (line 4)) (19.2)
Collecting click>=5.0
  Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
     |████████████████████████████████| 82 kB 207 kB/s 
Requirement already satisfied: pyserial>=3.0 in /usr/lib/python2.7/dist-packages (from -r /home/qihua/esp/ESP8266_RTOS_SDK/requirements.txt (line 9)) (3.0.1)
Collecting future>=0.15.2
  Downloading future-0.18.2.tar.gz (829 kB)
     |████████████████████████████████| 829 kB 363 kB/s 
Collecting cryptography>=2.1.4
  Downloading cryptography-3.3.2-cp27-cp27mu-manylinux2010_x86_64.whl (2.6 MB)
     |████████████████████████████████| 2.6 MB 8.0 MB/s 
Collecting pyparsing<2.4.0,>=2.0.3
  Downloading pyparsing-2.3.1-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 19.0 MB/s 
Collecting pyelftools>=0.22
  Downloading pyelftools-0.27-py2.py3-none-any.whl (151 kB)
     |████████████████████████████████| 151 kB 34.7 MB/s 
Collecting enum34; python_version < "3"
  Downloading enum34-1.1.10-py2-none-any.whl (11 kB)
Collecting six>=1.4.1
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting ipaddress; python_version < "3"
  Downloading ipaddress-1.0.23-py2.py3-none-any.whl (18 kB)
Collecting cffi>=1.12
  Downloading cffi-1.14.6-cp27-cp27mu-manylinux1_x86_64.whl (389 kB)
     |████████████████████████████████| 389 kB 12.1 MB/s 
Collecting pycparser
  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 18.2 MB/s 
Building wheels for collected packages: future
  Building wheel for future (setup.py) ... done
  Created wheel for future: filename=future-0.18.2-py2-none-any.whl size=504728 sha256=b1326b708e930fd621e0c6b869c09994de1f05597255e33694647dcdb71475df
  Stored in directory: /tmp/pip-ephem-wheel-cache-lty8At/wheels/5f/11/0c/aad680baf5ef4fbcbab992c9f03e1130357e0c173a4fdabfff
Successfully built future
Installing collected packages: click, future, enum34, six, ipaddress, pycparser, cffi, cryptography, pyparsing, pyelftools
  WARNING: The scripts futurize and pasteurize are installed in '/home/qihua/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed cffi-1.14.6 click-7.1.2 cryptography-3.3.2 enum34-1.1.10 future-0.18.2 ipaddress-1.0.23 pycparser-2.20 pyelftools-0.27 pyparsing-2.3.1 six-1.16.0
WARNING: You are using pip version 20.3; however, version 20.3.4 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.

以上是关于53 Command “python setup.py egg_info“ failed with error的主要内容,如果未能解决你的问题,请参考以下文章

python安装Fabrix出现Command "python setup.py egg_info"错误

解决 Command "python setup.py egg_info" failed with error code 1 问题

Command "python setup.py egg_info" failed with error code 1一种问题的解决方法

在执行 pip install 时遇到错误:python setup.py egg_info Check the logs for full command output

解决安装ipython时Command "python setup.py egg_info" failed with error code 1 in /tmp

pip install报python setup.py egg_info Check the logs for full command output.