[英]Unable to install gensim in python
I have problem installing gensim module. 我在安装gensim模块时遇到问题。 I installed numpy and scipy dependent modules successfully but was getting error while installing gensim.
我成功安装了numpy和scipy依赖的模块,但是在安装gensim时出错。 I tried solutions given in Python pip install gives "Command "python setup.py egg_info" failed with error code 1" but none of them worked.
我尝试了Python pip install中给出的解决方案,该解决方案给出了“命令“ python setup.py egg_info”失败,错误代码为1“,但它们都不起作用 。
Here is the error: 这是错误:
>pip install --target="D:\python\packages" gensim
Collecting gensim
Using cached gensim-2.3.0-cp36-cp36m-win32.whl
Collecting scipy>=0.18.1 (from gensim)
Using cached scipy-0.19.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\abcde\AppData\Local\Temp\pip-build-hu8lzsjz\scipy\setup.py", line 416, in <module>
setup_package()
File "C:\Users\abcde\AppData\Local\Temp\pip-build-hu8lzsjz\scipy\setup.py", line 412, in setup_package
setup(**metadata)
File "c:\program files (x86)\python36-32\lib\distutils\core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\dist.py", line 315, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\dist.py", line 361, in fetch_build_eggs
replace_conflicting=True,
File "c:\program files (x86)\python36-32\lib\site-packages\pkg_resources\__init__.py", line 850, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "c:\program files (x86)\python36-32\lib\site-packages\pkg_resources\__init__.py", line 1122, in best_match
return self.obtain(req, installer)
File "c:\program files (x86)\python36-32\lib\site-packages\pkg_resources\__init__.py", line 1134, in obtain
return installer(requirement)
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\dist.py", line 429, in fetch_build_egg
return cmd.easy_install(req)
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\command\easy_install.py", line 653, in easy_install
not self.always_copy, self.local_index
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\package_index.py", line 636, in fetch_distribution
dist = find(requirement)
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\package_index.py", line 617, in find
dist.download_location = self.download(dist.location, tmpdir)
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\package_index.py", line 566, in download
found = self._download_url(scheme.group(1), spec, tmpdir)
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\package_index.py", line 805, in _download_url
return self._attempt_download(url, filename)
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\package_index.py", line 811, in _attempt_download
headers = self._download_to(url, filename)
File "c:\program files (x86)\python36-32\lib\site-packages\setuptools\package_index.py", line 726, in _download_to
block = fp.read(bs)
File "c:\program files (x86)\python36-32\lib\http\client.py", line 449, in read
n = self.readinto(b)
File "c:\program files (x86)\python36-32\lib\http\client.py", line 493, in readinto
n = self.fp.readinto(b)
File "c:\program files (x86)\python36-32\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "c:\program files (x86)\python36-32\lib\ssl.py", line 1002, in recv_into
return self.read(nbytes, buffer)
File "c:\program files (x86)\python36-32\lib\ssl.py", line 865, in read
return self._sslobj.read(len, buffer)
File "c:\program files (x86)\python36-32\lib\ssl.py", line 625, in read
v = self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\abcde\AppData\Local\Temp\pip-build-hu8lzsjz\scipy\
The error text you've supplied indicates the actual problem is (a) involving the attempt to install scipy
, on which gensim relies; 您提供的错误文本指示实际的问题是(a)涉及
scipy
安装scipy
的尝试; (b) related to a broken HTTPS connection, indicating a problem with network connectivity (or something blocking the secure-connection). (b)与HTTPS连接断开有关,表明网络连接存在问题(或某些阻止安全连接的问题)。
Also, it's rare to need to specify a --target
for pip
; 另外,很少需要为
pip
指定--target
; if your environment (reachable executables) is correctly set-up, you'd be able to just do pip install gensim
. 如果您的环境(可访问的可执行文件)设置正确,则只需执行
pip install gensim
。 (And if you are installing to a non-default location, you may have issues later when your active environment isn't using the libraries you expected.) (并且,如果要安装到非默认位置,则以后在活动环境未使用预期的库时可能会遇到问题。)
Suggestions: 意见建议:
pip
is using: https://pypi.python.org/pypi
pip
正在使用的PyPI存储库的主页: https://pypi.python.org/pypi
: https://pypi.python.org/pypi
pip install scipy
pip install scipy
conda
distribution tool, which tends to be well-optimized for Windows installations. conda
分发工具,该工具通常针对Windows安装进行了优化。 (I generally prefer the miniconda
variant, which installs only the minimum set of things you request.) miniconda
变体,该变体仅安装您要求的最少组件。) Also, while Python, gensim, and related packages can work on Windows systems, note that most development/testing on such Python/NLP/ML open-source happens on Linux/OSX systems. 同样,尽管Python,gensim和相关软件包可以在Windows系统上运行,但请注意,在此类Python / NLP / ML开源上进行的大多数开发/测试都在Linux / OSX系统上进行。 As a result, there are often extra installation/configuration issues on Windows, and then there's usually less prior-documented troubleshooting from people who've previously hit the same issues.
因此,Windows上通常会存在额外的安装/配置问题,因此,以前遇到过相同问题的人员通常不会提供事先记录的故障排除信息。 So if you have choice, such work often goes smoothest on Linux/Unix systems.
因此,如果您有选择的话,这种工作通常在Linux / Unix系统上最顺利。
You can install genism by two ways: 1. pip install -U genism 您可以通过两种方式安装genism:1. pip install -U genism
2.install easy_install then 2.安装easy_install然后
easy_install https://pypi.python.org/packages/source/s/setuptools/setuptools-19.2.tar.gz
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.