virtualenv装package记录
1.permission denied error
1.1 隔一天自己恢复
装python_speech_Features时候是这个情况… 后面装theano的时候就没那么方便了
1.2 只用user权限装
pip install Theano --user
2. Theano specific problems
2.1 卡在scipy的setup.py
查了一下是scipy版本问题,所以选择先更新scipy
# --user不要改成自己的username!!!
python -m pip install --upgrade --user scipy
2.2 setuptools有问题
具体记不清了,反正好像是可能和pip版本有关,于是更新了一下pip
2.3 pip不能用/importerror: cannot import name main
然鹅,更新pip以后导致了更严重的问题,就是pip不能用了
大致查了一下是因为virtualenv和系统的pip版本不相同(???)反正我也不是很清楚,stackoverflow也有各种解决办法
2.3.1 我自己成功的办法(换种办法call pip)
最后是改了call pip的办法 具体见这个答案
直接copy一下答案好了:
Even though the original question seems to be from 2015, this ‘bug’ seems to affect users installing pip-10.0.0 as well.
The workaround is not to modify pip, however to change the way pip is called. Instead of calling /usr/bin/pip call pip via Python itself. For example, instead of the below:
pip install <package>
If from Python version 2 (or default Python binary is called python) do :
python -m pip install <package>
or if from Python version 3:
python3 -m pip install <package>
2.3.1 stackoverflow上另外的办法
pip install --upgrade pip -i https://pypi.python.org/simple
来源:https://stackoverflow.com/questions/24101300/pip-could-not-find-any-downloads-that-satisfy-the-requirement-sqlalchemy
别的相关 https://github.com/pypa/pip/issues/5447
2.4 Import theano时cpickle不存在
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/b2jiang/.local/lib/python2.7/site-packages/theano/__init__.py", line 99, in <module>
from theano.gof import (
File "/home/b2jiang/.local/lib/python2.7/site-packages/theano/gof/__init__.py", line 40, in <module>
from theano.gof.cc import \
File "/home/b2jiang/.local/lib/python2.7/site-packages/theano/gof/cc.py", line 25, in <module>
from theano.gof import link
File "/home/b2jiang/.local/lib/python2.7/site-packages/theano/gof/link.py", line 18, in <module>
from theano.gof.type import Type
File "/home/b2jiang/.local/lib/python2.7/site-packages/theano/gof/type.py", line 23, in <module>
from theano.gof.op import CLinkerObject, Op
File "/home/b2jiang/.local/lib/python2.7/site-packages/theano/gof/op.py", line 25, in <module>
from theano.gof.cmodule import GCC_compiler
File "/home/b2jiang/.local/lib/python2.7/site-packages/theano/gof/cmodule.py", line 9, in <module>
import six.moves.cPickle as pickle
ImportError: No module named cPickle
解决办法是update six,但是直接update没有用,进入python module以后查看six的version显示的还是老版本:
>>> python -m pip show six
Name: six
Version: 1.4.1
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: UNKNOWN
Location: /gs/software/CentOS-6/tools/python-2.7.3/lib/python2.7/site-packages/six-1.4.1-py2.7.egg
Requires:
Required-by: python-dateutil, pytools, Theano
```python
>>> import six
>>> print six.__version__
1.4.1
>>> print six.__file__
/software/CentOS-6/tools/python-2.7.3/lib/python2.7/site-packages/six-1.4.1-py2.7.egg/six.pyc
如果直接升级, 再进入python查看时,依然是老版本,具体原因好像是两个版本共存的情况下,有一个版本会先被call,而老版本存在的位置是先被call的。
python -m pip install --upgrade six --user
所以解决办法有两个,1)uninstall重装;2)把新版本装在先被call的位置
1)在服务器的virtualenv不行,permission denied,也没有–user版本的uninstall,于是采取第二种
2)多亏了这个答案:https://stackoverflow.com/questions/29485741/unable-to-upgrade-python-six-package-in-mac-osx-10-10-2
直接贴一下答案:
I resolved the problem by the following method.
Download the six-1.10.0.tar.gz package Use this command to install it.
python setup.py install
This works because it installs the new version of six to
/Library/Python/2.7/site-packages/ which is searched before
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/
2.5 Import Lasagne error: downsample/others
具体问题是:ImportError: cannot import name downsample
但也有可能是别的package,之前每次尝试import都是不同的package出问题
原因:最新版本的theano和0.1版本的lasagne不兼容(而lasagne0.1是网站推荐的版本),解决办法是卸载重装最新版本lasagne(dev),来自https://github.com/aigamedev/scikit-neuralnetwork/issues/235
3. 零碎的问题(只是为了存几个答案)
3.1 --user不能用
这个后来通过上面换方法call pip解决了,所以没再管,但是stackoverflow上有如下相关:
https://stackoverflow.com/questions/52541033/cannot-install-anything-via-pip-to-virtual-environment
(懒得check了,可能是这个问题相关也可能不是)