Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spyder can't open a console because of problems with Beautiful Soup #3287

Closed
ilkerhk opened this issue Jul 13, 2016 · 15 comments
Closed

Spyder can't open a console because of problems with Beautiful Soup #3287

ilkerhk opened this issue Jul 13, 2016 · 15 comments

Comments

@ilkerhk
Copy link

ilkerhk commented Jul 13, 2016

Description of your problem

Not sure if this is Conda or Spyder issue, but after the recent update of conda I can't open new ipython console.

What steps will reproduce the problem?

  1. Install latest conda with : conda update --all
  2. Observe that it updates to ipython 5.0
  3. Open Spyder and create new ipython console

What is the expected output? What do you see instead?
An error ocurred while starting the kernel
Error in sitecustomize; set PYTHONVERBOSE for traceback:
AttributeError: module 'pkg_resources' has no attribute 'iter_entry_points'
Traceback (most recent call last):
File "/home/ilker/ILK/Anaconda3/lib/python3.5/site‑packages/spyderlib/widgets/externalshell/start_ipython_kernel.py", line 183, in
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "/home/ilker/ILK/Anaconda3/lib/python3.5/site‑packages/IPython/init.py", line 49, in
from .terminal.embed import embed
File "/home/ilker/ILK/Anaconda3/lib/python3.5/site‑packages/IPython/terminal/embed.py", line 17, in
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/home/ilker/ILK/Anaconda3/lib/python3.5/site‑packages/IPython/terminal/interactiveshell.py", line 84, in
class TerminalInteractiveShell(InteractiveShell):
File "/home/ilker/ILK/Anaconda3/lib/python3.5/site‑packages/IPython/terminal/interactiveshell.py", line 128, in TerminalInteractiveShell
help="The name of a Pygments style to use for syntax highlighting: \n %s" % ', '.join(get_all_styles())
File "/home/ilker/ILK/Anaconda3/lib/python3.5/site‑packages/pygments/styles/init.py", line 76, in get_all_styles
for name, _ in find_plugin_styles():
File "/home/ilker/ILK/Anaconda3/lib/python3.5/site‑packages/pygments/plugin.py", line 66, in find_plugin_styles
for entrypoint in pkg_resources.iter_entry_points(STYLE_ENTRY_POINT):
AttributeError: module 'pkg_resources' has no attribute 'iter_entry_points'

Please provide any additional information below
The problem is with the new ipython version 5.0. Downgrading ipython back to 4.2 solved my issue.

Versions and main components

  • Spyder Version: 2.3.9
  • Python Version: ipython 5.0
  • Operating system: opensuse

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:

@MadDenker
Copy link

I also have this issue, but now Spyder will not even load. the loading pop-up screen with the logo comes up for about 100ms, not enough time to read the error message. When I run spyder.exe, I get this:

Traceback (most recent call last):
File "C:\Anaconda\Scripts\spyder-script.py", line 2, in
start_app.main()
File "C:\Anaconda\lib\site-packages\spyderlib\start_app.py", line 114, in main

from spyderlib import spyder

File "C:\Anaconda\lib\site-packages\spyderlib\spyder.py", line 155, in <module

from spyderlib.utils.environ import WinUserEnvDialog

File "C:\Anaconda\lib\site-packages\spyderlib\utils\environ.py", line 17, in <
module>
from spyderlib.widgets.dicteditor import DictEditor
File "C:\Anaconda\lib\site-packages\spyderlib\widgets\dicteditor.py", line 39,
in
from spyderlib.widgets.dicteditorutils import (sort_against, get_size,
File "C:\Anaconda\lib\site-packages\spyderlib\widgets\dicteditorutils.py", lin
e 78, in
import bs4
File "C:\Anaconda\lib\site-packages\bs4__init__.py", line 30, in
from .builder import builder_registry, ParserRejectedMarkup
File "C:\Anaconda\lib\site-packages\bs4\builder__init__.py", line 311, in
from . import _html5lib
File "C:\Anaconda\lib\site-packages\bs4\builder_html5lib.py", line 57, in
class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: 'module' object has no attribute '_base'

Spyder version: 2.3.9
IPython version: 5.0.0
Python version: 2.7.12

It works fine on my laptop, the only difference seems to be that my laptop runs Python 2.7.11.

@goanpeca
Copy link
Member

It looks like a conda issue, no @ccordoba12 ?

@MadDenker
Copy link

I cannot pull up an IPython console, either.

Traceback (most recent call last):
File "c:\anaconda\lib\runpy.py", line 174, in run_module_as_main
"main", fname, loader, pkg_name)
File "c:\anaconda\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\Anaconda\pkgs\ipython-5.0.0-py27_0\Scripts\ipython.exe__main
.py",
line 5, in
ImportError: No module named IPython

