Reputation: 23
I somehow messed up my python and am running out of ideas how to fix it. I am using Python 2.7.6. on a Windows computer. Basically anything connected to xml stopped working. Meaning: it worked fine before, then the console crashed, and now I get the error described.
When I write
pip install numpy
in the console I get the following error:
Traceback (most recent call last):
File "C:\Python27\Scripts\pip-script.py", line 9, in <module>
load_entry_point('pip==1.5.2', 'console_scripts', 'pip')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 351, in load_entry
_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2363, in load_entr
y_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python27\lib\site-packages\pip\__init__.py", line 11, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "C:\Python27\lib\site-packages\pip\vcs\subversion.py", line 4, in <module
>
from pip.index import Link
File "C:\Python27\lib\site-packages\pip\index.py", line 18, in <module>
import html5lib
File "C:\Python27\lib\site-packages\html5lib\__init__.py", line 16, in <module
>
from .html5parser import HTMLParser, parse, parseFragment
File "C:\Python27\lib\site-packages\html5lib\html5parser.py", line 6, in <modu
le>
from . import inputstream
File "C:\Python27\lib\site-packages\html5lib\inputstream.py", line 10, in <mod
ule>
from . import utils
File "C:\Python27\lib\site-packages\html5lib\utils.py", line 8, in <module>
import xml.etree.ElementTree as default_etree
ImportError: No module named etree.ElementTree
What I did so far: I tried to reinstall the xml package (which was suggested in the forum). I also installed Anaconda with various environments. There, the problem is visible when I want to use packages like openpyxl, which gives me a similar error message:
Traceback (most recent call last):
File "HU_calc.py", line 1, in <module>
import openpyxl as px
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\__init__.py", line 29
, in <module>
from openpyxl.workbook import Workbook
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\workbook\__init__.py"
, line 5, in <module>
from .workbook import Workbook
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\workbook\workbook.py"
, line 7, in <module>
from openpyxl.worksheet import Worksheet
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\worksheet\__init__.py
", line 4, in <module>
from .worksheet import Worksheet
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\worksheet\worksheet.p
y", line 35, in <module>
from openpyxl.cell import Cell
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\cell\__init__.py", li
ne 4, in <module>
from .cell import Cell, WriteOnlyCell
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\cell\cell.py", line 4
5, in <module>
from openpyxl.styles import numbers, is_date_format
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\styles\__init__.py",
line 5, in <module>
from .alignment import Alignment
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\styles\alignment.py",
line 6, in <module>
from openpyxl.descriptors import Bool, MinMax, Min, Alias, NoneSet
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\descriptors\__init__.
py", line 5, in <module>
from .sequence import Sequence
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\descriptors\sequence.
py", line 5, in <module>
from openpyxl.xml.functions import Element
File "D:\anaconda3\envs\py278\lib\site-packages\openpyxl\xml\functions.py", li
ne 28, in <module>
from xml.etree.cElementTree import iterparse
ImportError: No module named etree.cElementTree
This is especially confusing to me, as I thought Anaconda would create a python environment completely isolated from the Windows one. I feel like I am missing something very obvious. If there's anything missing/unclear in my question, I'll fix that as soon as possible.
I'd be very grateful for every advice.
Upvotes: 2
Views: 4208
Reputation: 82765
Looks like you have a python script named xml.py
. Rename that and it should work.
Upvotes: 1