Python module installation error - python

I tried to install a module named tushare, I have tried 3 methods: pip, easy_install and setup.py install, they all have the same error:
ImportError: No module named lxml.html
pip:
C:\WINDOWS\system32>pip install tushare
Collecting tushare
Using cached tushare-0.6.8.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\endeav~1\appdata\local\temp\pip-build-pkbgde\tushare\setup.py", line 4, in <module>
import tushare
File "tushare\__init__.py", line 6, in <module>
from tushare.stock.trading import (get_hist_data, get_tick_data,
File "tushare\stock\trading.py", line 13, in <module>
import lxml.html
ImportError: No module named lxml.html
easy_install:
C:\WINDOWS\system32>easy_install tushare
Searching for tushare
Reading https://pypi.python.org/simple/tushare/
Downloading https://pypi.python.org/packages/0a/ca/ad9eeed1c285c58d115a0dd82734e5375abf1b6e510c7c24f2f8de921c75/tushare-0.6.8.tar.gz#md5=7626d97088d93d99c1a6ece80302d617
Best match: tushare 0.6.8
Processing tushare-0.6.8.tar.gz
Writing c:\users\endeav~1\appdata\local\temp\easy_install-iisas7\tushare-0.6.8\setup.cfg
Running tushare-0.6.8\setup.py -q bdist_egg --dist-dir c:\users\endeav~1\appdata\local\temp\easy_install-iisas7\tushare-0.6.8\egg-dist-tmp-dakavz
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
.......
File "c:\users\endeav~1\appdata\local\temp\easy_install-iisas7\tushare-0.6.8\tushare\stock\trading.py", line 13, in <module>
ImportError: No module named lxml.html
setup.py install
C:\WINDOWS\system32>cd C:\Users\Endeavour\Desktop\tushare-0.6.8
C:\Users\Endeavour\Desktop\tushare-0.6.8>setup.py install
Traceback (most recent call last):
File "C:\Users\Endeavour\Desktop\tushare-0.6.8\setup.py", line 4, in <module>
import tushare
File "C:\Users\Endeavour\Desktop\tushare-0.6.8\tushare\__init__.py", line 6, in <module>
from tushare.stock.trading import (get_hist_data, get_tick_data,
File "C:\Users\Endeavour\Desktop\tushare-0.6.8\tushare\stock\trading.py", line 13, in <module>
import lxml.html
ModuleNotFoundError: No module named 'lxml'
I have installed python 2.7 and 3.0 on Windows 10, worked on IDLE, no IDE, how can I fix it?
Then I installed lxml:
C:\WINDOWS\system32>pip install lxml
error:
** make sure the development packages of libxml2 and libxslt are installed **
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
I could not use pip to install libxml2 and libxslt.
C:\WINDOWS\system32>pip install libxml2
Collecting libxml2
Could not find a version that satisfies the requirement libxml2 (from versions: )
No matching distribution found for libxml2
C:\WINDOWS\system32>pip install libxslt
Collecting libxslt
Could not find a version that satisfies the requirement libxslt (from versions: )
No matching distribution found for libxslt
What could I do next?

Have you tried installing lxml? It seems that all the tracebacks point to not having a module called lxml. Try typing into your terminal prompt: pip install lxml. lxml installs perfectly for me.
EDIT:
Looks like libxml2 is not available in pip. I found another stackoverflow question. It seems like they are having the same problems you are. The best part is: if you follow the prebuilt binaries link (which I have conveniently linked here for you), there are downloads for lxml with libxml2 and libsxlt bundled in!

Related

pip install asteval fails on six dependency

If I create a clean virtualenv, upgrade my pip version to 9.0.1 (most recent), and try:
$ pip install asteval
Collecting asteval
Downloading asteval-0.9.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-nnWnaR/asteval/setup.py", line 3, in <module>
import asteval
File "asteval/__init__.py", line 20, in <module>
from .asteval import Interpreter
File "asteval/asteval.py", line 18, in <module>
import six
ImportError: No module named six
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-nnWnaR/asteval/
Maybe I'm missing something, I thought pip should handle the dependencies? I thought it used to.
The bypass is to separately pip install six, then asteval will install. But I want to require asteval as an import requirement in my code, and I don't want to have to trace dependencies it might have and list those as requirements.
asteval is making a common mistake: importing itself into its setup.py. You should file a bug against the project, asking them to stop doing that.

When I do pip --version it show the error as ImportError: No module named pyparsing

I tried installing/uninstalling pyparsing as well and it does not work. I am stuck with this and I have to install additional libraries as well.
Here is the error message:
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/home/rachana/.local/lib/python2.7/site-packages/pkg_resour‌​ces/__init__.py", line 72, in <module>
import packaging.requirements
File "/home/rachana/.local/lib/python2.7/site-packages/packaging/‌​requirements.py", line 9, in <module>
from pyparsing import stringStart, stringEnd, originalTextFor, ParseException
ImportError: No module named pyparsing
How can I fix this?
I'm had the same problem and resolved it.
Here is you can see that pip not working properly (without any additional parameters).
root#notebook:/home/ci# pip
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 9, in <module>
from pyparsing import stringStart, stringEnd, originalTextFor, ParseException
Okay, so first that we may do is installing broken dependency:
wget https://pypi.python.org/packages/3c/ec/a94f8cf7274ea60b5413df054f82a8980523efd712ec55a59e7c3357cf7c/pyparsing-2.2.0.tar.gz
gunzip pyparsing-2.2.0.tar.gz
tar -xvf pyparsing-2.2.0.tar
cd pyparsing-2.2.0 && python setup.py install
After it mising dependency will be installed from sources.
Trying to using pip one more time:
root#rundeck.euovh01.un.private:/tmp/pyparsing-2.2.0# pip
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 74, in <module>
import appdirs
ImportError: No module named appdirs
This is the next problem. And you can fix it more quickly:
root#notebook:/home/ci# python -m pip install appdirs
Downloading/unpacking appdirs
Downloading appdirs-1.4.3-py2.py3-none-any.whl
Installing collected packages: appdirs
Successfully installed appdirs
Cleaning up...
After that my pip was successfully repaired.
Kind regards.
Similar to #Oleg Mykolaichenko answer, but using pip:
[sudo] pip install pyparsing
[sudo] pip install appdirs
ah! I was stuck with for an hour and found this out
pip3 install pyparsing

Failed to load straight.plugin in Python 2.7

I am trying to run a python script which is seems to be dependent on a module called straight.plugin, which it fails to recognise.
(antismash)[username#glenn antismash]$ python run_antismash.py
Traceback (most recent call last):
File "run_antismash.py", line 32, in <module>
import straight.plugin
File "/c3se/users/username/Glenn/virtualenvs/antismash/lib/python2.7/site-packages/straight/plugin/__init__.py", line 1, in <module>
from straight.plugin import loaders
File "/c3se/users/username/Glenn/virtualenvs/antismash/lib/python2.7/site-packages/straight/plugin/loaders.py", line 9, in <module>
from straight.plugin.manager import PluginManager
ImportError: No module named manager
When I try to install straight.plugin python tells me that it is already installed.
(antismash)[username#glenn antismash]$ pip instal
l straight.plugin
Requirement already satisfied (use --upgrade to upgrade): straight.plugin in /c3se/users/username/Glenn/virtualenvs/antismash/lib/python2.7/site-packages
Cleaning up...
Can somebody help me on what to do to run this python script?
I am running Python 2.7.6 on Linux distribution CentOS 6.6
Looks like the manager module isnt in the PyPI Package and is a known issue https://github.com/ironfroggy/straight.plugin/issues/17
Installing this version:
pip install straight.plugin==1.4.0-post-1
solves the problem for me:
In [1]: from straight.plugin.manager import PluginManager
In [2]:

python-daemon 2.0.5 won't install with pip

I am getting errors when trying to install python-daemon 2.0.5 with pip & python 2.6. I know there are other questions that refer to python-daemon 2.0.3 having this problem. But those answers indicate it should be fixed now.
I've tried installing older versions as well without luck. Although if I start over with a fresh virtualenv I am able to install 1.5.6 . However in this virtualenv I get the same error with 2.0.5 and 1.5.6
(py26)[brianb#api proj]$ pip install python-daemon
Downloading/unpacking python-daemon
Downloading python-daemon-2.0.5.tar.gz (71Kb): 71Kb downloaded
Running setup.py egg_info for package python-daemon
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/brianb/py26/build/python-daemon/setup.py", line 26, in <module>
import version
File "version.py", line 438
for item in versions}
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/brianb/py26/build/python-daemon/setup.py", line 26, in <module>
import version
File "version.py", line 438
for item in versions}
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/brianb/.pip/pip.log
This is strange! I tried to upgrade virtualenv too, but this did not work out.
To get it running, I had to upgrade to Python 2.7.

Having trouble installing buildslave on Windows 7

I finally got pip install buildbot-slave to work on Win7 (thanks to another answer on this site), and now when I attempt to create a build slave via:
buildslave create-slave slavefolder blah.blah.com:9989 buildslave password
It kicks back the following error:
Traceback (most recent call last):
File "C:\Python27\Scripts\buildslave", line 3, in <module>
from buildslave.scripts import runner
File "C:\Python27\lib\site-packages\buildslave\scripts\runner.py", line 22, in <module>
from twisted.python import reflect
File "C:\Python27\lib\site-packages\twisted\__init__.py", line 53, in <module>
_checkRequirements()
File "C:\Python27\lib\site-packages\twisted\__init__.py", line 37, in _checkRequirements
raise ImportError(required + ": no module named zope.interface.")
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zope.interface.
I've got it all installed here is my pip freeze:
Twisted==14.0.0
argparse==1.2.1
buildbot-slave==0.8.9
stevedore==0.15
virtualenv==1.9.1
virtualenv-clone==0.2.5
virtualenvwrapper==4.3.1
virtualenvwrapper-win==1.1.5
zope.interface==4.1.1
Any recommendations would be greatly appreciated.
Try to uninstall zope.interface and reinstall the version 3.6.0 using the command
pip uninstall zope.interface
pip install zope.interface==3.6.0
Hope this helps.

Categories

Resources