@ccordoba12
Copy link
Member

Yes, it seems you have a broken installation now. Please reinstall Anaconda and report again.

@MadDenker
Copy link

I was able to get IPython to load again using conda install -f IPython found here: http://conda.pydata.org/docs/troubleshooting.html

@MadDenker
Copy link

So, I was unable to install or update this bs4 package. It appears to be Beautiful Soup. The init.py file states lxml and/or html5lib be installed. After installing html5lib, Spyder loads up.

This appears to be a dependency issue. The new version of spyder should note this dependency on install!

@ccordoba12 ccordoba12 removed this from the v3.0beta5 milestone Jul 19, 2016
@ccordoba12
Copy link
Member

We don't depend on beautifulsoup or html5lib, so this is really a dependencies problem with Anaconda.

I'm glad you were able to find and solve your problem ;-)

@MadDenker
Copy link

@ccordoba12 I wouldn't be so quick to close this. It look like @ilkerhk still has an issue.

@MadDenker
Copy link

I also demonstrated that the spyder package imports bs4. So it appears that spyder does use Beautiful Soup.

File "C:\Anaconda\lib\site-packages\spyderlib\widgets\dicteditorutils.py", lin
e 78, in
import bs4

@ccordoba12 ccordoba12 reopened this Jul 19, 2016
@ccordoba12 ccordoba12 changed the title After the latest conda update can't open new console Spyder can't open a console because of problems with beautifulsoup Jul 19, 2016
@ccordoba12 ccordoba12 added this to the v3.0beta5 milestone Jul 19, 2016
@ccordoba12
Copy link
Member

It's true we import bs4 but it's a conditional import, we don't depend directly on it.

So although this is clearly an installation issue, we can add a bit of code to address it ;-)

@ilkerhk
Copy link
Author

ilkerhk commented Jul 19, 2016

I tried with and without beautifulsoup and html5lib, but didn't see any effect. I still can't run with a different error (see below). But downgrading back to iPython 4.2.0 + Spyder2 works for me. I am OK with those.

Thanks all for the replies.
best,

P.S. I've just tried fresh conda environment. After the install everything works fine (Spyder2 and iPython 4.2.0 ). If I upgrade to Spyder 3, I got the below error. I upgrade to iPython 5.0 still got below error.

An error ocurred while starting the kernel
Either:
Your IPython frontend and kernel versions are incompatible or
You don't have IPython installed in your external interpreter.
In any case, we're sorry but we can't create a console for you.

@ilkerhk
Copy link
Author

ilkerhk commented Jul 20, 2016

I realized I have other issue(s) with the setup. I installed all fresh but still getting error. So please ignore the error I mentioned in the last comment.
I will open a new issue.

@jitseniesen
Copy link
Member

The error in the first comment (which is about IPython 5 and Pygments and has nothing to do with beautifulsoup) has also been reported in issue #3309.

@ccordoba12 ccordoba12 changed the title Spyder can't open a console because of problems with beautifulsoup Spyder can't open a console because of problems with Beautiful Soup Jul 20, 2016
@MadDenker
Copy link

@ilkerhk try to force install pygments

@ilkerhk
Copy link
Author

ilkerhk commented Jul 22, 2016

Thanks @MadDenker ,
I tried a clean install and followed both your suggestions and working fine now with iPython 5.0...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants