How to install beautiful soup for anacadona? - jupyter-notebook

I have installed anacondas and am able to use jupyter notebook as well as pandas.
But I have only done this through a tutorial.
How do I install beautiful soup? Do i put this in the command prompt? In jupyter notebook?
What do I type?
What do i import as a package?
Am totally lost, thanks
AND THE ERROR I GET IS: ImportError: cannot import name 'beautifulsoup' from 'bs4' (C:\Users\skull\Anaconda3\lib\site-packages\bs4_init_.py)

The easiest way to install beautiful soup is using conda by typing the following into your command prompt:
conda install -c anaconda beautifulsoup4
Then in your python code, you can import it like so:
from bs4 import BeautifulSoup

Related

BokehJS library missing error and no plot

I am running Anaconda 10.0 Jupyter Notebook Python 3.8, bokeh 2.3.0 on Chrome. On my other PC (should be identical setup, except this is a slightly later Anaconda version) images are fine, but on this there is no image and the Javascript console tells me:
Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing
I could not find a simple, working solution to this problem here or elsewhere on the net and I am at a total loss now.
The abbreviated code I'm running is:
import regex as rg
import pandas as pd
import numpy as np
import datashader as ds, colorcet
import holoviews as hv
from holoviews.operation.datashader import datashade
from holoviews import opts
hv.extension("bokeh")
datashade(hv.Points(df_re), cmap=colorcet.fire).relabel('Reflectances').opts(height=700, width=800)
Where is the problem and how should I fix it?
Unfortunately that didn't work for me, still the same error.
What I found interesting was that prior to installing ver. 1.0.3 of the extension, Anaconda prompt said:
(Datashader-Holoview) C:\Windows\system32>jupyter labextension list
JupyterLab v2.2.6
No installed extensions
It is as if no version of that extension did exist in the environment.
There might be a bug with the most recent pyviz jupyter labextension (1.0.4). See if it works for you after you do
jupyter labextension install #pyviz/jupyterlab_pyviz#1.0.3
This worked for me.

Kernel Died when running Neuralcoref

I am trying to install neuralcoref and following the instructions given here.
I created a jupyter notebook and try to run the following code.
# Load your usual SpaCy model (one of SpaCy English models)
import spacy
nlp = spacy.load('en')
# Add neural coref to SpaCy's pipe
import neuralcoref
neuralcoref.add_to_pipe(nlp)
# You're done. You can now use NeuralCoref as you usually manipulate a SpaCy
document annotations.
doc = nlp(u'My sister has a dog. She loves him.')
doc._.has_coref
doc._.coref_clusters
I get an error message from the jupyter, that kernel died. Even I try to run in the in a python file but still its not working.
O.S - Windows 10
RAM : 16GB
Note: I did try out to updating numpy but still it didn't worked.
Can anyone help me with that. Appreciate your time.
Thanks
As per here: https://github.com/huggingface/neuralcoref/issues/189.
You can get it to work fine if you downgrade Spacy to 2.1.0.
pip uninstall spacy
pip uninstall neuralcoref
pip install spacy==2.1.0
pip install neuralcoref --no-binary neuralcoref
Has worked for others, including myself. Notebook now runs fine.
There is no need to downgrade spacy at all. Build from source, because neuralcoref installed with pip is built against spacy==2.1.0.
Proof:
Build:
git clone https://github.com/huggingface/neuralcoref.git
cd neuralcoref
pip install -r requirements.txt # correct for the desired versions of Cython and SpaCy
python setup.py install
Test:
import spacy
import neuralcoref
nlp = spacy.load('en_core_web_md')
neuralcoref.add_to_pipe(nlp)
print(spacy.__version__)
doc = nlp(u'My sister has a dog. She loves him.')
print(doc._.has_coref)
print(doc._.coref_clusters)
2.3.2
True
[My sister: [My sister, She], a dog: [a dog, him]]

Jupyter notebook ModuleNotFound

I get this error when trying to execute the imports, i've tried to reinstall python3, ipython and jupyter-notebook, but i keep getting the error ModuleNotFound. I've tried googling and searching for an answer, but nothing has worked so far. I'm new to jupyter-notebook and need it for a course.
First, install matplotlib and numpy in your terminal:
pip install matplotlib #add "sudo" before "pip" when you get "Permission denied"
pip install numpy
Then, choose the right Python version(i.e. kernel) for your notebook.

can't import 'torchtext' module in jupyter notebook while using pytorch

I installed pytorch using anaconda3 and my created virtual conda environment named 'torchTest'.
I installed all the modules needed but, codes doesn't work in jupyter python.
I installed torchtext using
1.pip install https://github.com/pytorch/text/archive/master.zip
2.and also pip install torchtext too.
all I mentioned successfully downloaded in my MAC OS X, but can't get what's wrong with my Jupyter notebook..
After having the same issue with torchtext from within my jupyterlab, I opened an issue on Github at the jupyterlab project as well as at the torchtext repository.
My current solution is to add the PYTHONPATH from the Anaconda env.
The Anaconda path is usually like that $HOME/anaconda/bin
You can add it from within Jupyter Lab/Notebook like that:
import sys
sys.path.append("/some/path/to/add")
import torchtext

rpy2 import works in shell but not in jupyter notebook

So, I have installed rpy2 successfully, and I can import it in a python shell, for example. Also, I have Jupyter notebook successfully installed. But for some reason I cannot import rpy2 on the jupyter notebook. I get the standard 'module not found' error. Other posts have addressed problems relating to installation of rpy2 itself, but specifically, I can't import ONLY from jupyter notebook. I find it quite strange, because I'm fairly certain I only have one copy of Python 3.6, so why can it import in the terminal but not in the notebook. .. .
I solved this by re-installing jupyter notebook. . .
I encountered the same issue, and I use many different env with conda. Here is my solution, starting your jupyter notebook with the same env which rpy2 is installed.

Resources