beautifulSoup 4 works on python2.6? - beautifulsoup

I'm trying to do a web scraping project using bs4, but on the remote server they have python 2.6.6 installed.
Can I work with bs4 on python2.6.6?
I already tried but got these errors:
Traceback (most recent call last):
File "/home/infoforense/public_html/citius-scraping.py", line 16, in <module>
from bs4 import BeautifulSoup
File "/usr/lib/python2.6/site-packages/bs4/__init__.py", line 34, in <module>
from .builder import builder_registry, ParserRejectedMarkup
File "/usr/lib/python2.6/site-packages/bs4/builder/__init__.py", line 7, in <module>
from bs4.element import (
File "/usr/lib/python2.6/site-packages/bs4/element.py", line 12, in <module>
import soupsieve
File "/usr/lib/python2.6/site-packages/soupsieve/__init__.py", line 29, in <module>
from .__meta__ import __version__, __version_info__ # noqa: F401
File "/usr/lib/python2.6/site-packages/soupsieve/__meta__.py", line 190, in <module>
__version__ = __version_info__._get_canonical()
File "/usr/lib/python2.6/site-packages/soupsieve/__meta__.py", line 146, in _get_canonical
ver = "{}.{}.{}".format(self.major, self.minor, self.micro)
ValueError: zero length field name in format

I am the author of the failing dependency soupsieve, and can verify that soupsieve does not support Python 2.6.
It is possible that that an earlier version of Beautiful Soup (before 4.7) does fully support Python 2.6, but I'm not sure.
Python 2.6 is such an old version that even the Python team has stopped supporting it.
You could try installing older versions of Beautiful Soup and see if one of them allow you to move forward, but I can confirm that the latest versions, at least 4.7 and above, will not work on Python 2.6.

Related

hello i am new to python. i installed matplotlib in my Visual studio but whenever i try to run the file it displays the error

I wanted to plot a graph. but suddenly i could not because of the import error. yet i have installed matplotlib and numpy.
Traceback (most recent call last):
File "c:\Users\user\Documents\plot.py", line 1, in
from matplotlib import pyplot as plt
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib_init_.py", line 109, in
from . import _api, _version, cbook, docstring, rcsetup
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\rcsetup.py", line 27, in
from matplotlib.colors import Colormap, is_color_like
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\colors.py", line 56, in
from matplotlib import _api, cbook, scale
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\scale.py", line 23, in
from matplotlib.ticker import (
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\ticker.py", line 136, in
from matplotlib import transforms as mtransforms
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\transforms.py", line 46, in
from matplotlib._path import (
ImportError: DLL load failed while importing _path: The specified module could not be found.
PS C:\Users\user\Documents>
I figured it out.
If you have already installed matplotlib, but the error still comes about. Then you have to download Microsoft C++ from their website.
https://www.microsoft.com/en-US/Download/confirmation.aspx?id=48145
install Microsoft c++ then you can try again to run your code.
it has worked for me like magic.
I got the solution from a youtube video.
link here.
https://www.youtube.com/watch?v=DpwsvUkNAmg

cannot import name 'nosetester' error while importing pandas

Im getting below error while importing pandas
cannot import name 'nosetester'
Traceback (most recent call last):
File "/usr/bin/anaconda/envs/py35/lib/python3.5/site-packages/pandas/init.py", line 56, in
from pandas.util.nosetester import NoseTester
File "/usr/bin/anaconda/envs/py35/lib/python3.5/site-packages/pandas/util/nosetester.py", line 13, in
from numpy.testing import nosetester
ImportError: cannot import name 'nosetester'
Pandas version ->0.18.1
Numpy version ->1.18.0
Any help to resolve the error?
One approach is to use python 3.6 version like 3.6.5 is a stable version.
Another approach is if you want to continue in python 3.5 version itself then python 3.5.2 it worked correctly.

Lxml import issues when using Scrapy

I am trying to use Scrapy with Anaconda/Miniconda on Windows 10. Installation goes fine, but trying to actually run Scrapy gives the following error:
Traceback (most recent call last):
File "C:\ProgramData\Miniconda3\Scripts\scrapy-script.py", line 6, in <module>
from scrapy.cmdline import execute
File "C:\ProgramData\Miniconda3\lib\site-packages\scrapy\__init__.py", line 34, in <module>
from scrapy.spiders import Spider
File "C:\ProgramData\Miniconda3\lib\site-packages\scrapy\spiders\__init__.py", line 10, in <module>
from scrapy.http import Request
File "C:\ProgramData\Miniconda3\lib\site-packages\scrapy\http\__init__.py", line 11, in <module>
from scrapy.http.request.form import FormRequest
File "C:\ProgramData\Miniconda3\lib\site-packages\scrapy\http\request\form.py", line 11, in <module>
import lxml.html
File "C:\ProgramData\Miniconda3\lib\site-packages\lxml\html\__init__.py", line 53, in <module>
from .. import etree
ImportError: DLL load failed: The specified module could not be found.
I have tried reinstalling Scrapy, lxml, and Anaconda itself (this time, I'm using a clean install of Miniconda), as well as downloading unofficial lxml build from https://www.lfd.uci.edu/~gohlke/pythonlibs/, as suggested in one of the answers on Stack Overflow, but the problem persists. I have also done this on an Amazon AWS EC2 instance started from scratch, but I'm getting the same issue.
It seems to be something relatively common, but I couldn't find an answer that would work for me. What's an appropriate way to address this? Is it just about lxml, or is there something else causing this problem?

Twisted work with Python 3.3?

i use py3.3.2 and Twisted 15 on win7 and get this error
Traceback (most recent call last):
File "C:\Users\coder\Desktop\s.py", line 1, in <module>
from twisted.internet import protocol, reactor, endpoints
File "D:\Python33\lib\site-packages\twisted\internet\protocol.py", line 18, in <module>
from twisted.internet import interfaces, error, defer
File "D:\Python33\lib\site-packages\twisted\internet\defer.py", line 29, in <module>
from twisted.python import lockfile, log, failure
File "D:\Python33\lib\site-packages\twisted\python\lockfile.py", line 52, in <module>
_open = file
NameError: name 'file' is not defined
>>>
Twisted does not currently have continuous integration for Windows on Python 3; the only supported platform with Python 3 test coverage is Ubuntu. Please file a bug at https://twistedmatrix.com/.
In the meanwhile, please use Python 2.7 for Windows to use Twisted there.

cannot import name PyMCObjects when import pymc

I have pymc installed, and I am now trying to import it in my code. However,
First when I do import pymc, I got the error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/__init__.py", line 30, in <module>
from .CommonDeterministics import *
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/CommonDeterministics.py", line 21, in <module>
from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/utils.py", line 14, in <module>
from . import flib
ImportError: numpy.core.multiarray failed to import
which can be fixed by manually import numpy.core.multiarray, but then, when I try again to import pymc, I got another error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/__init__.py", line 30, in <module>
from .CommonDeterministics import *
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/CommonDeterministics.py", line 13, in <module>
from . import PyMCObjects as pm
ImportError: cannot import name PyMCObjects
I googled around, and the solutions to similar problems are either:
In case that's related to the installation of pymc, force using the 32-bit instead of 64. However, this answer is for Windows users, and I have OS X 10.9 (Mavericks).
In other cases, it's usually due to a circular dependency (for example, here), which I don't think is the case here.
My guess is that something is wrong with the package flib, but I couldn't figure out what. I would appreciate any answer/hint on this problem. Thanks in advance!
Update (July-4-2014)
Thanks, Chris! I rebuilt my pymc using the conda build by doing conda install -c https://conda.binstar.org/tobeplugged pymc, and now when I do import pymc, a different error message appears:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/__init__.py", line 44, in <module>
from . import CommonDeterministics
ImportError: cannot import name CommonDeterministics
As Chris pointed out (see comments below), the problem(s) is being looked at here. The problem seems to have to do with the version of gcc (version 4.9). I will try to rebuild my gcc with the older version (4.8.2) later today to see if that will solve the problem for OS X 10.9 (Mavericks). Otherwise, I believe people can wait a little bit for the pymc team to solve this problem, too.