I use pip install scrapy to install scrapy
But I run scrapy get below error:
➜ source scrapy
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 7, in <module>
from scrapy.cmdline import execute
File "/Library/Python/2.7/site-packages/scrapy/__init__.py", line 48, in <module>
from scrapy.spiders import Spider
File "/Library/Python/2.7/site-packages/scrapy/spiders/__init__.py", line 10, in <module>
from scrapy.http import Request
File "/Library/Python/2.7/site-packages/scrapy/http/__init__.py", line 11, in <module>
from scrapy.http.request.form import FormRequest
File "/Library/Python/2.7/site-packages/scrapy/http/request/form.py", line 9, in <module>
import lxml.html
File "/Library/Python/2.7/site-packages/lxml/html/__init__.py", line 42, in <module>
from lxml import etree
ImportError: dlopen(/Library/Python/2.7/site-packages/lxml/etree.so, 2): Library not loaded: /opt/local/lib/libxslt.1.dylib
Referenced from: /Library/Python/2.7/site-packages/lxml/etree.so
Reason: image not found
It's strange scrapy look for libxslt.1.dylib in my /opt/ floder...
And I run pip install scrapy, get this:
➜ ~ pip install scrapy
Requirement already satisfied (use --upgrade to upgrade): scrapy in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): queuelib in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): w3lib>=1.8.0 in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): lxml in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): Twisted>=10.0.0 in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): service-identity in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): cryptography>=0.7 in /Library/Python/2.7/site-packages (from pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): zope.interface>=3.6.0 in /Library/Python/2.7/site-packages (from Twisted>=10.0.0->scrapy)
Requirement already satisfied (use --upgrade to upgrade): characteristic>=14.0.0 in /Library/Python/2.7/site-packages (from service-identity->scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules in /Library/Python/2.7/site-packages (from service-identity->scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyasn1 in /Library/Python/2.7/site-packages (from service-identity->scrapy)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/site-packages (from cryptography>=0.7->pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /Library/Python/2.7/site-packages (from cryptography>=0.7->pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in /Library/Python/2.7/site-packages (from cryptography>=0.7->pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /Library/Python/2.7/site-packages (from cryptography>=0.7->pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.1.0 in /Library/Python/2.7/site-packages (from cryptography>=0.7->pyOpenSSL->scrapy)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /Library/Python/2.7/site-packages (from cffi>=1.1.0->cryptography>=0.7->pyOpenSSL->scrapy)
Help!!
Update in 2015/11/06
Hi, Joe Young.
I have try this brew install libxml2 libxslt.But it doesn't work, It seems like my python's look path is wrong?
➜ haimi git:(V3.2.0) brew install libxml2 libxslt
Warning: libxml2-2.9.2 already installed
Warning: libxslt-1.1.28_1 already installed
➜ haimi git:(V3.2.0) ✗ scrapy
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 7, in <module>
from scrapy.cmdline import execute
File "/Library/Python/2.7/site-packages/scrapy/__init__.py", line 48, in <module>
from scrapy.spiders import Spider
File "/Library/Python/2.7/site-packages/scrapy/spiders/__init__.py", line 10, in <module>
from scrapy.http import Request
File "/Library/Python/2.7/site-packages/scrapy/http/__init__.py", line 11, in <module>
from scrapy.http.request.form import FormRequest
File "/Library/Python/2.7/site-packages/scrapy/http/request/form.py", line 9, in <module>
import lxml.html
File "/Library/Python/2.7/site-packages/lxml/html/__init__.py", line 42, in <module>
from lxml import etree
ImportError: dlopen(/Library/Python/2.7/site-packages/lxml/etree.so, 2): Library not loaded: /opt/local/lib/libxslt.1.dylib
Referenced from: /Library/Python/2.7/site-packages/lxml/etree.so
Reason: image not found
➜ haimi git:(V3.2.0) ✗
It sounds like you need the libxslt and libxml libraries which are required by the lxml python package, which is required by scrapy.
If you install the "X-code Command Line Tool package", it should include these libraries for you. There's a guide here: http://quantgreeks.com/how-to-install-xcode-command-line-tools-in-osx-yosemite/
Essentially it boils down to running:
xcode-select --install
Related
System: OX E
Python source: python.org
I used pip to install matplotlib and here is the result I got
sudo pip install matplotlib
The directory '/Users/clarence/Library/Caches/pip/http' or its parent
directory is not owned by the current user and the cache has been
disabled. Please check the permissions and owner of that directory. If
executing pip with sudo, you may want sudo's -H flag. The directory
'/Users/clarence/Library/Caches/pip' or its parent directory is not
owned by the current user and caching wheels has been disabled. check
the permissions and owner of that directory. If executing pip with
sudo, you may want sudo's -H flag. Requirement already satisfied (use
--upgrade to upgrade): matplotlib in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.5
in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
(from matplotlib) Requirement already satisfied (use --upgrade to
upgrade): python-dateutil in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
(from matplotlib) Requirement already satisfied (use --upgrade to
upgrade): tornado in /Library/Python/2.7/site-packages (from
matplotlib) Requirement already satisfied (use --upgrade to upgrade):
pyparsing>=1.5.6 in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
(from matplotlib) Requirement already satisfied (use --upgrade to
upgrade): nose in /Library/Python/2.7/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): certifi in
/Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade):
backports-abc>=0.4 in /Library/Python/2.7/site-packages (from
tornado->matplotlib) Requirement already satisfied (use --upgrade to
upgrade): backports.ssl-match-hostname in
/Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade):
singledispatch in /Library/Python/2.7/site-packages (from
tornado->matplotlib) Requirement already satisfied (use --upgrade to
upgrade): six in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
(from singledispatch->tornado->matplotlib) Clarences-MacBook-Pro:~
clarence$ sudo -H pip install matplotlib Requirement already
satisfied (use --upgrade to upgrade): matplotlib in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.5
in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
(from matplotlib) Requirement already satisfied (use --upgrade to
upgrade): python-dateutil in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
(from matplotlib) Requirement already satisfied (use --upgrade to
upgrade): tornado in /Library/Python/2.7/site-packages (from
matplotlib) Requirement already satisfied (use --upgrade to upgrade):
pyparsing>=1.5.6 in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
(from matplotlib) Requirement already satisfied (use --upgrade to
upgrade): nose in /Library/Python/2.7/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): certifi in
/Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade):
backports-abc>=0.4 in /Library/Python/2.7/site-packages (from
tornado->matplotlib) Requirement already satisfied (use --upgrade to
upgrade): backports.ssl-match-hostname in
/Library/Python/2.7/site-packages (from tornado->matplotlib)
Requirement already satisfied (use --upgrade to upgrade):
singledispatch in /Library/Python/2.7/site-packages (from
tornado->matplotlib) Requirement already satisfied (use --upgrade to
upgrade): six in
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
(from singledispatch->tornado->matplotlib)
When I go ahead the import that library in python. python says it could not find the modulus.
python3.5 -c 'import matplotlib; print(matplotlib.__version__, matplotlib.__file__)'
Traceback (most recent call last): File "", line 1, in
ImportError: No module named 'matplotlib'
How can I fix this?
You need to install those libraries for the same version of python that you are using later to execute your code.
So if you want to use Python 2.7 you have to call
sudo pip2 install matplotlib
When using python 3.5 use it in a similar way
sudo pip3 install matplotlib
I installed an application with python's "pip":
sudo pip install EasyBlogger
Installation finished without errors:
Collecting EasyBlogger
Using cached EasyBlogger-0.9.0.zip
Requirement already satisfied (use --upgrade to upgrade): pypandoc in /usr/lib/python3.5/site-packages (from EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): google-api-python-client in /usr/lib/python3.5/site-packages (from EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): python-gflags in /usr/lib/python3.5/site-packages (from EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): httplib2 in /usr/lib/python3.5/site-packages (from EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python3.5/site-packages (from pypandoc->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): oauth2client>=1.4.6 in /usr/lib/python3.5/site-packages (from google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): six>=1.6.1 in /usr/lib/python3.5/site-packages (from google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): uritemplate>=0.6 in /usr/lib/python3.5/site-packages (from google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /usr/lib/python3.5/site-packages (from oauth2client>=1.4.6->google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules>=0.0.5 in /usr/lib/python3.5/site-packages (from oauth2client>=1.4.6->google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): rsa>=3.1.4 in /usr/lib/python3.5/site-packages (from oauth2client>=1.4.6->google-api-python-client->EasyBlogger)
Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.5.0 in /usr/lib/python3.5/site-packages (from uritemplate>=0.6->google-api-python-client->EasyBlogger)
Installing collected packages: EasyBlogger
Running setup.py install for EasyBlogger
Successfully installed EasyBlogger-0.9.0
However when I try to run the scipt the following way:
sudo easyblogger --blogid 6852822618950333369 get
I get only error messages:
Traceback (most recent call last):
File "/usr/bin/easyblogger", line 9, in <module>
load_entry_point('EasyBlogger==0.9.0', 'console_scripts', 'easyblogger')()
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 568, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
return ep.load()
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2380, in load
return self.resolve()
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2386, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3.5/site-packages/blogger/__init__.py", line 1, in <module>
from blogger import EasyBlogger, main
ImportError: cannot import name 'EasyBlogger'
The content of /usr/bin/easyblogger is the following:
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'EasyBlogger==0.9.0','console_scripts','easyblogger'
__requires__ = 'EasyBlogger==0.9.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('EasyBlogger==0.9.0', 'console_scripts', 'easyblogger')()
)
The error comes from the 9. line load_entry_point. What can I do to make the easyblogger script working? Anyway I am using Arch Linux.
I see you're using Python 3. It appears easyblogger is not compatible, even though it installs using pip3.
To see this, correct __init__.py by adding a period since your are importing from the current folder (new in python 3):
from .blogger import EasyBlogger, main
Now if you run your command, you get the following:
File "/usr/local/lib/python3.4/dist-packages/blogger/blogger.py", line 424
print postId
^
SyntaxError: Missing parentheses in call to 'print'
Now you need to decide whether to fix the package or not! Just to make sure, installing in Python 3:
sudo apt-get -y install python3-setuptools
sudo easy_install3 pip
sudo pip3 install EasyBlogger
I'm trying to set setup Python-Eve.
Python-Eve Installation Guide
I've finished these steps:
C:\Users\Ari\Desktop\rizzla>python -m pip install eve
Requirement already satisfied (use --upgrade to upgrade): eve in c:\python34\lib
\site-packages
Requirement already satisfied (use --upgrade to upgrade): cerberus<0.9,>=0.8 in
c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): events<0.3,>=0.2.1 in
c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): simplejson<4.0,>=3.3.0
in c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): werkzeug<0.10,>=0.9.4
in c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): markupsafe<1.0,>=0.23
in c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): jinja2<3.0,>=2.7.2 in
c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): itsdangerous<1.0,>=0.2
2 in c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): flask<0.11,>=0.10.1 in
c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): pymongo<3.0,>=2.7.1 in
c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): flask- pymongo<0.4,>=0.
3.0 in c:\python34\lib\site-packages (from eve)
But when trying to run the code on Quick Start Guide I get
Traceback (most recent call last):
File "run.py", line 1, in <module>
from eve import Eve
File "C:\Users\Ari\Desktop\rizzla\eve.py", line 1, in <module>
from eve import Eve
ImportError: cannot import name 'Eve'
My code is here:
from eve import Eve
app = Eve()
if __name__ == '__main__':
app.run()
Your script name is eve; same as the module you want to import. Rename your script name to other name to prevent the conflict.
Remove eve.pyc in the directory if there is.
The following are output of trace when I have tried to install ldap with pip.
[root#reports-hammer-local tests]# pip install simpleldap
Requirement already satisfied (use --upgrade to upgrade): simpleldap in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): python-ldap in /usr/local/lib/python2.7/site-packages (from simpleldap)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/site-packages/setuptools-1.4.2-py2.7.egg (from python-ldap->simpleldap)
Cleaning up...
[root#reports-hammer-local tests]# python tests.py
Traceback (most recent call last):
File "tests.py", line 7, in `
import simpleldap`
ImportError: No module named simpleldap
I can't run the test because of missing module issues. can you please hep me to fix this.
I an now setting up a work environment on some open source project I just cloned from GitHub,
after running
pip install -U -r requirements.txt
in a virtualenv of course, I was trying to run fab sanity as this projects uses fabric, and I am getting the following error:
(openmuni)oleg#oleg-Lenovo-G580:~/dev/openmuni-budgets$ fab sanity
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/fabric/main.py", line 637, in main
docstring, callables, default = load_fabfile(fabfile)
File "/usr/lib/python2.7/dist-packages/fabric/main.py", line 164, in load_fabfile
imported = importer(os.path.splitext(fabfile)[0])
File "/home/oleg/dev/openmuni-budgets/fabfile/__init__.py", line 1, in <module>
from quilt import *
ImportError: No module named quilt
The most trivial 2 solutions didn't work unfortunately:
(openmuni)oleg#oleg-Lenovo-G580:~/dev/openmuni-budgets$ pip install quilt
Requirement already satisfied (use --upgrade to upgrade): quilt in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): Fabric>=1.8.0 in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from quilt)
Requirement already satisfied (use --upgrade to upgrade): cuisine>=0.6.5 in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from quilt)
Requirement already satisfied (use --upgrade to upgrade): paramiko>=1.10.0 in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from Fabric>=1.8.0->quilt)
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.1,!=2.4 in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from paramiko>=1.10.0->Fabric>=1.8.0->quilt)
Requirement already satisfied (use --upgrade to upgrade): ecdsa in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from paramiko>=1.10.0->Fabric>=1.8.0->quilt)
Cleaning up...
(openmuni)oleg#oleg-Lenovo-G580:~/dev/openmuni-budgets$ pip install python-quilt
Requirement already satisfied (use --upgrade to upgrade): python-quilt in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages
Cleaning up...
Running:
deavtivate
and then
pip install python-quilt solved it, but that means that quilt is now global and installed outside of the virtualenv, a bit of a hack.