install spacy not working in jupyter notebook - anaconda

I have installed Anaconda 3.x for 64 bit in a Windows 10 system. I have installed spacy by pip install -U spacy
WHen i run install spacy in Notebook i get an 'DLL Load' error like this

You can install spacy and download en in the jupyter notebook as:
import sys
!{sys.executable} -m pip install spacy
!{sys.executable} -m spacy download en

!conda install -c spacy spacy=0.101.0 -y
!python -m spacy.en.download

! pip install SpaCy
! python -m spacy download en
This really worked !

To install spacy on jupyter notebook use pip install SpaCy

Go to Anaconda Navigator -> at the environment, go to the base(root)-> open terminal
type this command:
conda install -c conda-forge spacy
Spacy configuration in Anaconda
Spacy configuration in Anaconda
Spacy configuration at Terminal

To install spacy in jupyter notebook.
Open cmd or anaconda prompt.
run pip install spacy as the base user.
it will now work in jupyter notebook but it may take some time to import the modules.

Related

No module named 'torch' in Jupyter Notebook but it is installed (Mac OS)

So when I try to import torch in jupyter notebook it gives the error no module named 'torch'.
I created a conda environment named "Thesis" where I work in and install my packages.
When I try these commands in my terminal it says the package is installed (see three images below):
torch1
torch2
torch3
I tried many commands to install the package:
pip install torchvision
python3 -m pip install torchvision
conda install pytorch torchvision -c pytorch
I also tried installing the package directly in the jupyter notebook itself via:
import sys
!{sys.executable} -m pip install torchvision
It at least shows something but I got the following dependency error
dependency error
I also created a kernel
ipython kernel install --name "thesis" --user
All did not help and I still receive the error in jupyter notebook.
Does somebody know how to resolve this?
I solved the problem by downloading and activating virtualenv with:
python3 -m pip install virtualenv
virtualenv <my_env_name>
source <my_env_name>/bin/activate
And getting the path in the jupyter notebook by:
import sys
print(sys.executable)
which outputs:
/Users/{username}/opt/anaconda3/bin/python
And installing the packages in the terminal via:
/Users/{username}/opt/anaconda3/bin/python -m pip install {package_name}

Anaconda - JupyterLab - spaCy : "No module named spacy" in terminal

I'm using Anaconda and I'm trying to install spaCy.
At this point:
python -m spacy download fr_core_news_sm
I get stuck with the "no module named spacy" error.
Don't understand what I'm doing wrong.
Thanks,
You have to install spaCy before you use it to download a model. You can use the install helper to guide you on how to this, for example:
conda install -c conda-forge spacy
python -m spacy download fr_core_news_sm

pip command to downgrade jupyter notebook

I installed jupyter notebook with pip using python -m pip install jupyter and nbextensions using pip install jupyter_contrib_nbextensions && jupyter contrib nbextension install
My current jupyter-notebook version is 6.1.6 which makes nbextensions to show blank tab as per this thread . However the solution is to downgrade the notebook to 6.1.5 version.
How do I do that using pip?
pip install notebook==6.1.5 will downgrade the jupyter notebook
You can specify a version number:
pip install jupyter-notebook==6.1.5

how to install fastai on windows 10

I cant seem to install the right version of torch and I cant get fast ai libraries working
I try
Python 3.7
pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
Could not find a version that satisfies the requirement torch>=1.1.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
No matching distribution found for torch>=1.1.0 (from torchvision)
I feel like I may of downgraded my gpu when I tried conda install fast ai
and then I tried pip and it couldnt find a file C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\caffe2\python\serialized_test\data\operator_test
I finally got to the point where it said successfully installed six, pillow, and torch but torch is at 0.3 which is incompatiable.
pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
expected to install pytorch or fastai nothing seems to work
You may try installing the course by creating a conda environment provided anaconda is already installed in your windows machine.
conda update conda
conda create -n fastai_conda python=3.6
conda activate fastai_conda
conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge
Or for installing CPU version you can use the below commands after the environment is created
conda install -c pytorch pytorch-cpu torchvision
conda install -c fastai fastai
You can check if installation went right with this command
python -m fastai.utils.show_install
You may further need to install ipykernel to use the conda environment in your jupyter notebook.For that activate environment and run the following commands:
conda install nb_conda_kernels
python -m ipykernel install --user --name fastai_v1 --display-name "fastai v1"
conda install ipywidgets

Cannot install jupyter notebook

In windows 7, I try to install jupyter notebook using:
pip3 install jupyter
But I get error:
Command "python setup.py egg_info" failed with error code 1 in C:\Users\AppData\Local\Temp\pip-build-5in28fbw\pywinpty\
Best thing to do is to install Anaconda here
It includes its own "conda" terminal window for "windows", which will make it a lot easier for you to invoke jupiter notebook from the conda terminal, regardless of which folder you are in
First update if using linux system:
sudo apt-get update
sudo apt-get upgrade
Restart the system and try below steps:
Installing Jupyter with pip
As an existing or experienced Python user, you may wish to install Jupyter using Python’s package manager, pip, instead of Anaconda.
If you have Python 3 installed (which is recommended):
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install jupyter
If you have Python 2 installed:
sudo python -m pip install --upgrade pip
sudo python -m pip install jupyter
Congratulations, you have installed Jupyter Notebook! To run the notebook, run the following command at the Terminal (Mac/Linux) or Command Prompt (Windows Run CMD in Admin):
jupyter notebook
Update your setuptools and pip first then retry:
pip install --upgrade setuptools pip

Resources