使用conda更新包时出错

时间:2016-11-29 23:12:41

标签: python ubuntu amazon-ec2 conda

我在AWS EC2上使用ubuntu作为AMI启动了一个实例。

然后我运行了一个脚本来安装jupyter笔记本,并能够使用IP地址和特定端口访问它。 我写的代码就是这个:

sudo apt-get install git

git clone https://gist.github.com/rashmibanthia/5a1e4d7e313d6832f2ff nb

. nb/jupyter_notebook_ec2.sh 

cd;mkdir notebook;cd notebook

tmux new -s nb

jupyter notebook --certfile=~/certs/mycert.pem --keyfile ~/certs/mycert.key

现在我在笔记本上。这是我的问题。当我尝试导入一些包和类时,我收到一个错误。例如,这一行:

from sklearn.gaussian_process import GaussianProcessRegressor

我明白了:

  

ImportError Traceback(最近一次调用   最后)in()   ----> 1来自sklearn.gaussian_process import GaussianProcessRegressor

     

ImportError:无法导入名称'GaussianProcessRegressor'

所以我尝试使用带有conda update scikit-learn的conda更新scikit学习包但是我有另一个错误:

  

获取包元数据...发生了意外错误。请   考虑将以下信息发布到conda GitHub问题   跟踪器:

https://github.com/conda/conda/issues

目前的conda安装:

           platform : linux-64
      conda version : 4.2.13
   conda is private : False
  conda-env version : 4.2.13
conda-build version : 1.18.2
     python version : 3.5.2.final.0
   requests version : 2.12.1
   root environment : /home/ubuntu/anaconda3  (writable)
default environment : /home/ubuntu/anaconda3
   envs directories : /home/ubuntu/anaconda3/envs
      package cache : /home/ubuntu/anaconda3/pkgs
       channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                      https://repo.continuum.io/pkgs/free/noarch
                      https://repo.continuum.io/pkgs/pro/linux-64
                      https://repo.continuum.io/pkgs/pro/noarch
        config file : None
       offline mode : False
$ /home/ubuntu/anaconda3/bin/conda update scikit-learn

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/exceptions.py", line 479, in conda_exception_handler
    return_value = func(*args, **kwargs)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/cli/main.py", line 145, in _main
    exit_code = args.func(args, p)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/cli/main_update.py", line 65, in execute
    install(args, parser, 'update')
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 238, in install
    prefix=prefix)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/api.py", line 24, in get_index
    index = fetch_index(channel_urls, use_cache=use_cache, unknown=unknown)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 300, in fetch_index
    repodatas = [(u, f.result()) for u, f in zip(urls, futures)]
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 300, in <listcomp>
    repodatas = [(u, f.result()) for u, f in zip(urls, futures)]
  File "/home/ubuntu/anaconda3/lib/python3.5/concurrent/futures/_base.py", line 405, in result
    return self.__get_result()
  File "/home/ubuntu/anaconda3/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
    raise self._exception
  File "/home/ubuntu/anaconda3/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 75, in func
    res = f(*args, **kwargs)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/fetch.py", line 117, in fetch_repodata
    timeout=(6.1, 60))
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 350, in _make_request
    self._validate_conn(conn)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 835, in _validate_conn
    conn.connect()
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 330, in connect
    cert = self.sock.getpeercert()
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 324, in getpeercert
    'subjectAltName': get_subj_alt_name(x509)
  File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 171, in get_subj_alt_name
    ext = cert.extensions.get_extension_for_class(
AttributeError: 'Extensions' object has no attribute 'get_extension_for_class'

1 个答案:

答案 0 :(得分:1)

正如kalefranz在这里评论&#39; https://github.com/conda/conda/issues/3898&#39;可能是因为pyopenssl和密码学不同步,这应该解决它:

CONDA_SSL_VERIFY = false conda update pyopenssl

在用于设置ssl_verify的窗口中,可以使用以下命令:

conda config --set ssl_verify False

正如在Problems with updating anaconda and installing new packages

中所说的那样