最近大家 conda 创建环境 好用吗? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
clarkchen
V2EX    Python

最近大家 conda 创建环境 好用吗?

  •  
  •   clarkchen 2017-06-04 17:07:45 +08:00 1193 次点击
    这是一个创建于 3056 天前的主题,其中的信息可能已经有所发展或是发生改变。

    本来以为 GFW 是暂时性的抽疯,封了 Anaconda 的官网,结果貌似封了两个月,现在只能靠着 proxychains 来做更新。

    4 月之前创建一个 conda 环境,下载包的时候本来就慢,优化点是 channle 添加国内 但是 4 月之后,在创建开发环境的时候,就各种报超时,都到不了下载包那一步。

    比如

    conda create -name py3test python=3 # 执行结果 Fetching package metadata ..... CondaHTTPError: HTTP None None for url <https://conda.anaconda.org/conda-forge/osx-64/repodata.json> Elapsed: None An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. ConnectionError(MaxRetryError("HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/osx-64/repodata.json (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10fb9e410>: Failed to establish a new connection: [Errno 65] No route to host',))",),) 

    本机的 conda info 如下

     platform : osx-64 conda version : 4.3.21 conda is private : False conda-env version : 4.3.21 conda-build version : 0+unknown python version : 2.7.12.final.0 requests version : 2.14.2 root environment : /Users/chenxi/anaconda (writable) default environment : /Users/chenxi/anaconda envs directories : /Users/chenxi/anaconda/envs /Users/chenxi/.conda/envs package cache : /Users/chenxi/anaconda/pkgs /Users/chenxi/.conda/pkgs channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/osx-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch https://conda.anaconda.org/conda-forge/osx-64 https://conda.anaconda.org/conda-forge/noarch https://repo.continuum.io/pkgs/free/osx-64 https://repo.continuum.io/pkgs/free/noarch https://repo.continuum.io/pkgs/r/osx-64 https://repo.continuum.io/pkgs/r/noarch https://repo.continuum.io/pkgs/pro/osx-64 https://repo.continuum.io/pkgs/pro/noarch config file : /Users/chenxi/.condarc netrc file : None offline mode : False user-agent : conda/4.3.21 requests/2.14.2 CPython/2.7.12 Darwin/16.6.0 OSX/10.12.5 UID:GID : 501:20 

    暂时的解决方法是通过 proxychains 来做更新,但是感觉好恶心

    大家有没有类似的情况,是咋解决的?

    14 条回复    2017-06-09 10:04:20 +08:00
    lmqdlr
        1
    lmqdlr  
       2017-06-04 17:55:43 +08:00 via Android
    清华源
    yxcxx
        2
    yxcxx  
       2017-06-04 17:56:24 +08:00 via iPhone
    换清华源
    clarkchen
        3
    clarkchen  
    OP
       2017-06-04 18:25:14 +08:00
    @lmqdlr
    @yxcxx

    channle 里面有清华源啊,

    你们说的换源,是指这两行吗,

    ```
    conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
    conda config --set show_channel_urls yes
    ```
    hugo775128583
        4
    hugo775128583  
       2017-06-04 18:34:09 +08:00 via Android
    @clarkchen 记得把默认的源删了,不然还是回去请求的
    wentian
        5
    wentian  
       2017-06-04 19:35:14 +08:00 via Android
    对比 pip,有何优势?
    RangerWolf
        6
    RangerWolf  
       2017-06-05 11:30:56 +08:00
    没有这样用过, 直接下载一个完整的 anaconda 全部安装
    sniperhgy
        7
    sniperhgy  
       2017-06-05 16:39:46 +08:00
    conda create -name py3test python=3 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

    加上一个-c 参数,代表了 channel。
    billgreen1
        8
    billgreen1  
       2017-06-06 08:05:55 +08:00
    @wentian 都是编译好的,pip 有时候还得编译
    clarkchen
        9
    clarkchen  
    OP
       2017-06-06 23:31:57 +08:00
    @sniperhgy 我看这个是 additional channel,还是超时啊
    sniperhgy
        10
    sniperhgy  
       2017-06-07 10:11:13 +08:00   2
    @clarkchen 如果还是超时,就需要将自己原有默认的那些 channel 先删掉,还有那个 alias 也需要改成清华的源。
    conda config --show 用这个指令,可以看到当前所有的设定。
    conda config --set channel_alias https://conda.anaconda.org 这个指令用于设定 channel_alias 的内容,不要尝试删除
    conda config --add channels https://conda.anaconda.org 和 conda config --remove channels https://conda.anaconda.org 分别是添加和删除现有 channel 的指令,放心,随便删,以后再添加回来就好了。如果还不行,加我微信,754972247。(专治 anaconda 各种不服)
    wentian
        11
    wentian  
       2017-06-07 17:56:16 +08:00
    @sniperhgy
    conda 对比 pip 有啥优势?

    可能科学计算的的人比较感兴趣
    clarkchen
        12
    clarkchen  
    OP
       2017-06-09 00:15:37 +08:00
    @wentian 你给 ubuntu 装几个版本的 sklearn 你就懂了,,,
    clarkchen
        13
    clarkchen  
    OP
       2017-06-09 00:18:15 +08:00
    @sniperhgy 太牛逼了

    然后貌似现在官网换地址了,现在是可以直接搞了,但是你这个方法真的很灵

    补充一下

    先要调用一下 `conda config --show ` 来看看 channels 这个配置下面有啥

    我的是这样三个

    channels:
    - anaconda-fusion
    - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    - defaults

    除了第二行剩下的都是墙外发服务器
    然后分别执行

    `conda config --remove channels 'defaults'`
    `conda config --remove channels 'anaconda-fusion'`

    就好了,,速度飞快
    sniperhgy
        14
    sniperhgy  
       2017-06-09 10:04:20 +08:00
    @wentian 首先,conda 集成了用于科学计算的那几个大包,非常方便,要安装,用 conda install xxx 包,升级就是 conda update xxx 包,如果不想一个一个的来,直接 conda install --all,就全好了,而且里面不光有 python,还有 R,RStudio,而且最新的 tensorflow,skflow 等等,都可以一键安装。不用一个一个的下载依赖库。

    @clarkchen 搞定了哈,恭喜^_^
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5625 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 26ms UTC 06:40 PVG 14:40 LAX 23:40 JFK 02:40
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86