Spyder Anaconda launch error - python

When I installed the Anaconda python distribution in Ubuntu 16.04LTS, it doesn't launch and giving below error.
Studio-XPS-1640:~$ spyder
Traceback (most recent call last):
File "/usr/bin/spyder", line 3, in <module>
start_app.main()
File "/usr/lib/python2.7/dist-packages/spyderlib/start_app.py", line 114, in main
from spyderlib import spyder
File "/usr/lib/python2.7/dist-packages/spyderlib/spyder.py", line 155, in <module>
from spyderlib.utils.environ import WinUserEnvDialog
File "/usr/lib/python2.7/dist-packages/spyderlib/utils/environ.py", line 17, in <module>
from spyderlib.widgets.dicteditor import DictEditor
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/dicteditor.py", line 39, in <module>
from spyderlib.widgets.dicteditorutils import (sort_against, get_size,
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/dicteditorutils.py", line 78, in <module>
import bs4
File "/usr/lib/python2.7/dist-packages/bs4/__init__.py", line 30, in <module>
from .builder import builder_registry, ParserRejectedMarkup
File "/usr/lib/python2.7/dist-packages/bs4/builder/__init__.py", line 314, in <module>
from . import _html5lib
File "/usr/lib/python2.7/dist-packages/bs4/builder/_html5lib.py", line 70, in <module>
class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: 'module' object has no attribute '_base'
How to solve this and what could be the reason for the error.

Related

Python not starting due to failed import site module google_auth-1.1.1

I am using Windows and was running Python 3.5.4 from the Anaconda distribution.
I was trying to install PyQt5 on my computer and I believe I ended up disrupting Python startup.
Now when I attempt to open python or ipython or pip, I get the following error:
Error processing line 1 of C:\Users\George\Anaconda3\lib\site-packages\google_auth-1.1.1-py2.7-nspkg.pth:
Failed to import the site module
Traceback (most recent call last):
File "C:\Users\George\Anaconda3\lib\site.py", line 167, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "C:\Users\George\Anaconda3\lib\types.py", line 166, in <module>
import functools as _functools
File "C:\Users\George\Anaconda3\lib\functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "C:\Users\George\Anaconda3\lib\weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\George\Anaconda3\lib\site.py", line 570, in <module>
main()
File "C:\Users\George\Anaconda3\lib\site.py", line 550, in main
known_paths = addsitepackages(known_paths)
File "C:\Users\George\Anaconda3\lib\site.py", line 327, in addsitepackages
addsitedir(sitedir, known_paths)
File "C:\Users\George\Anaconda3\lib\site.py", line 206, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Users\George\Anaconda3\lib\site.py", line 177, in addpackage
import traceback
File "C:\Users\George\Anaconda3\lib\traceback.py", line 5, in <module>
import linecache
File "C:\Users\George\Anaconda3\lib\linecache.py", line 8, in <module>
import functools
File "C:\Users\George\Anaconda3\lib\functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "C:\Users\George\Anaconda3\lib\weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
I would prefer not to reinstall Anaconda as I had some files saved and other packages installed, yet don't quite know what to do.

jupyter notebook starting error

I am facing the following error while starting jupyter-notebook. Anyone has any idea what's wrong?
desk ~/anaconda3/lib/python3.6/site-packages $ jupyter-notebook
Traceback (most recent call last):
File "/home/suny/anaconda3/bin/jupyter-notebook", line 4, in <module>
import notebook.notebookapp
File "/home/suny/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 28, in <module>
from jinja2 import Environment, FileSystemLoader
File "/home/suny/anaconda3/lib/python3.6/site-packages/jinja2/__init__.py", line 81, in <module>
_patch_async()
File "/home/suny/anaconda3/lib/python3.6/site-packages/jinja2/__init__.py", line 77, in _patch_async
from jinja2.asyncsupport import patch_all
File "/home/subinoy/anaconda3/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 13, in <module>
import asyncio
File "/home/suny/anaconda3/lib/python3.6/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/home/suny/anaconda3/lib/python3.6/asyncio/base_events.py", line 17, in <module>
import concurrent.futures
File "/home/suny/anaconda3/lib/python3.6/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/home/suny/anaconda3/lib/python3.6/site-packages/concurrent/futures/_base.py", line 355
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
Thanks in advance!!

AttributeError: 'module' object has no attribute 'tokenize'

I have nltk installed in my virtualenv. When I do pip freeze , among other packages I can see nltk==3.2.1.
I am using Ubuntu 14.04 and python 2.7. And After activating virtualenv, when I try to import nltk from python shell, I get following error.
>>> import nltk
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/nltk/__init__.py", line 128, in <module>
from nltk.chunk import * File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/nltk/chunk/__init__.py", line 157, in <module>
from nltk.chunk.api import ChunkParserI File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/nltk/chunk/api.py", line 13, in <module>
from nltk.parse import ParserI File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/nltk/parse/__init__.py", line 79, in <module>
from nltk.parse.transitionparser import TransitionParser File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/nltk/parse/transitionparser.py", line 21, in <module>
from sklearn.datasets import load_svmlight_file File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/sklearn/__init__.py", line 57, in <module>
from .base import clone File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/sklearn/base.py", line 11, in <module>
from .utils.fixes import signature File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/sklearn/utils/__init__.py", line 17, in <module>
from ..externals.joblib import cpu_count File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/sklearn/externals/joblib/__init__.py", line 127, in <module>
from .parallel import Parallel File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.py", line 30, in <module>
from .format_stack import format_exc, format_outer_frames File "/home/kenden/den/codes/myenv/lib/python2.7/site-packages/sklearn/externals/joblib/format_stack.py", line 35, in <module>
generate_tokens = tokenize.tokenize AttributeError: 'module' object has no attribute 'tokenize'
How can I solve this problem?

Unable to install Python pip or use easy_install

I am on OSX 10.10.3 with Python 2.7.6 as my main Python. I suddenly ran into trouble using pip, and tried to fix it. The solution proposed elsewhere on StackOverflow was to remove installations of pip and reinstall it either using their official installer or using easy_install.
Running the installation script (https://bootstrap.pypa.io/get-pip.py) gives:
Traceback (most recent call last):
File "pip.py", line 17767, in <module>
main()
File "pip.py", line 162, in main
bootstrap(tmpdir=tmpdir)
File "pip.py", line 82, in bootstrap
import pip
File "/tmp/tmpDnRtQK/pip.zip/pip/__init__.py", line 6, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/optparse.py", line 90, in <module>
from gettext import gettext
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gettext.py", line 49, in <module>
import locale, copy, os, re, struct, sys
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 110, in <module>
#functools.wraps(_localeconv)
AttributeError: 'module' object has no attribute 'wraps'
and running "sudo easy_install pip" gives
Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 7, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2793, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 673, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 581, in resolve
requirements.extend(dist.requires(req.extras)[::-1])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2323, in requires
dm = self._dep_map
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2374, in __getattr__
raise AttributeError(attr)
AttributeError: _dep_map
I am not really sure where to go next.
I am also in the situation that I can't import various modules, for example Flask, since I get the following error:
Traceback (most recent call last):
File "/Users/dawi/git/friends/run.py", line 2, in <module>
from application import app
File "/Users/dawi/git/friends/application/__init__.py", line 3, in <module>
from flask import Flask
File "/Library/Python/2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "/Library/Python/2.7/site-packages/Werkzeug-0.9.6-py2.7.egg/werkzeug/__init__.py", line 154, in <module>
__import__('werkzeug.exceptions')
File "/Library/Python/2.7/site-packages/Werkzeug-0.9.6-py2.7.egg/werkzeug/exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "/Library/Python/2.7/site-packages/Werkzeug-0.9.6-py2.7.egg/werkzeug/wrappers.py", line 23, in <module>
from functools import update_wrapper
ImportError: cannot import name update_wrapper

Install Error Pygame

I have Ubuntu 12.04 with Python 2.7 and Python 3 installed. I installed pygame through sudo apt-get python-pygame and also from the source. When I tried >>>import pygame on Python I get this error:
`
>>> import pygame<br>
Jello, world!<br>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pygame/__init__.py", line 255, in <module>
try: import pygame.surfarray
File "/usr/lib/python2.7/dist-packages/pygame/surfarray.py", line 69, in <module>
import pygame._numpysurfarray as numpysf
File "/usr/lib/python2.7/dist-packages/pygame/_numpysurfarray.py", line 48, in <module>
import numpy
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module>
import polynomial
File "/usr/lib/python2.7/dist-packages/numpy/polynomial/__init__.py", line 18, in <module>
from polynomial import Polynomial
File "/usr/lib/python2.7/dist-packages/numpy/polynomial/polynomial.py", line 60, in <module>
from polytemplate import polytemplate
File "/usr/lib/python2.7/dist-packages/numpy/polynomial/polytemplate.py", line 20, in <module>
polytemplate = string.Template('''
AttributeError: 'module' object has no attribute 'Template'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 18, in <module>
import problem_report
File "/usr/lib/python2.7/dist-packages/problem_report.py", line 16, in <module>
from email.mime.multipart import MIMEMultipart
File "/usr/lib/python2.7/email/mime/multipart.py", line 9, in <module>
from email.mime.base import MIMEBase
File "/usr/lib/python2.7/email/mime/base.py", line 9, in <module>
from email import message
File "/usr/lib/python2.7/email/message.py", line 16, in <module>
import email.charset
File "/usr/lib/python2.7/email/charset.py", line 14, in <module>
import email.quoprimime
File "/usr/lib/python2.7/email/quoprimime.py", line 48, in <module>
from string import hexdigits
ImportError: cannot import name hexdigits
Original exception was:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pygame/__init__.py", line 255, in <module>
try: import pygame.surfarray
File "/usr/lib/python2.7/dist-packages/pygame/surfarray.py", line 69, in <module>
import pygame._numpysurfarray as numpysf
File "/usr/lib/python2.7/dist-packages/pygame/_numpysurfarray.py", line 48, in <module>
import numpy
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module>
import polynomial
File "/usr/lib/python2.7/dist-packages/numpy/polynomial/__init__.py", line 18, in <module>
from polynomial import Polynomial
File "/usr/lib/python2.7/dist-packages/numpy/polynomial/polynomial.py", line 60, in <module>
from polytemplate import polytemplate
File "/usr/lib/python2.7/dist-packages/numpy/polynomial/polytemplate.py", line 20, in <module>
polytemplate = string.Template('''
AttributeError: 'module' object has no attribute 'Template'
I saw the Jello World so I guess it is working a bit. I dont know what to do. I appreciate the help. Thanks in advance.
That looks like you don't have SDL installed on your box.
Remove your current pygame packages then dot he following:
wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure
make
make install
Once this has completed reinstall pygame but try reinstalling via easy_install or pip:
easy_install pygame
or
pip install pygame
You should be good to go after that.

Categories

Resources