Anaconda无法更新Python包

时间:2017-06-12 14:58:38

标签: python anaconda

我的python程序无法运行,我被告知可能是因为旧版本的hyperopt:

Traceback (most recent call last):
  File "hyperas_my_data.py", line 74, in <module>
    ...
  File "/mnt/data/user/pkgs/anaconda2/lib/python2.7/site-packages/hyperopt-0.0.4-py2.7.egg/hyperopt/fmin.py", line 306, in fmin
  File "/mnt/data/user/pkgs/anaconda2/lib/python2.7/site-packages/hyperopt-0.0.4-py2.7.egg/hyperopt/base.py", line 633, in fmin
TypeError: 'module' object is not callable

我的Python程序使用的hyperopt版本是0.0.4;但是,根据anaconda的说法,安装的版本实际上是0.0.3.dev:

user@GPU6:~/dir$ python
Python 2.7.12 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import hyperopt
>>> hyperopt.__version__
'0.0.3.dev' 

我尝试更新hyperopt,但输出表示hyperopt已经安装并且是最新的。我发现hyperopt实际上是0.1版本,所以我想我会尝试专门安装它:

user@GPU6:~/dir$ conda install hyperopt=0.1
Fetching package metadata .........

PackageNotFoundError: Package missing in current linux-64 channels: 
  - hyperopt 0.1*

我在screen内工作,可以使用Anaconda。 如何更新hyperopt?

更新

我找到了[这些说明] [1]并试了一下:

user@GPU6:~/dir$ conda install -c jaikumarm hyperopt=0.1
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /mnt/data/user/pkgs/anaconda2:

The following NEW packages will be INSTALLED:

    future:   0.16.0-py27_1        

The following packages will be UPDATED:

    hyperopt: 0.0.4-py27_0  creditx --> 0.1-0 jaikumarm

Proceed ([y]/n)? y

user@GPU6:~/dir$ python
Python 2.7.12 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import hyperopt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named hyperopt
>>> exit()

所以现在我甚至没有旧版本的炒作。关于如何安装0.1版的任何想法?

更新2

我使用conda remove hyperopt卸载了hyperopt并重新运行conda install -c jaikumarm hyperopt=0.1。我仍然无法导入hyperopt,但它列在我已安装的软件包中:

`user@GPU6:~/dir$ conda list
# packages in environment at /mnt/data/user/pkgs/anaconda2:
...
heapdict                  1.0.0                    py27_1
hyperopt                  0.1                           0    jaikumarm
idna                      2.1                      py27_0
...

更新3:在回复评论时,这是我的PYTHONPATH和我的操作系统。

OS:Ubuntu 14.04.4 LTS(GNU / Linux 3.13.0-111-generic x86_64)

user@GPU6:~$ which python
/mnt/data/user/pkgs/anaconda2/bin/python

user@GPU6:~$ python -c "import sys; print '\n'.join(sys.path)"

/export/mlrg/user
/mnt/data/user/pkgs/anaconda2/lib/python27.zip
/mnt/data/user/pkgs/anaconda2/lib/python2.7
/mnt/data/user/pkgs/anaconda2/lib/python2.7/plat-linux2
/mnt/data/user/pkgs/anaconda2/lib/python2.7/lib-tk
/mnt/data/user/pkgs/anaconda2/lib/python2.7/lib-old
/mnt/data/user/pkgs/anaconda2/lib/python2.7/lib-dynload
/mnt/data/user/pkgs/anaconda2/lib/python2.7/site-packages
/mnt/data/user/pkgs/anaconda2/lib/python2.7/site-packages/Sphinx-1.4.1-py2.7.egg
/mnt/data/user/pkgs/anaconda2/lib/python2.7/site-packages/setuptools-23.0.0-py2.7.egg

更新3

有趣的是,当我在screen之外时,我可以使用hyperopt版本0.1,我在那里安装了不同的Python,即使我在screen内部时只安装了它。例如:

user@GPU6:~/dir$ which python
/mnt/data/user/pkgs/enthought/canopy-1.5.1/bin/python
user@GPU6:~/dir$ python
Enthought Canopy Python 2.7.6 | 64-bit | (default, Sep 15 2014, 17:36:10) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hyperopt
>>> hyperopt.__version__
'0.1'

但我需要使用Anaconda版本。一旦我进入屏幕会话,我正在使用Anaconda,我需要使用hyperopt版本0.1。如何让Anaconda识别出已经安装了hyperopt?与我的$ PYTHONPATH有关吗?

  [1]: https://anaconda.org/jaikumarm/hyperopt

0 个答案:

没有答案