ubuntu18.0.4安装gradio踩坑记

Collecting pandas (from gradio)
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/c3/e2/00cacecafbab071c787019f00ad84ca3185952f6bb9bca9550ed83870d4d/pandas-1.1.5-cp36-cp36m-manylinux1_x86_64.whl (9.5MB)
    100% |████████████████████████████████| 9.5MB 121.5MB/s 
Collecting orjson (from gradio)
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/92/97/895dfe0c2e7820fd5453d0efab6a9036de7f97b4edfd157a6a414dd3b0ee/orjson-3.6.1.tar.gz (746kB)
    100% |████████████████████████████████| 747kB 70.7MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.6/tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-3sjyk6dj/orjson/setup.py'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-3sjyk6dj/orjson/
 

发现安装到orjson这里报错

root@iZwz91taycqpzi9gcz9sdfZ:/usr/bin# pip3 install orjson
Collecting orjson
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/92/97/895dfe0c2e7820fd5453d0efab6a9036de7f97b4edfd157a6a414dd3b0ee/orjson-3.6.1.tar.gz (746kB)
    100% |████████████████████████████████| 747kB 76.2MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.6/tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-iuqipo46/orjson/setup.py'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-iuqipo46/orjson/
 

解决办法:升级一下pip setuptools

root@iZwz91taycqpzi9gcz9sdfZ:/usr/bin# pip3 install --upgrade pip setuptools
Collecting pip
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 49.8MB/s 
Collecting setuptools
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/b0/3a/88b210db68e56854d0bcf4b38e165e03be377e13907746f825790f3df5bf/setuptools-59.6.0-py3-none-any.whl (952kB)
    100% |████████████████████████████████| 962kB 33.2MB/s 
Installing collected packages: pip, setuptools
  Found existing installation: pip 9.0.1
    Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
  Found existing installation: setuptools 39.0.1
    Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed pip-21.3.1 setuptools-59.6.0

然后再继续pip3 install orjson,发现能按照成功。
root@iZwz91taycqpzi9gcz9sdfZ:/usr/bin# pip3 install orjson
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting orjson
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/08/70/163f5afd1a37e1a132873d0f0a480f1d741f0db7a375e252c7e86c7ad2f5/orjson-3.6.1-cp36-cp36m-manylinux_2_24_x86_64.whl (233 kB)
     |████████████████████████████████| 233 kB 5.7 MB/s            
Installing collected packages: orjson
Successfully installed orjson-3.6.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@iZwz91taycqpzi9gcz9sdfZ:/usr/bin# pip install --upgrade pip setuptools
接下来继续安装gradio

pip3 install gradio

至此一路安装畅通。

不过在检验是否安装成功时发现仍然报错

root@iZwz91taycqpzi9gcz9sdfZ:/usr/bin# python3 -c "import gradio"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/gradio/__init__.py", line 3, in <module>
    import gradio.components as components
  File "/usr/local/lib/python3.6/dist-packages/gradio/components.py", line 5
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
ubuntu带的python是3.6.9,而gradio要求的python版本不低于3.8

Prerequisite: Gradio requires Python 3.8 or higher

接下来先升级python版本。等后续。

  • 25
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一枚NPC

你的鼓励将是我创作的最大动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值