/usr/bin/python: No module named spacy - nlp

I have already installed the Rasa and spacy. But when i try to download by below command
python -m spacy download en_core_web_md
On my Mac it says:
/usr/bin/python: No module named spacy
Could you please advise how to achieve it.
I also tried below options but still the same issue:
For macOS:
You can create the virtual environment by opening the command prompt and typing the following code:
$ python3 -m venv --system-site-packages ./venv
You can activate the virtual environment by typing the following code:
$ source ./venv/bin/activate
Installing Rasa and Rasa X:
You can install both Rasa and Rasa X using the following code:
$ pip install rasa-x --extra-index-url https://pypi.rasa.com/simple
Use the following code only if you want to install Rasa:
$ pip install rasa
Install Rasa NLU and Spacy in the same command prompt:
$ pip install rasa[spacy]
$ python -m spacy download en_core_web_md
$ python -m spacy link en_core_web_md en

I would recommend installing SpaCy separately, using pip, as follows:
pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_md

Related

Unable to install pyserial

PI3B, Buster.
I have installed both python3 and pip3 but when I use pip3 to install pyserial I get a no module error. The wrong directory is being used. How can I fix it please? volumio#pnbvolumio:~$ sudo python -m pip3 install pyserial /usr/bin/python3: No module named pip3 volumio#pnbvolumio:~$ pip3 --version pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
Using pip with sudo is not a good idea.
Read more here
Try to install pyserial using this command:
python3 -m pip install pyserial
You can also try to instal it for current user only:
python3 -m pip install pyserial --user
Also consider using virtual environmet to manage multiple environments and hassle free module managing.

'no module named spacy' even though i just installed it

I just installed spacy on my conda environment, but when it is failing to import. I tried both pip install -U spacy and conda install -c conda-forge spacy.
As seen in the image, when i run the code python -m spacy info it detects spacy. Importing works in pycharm. Is this a jupyter problem?

Command to install Rasa_nlu using conda

I need to install rasa_nlu for building chatbot in python. Please help with the command to install the same using conda
Tried :
conda install -c conda-forge rasa_nlu
Try installing Rasa Nlu in a virtual environment. Please try below commands
conda create -n myenv python=3.5
conda activate myenv
pip install rasa_nlu
Please use below -
conda install rasa-nlu
conda install tensorflow
conda install sklearn-crfsuite

How to install tensorflow-gpu for both python2 and python3

I already have installed tensorflow 1.2, CUDA 8.0 and CuDNN 5.1 for python2.7. Now I want to use it for python3.5 but importing tensorflow fails. How do I install tensorflow for python3 again. And do I have to do the CUDA and CuDNN episodes again?
You can create separate environment for python 2 and 3. Thus, you can easily install corresponding tensorflow versions. Remember you have to install everything separately on virtual environment once cuda and cudnn are installed on your system as per the instructions on Tensorflow webpage: https://www.tensorflow.org/install/install_linux
Although I would preferably keep both the envs separate but I tried to install both the versions in the same environment and it works.
My system configs are - CUDA - 8.0, CuDNN -7.1 and I tried installing Tensorflow 1.4.0.
# First, I created virtualenv for python2 as:
virtualenv --system-site-packages tf3n4 # tf3n4 is env name
# Then, I installed virtualenv for python3 with same name, it will not override python2 but it will create a seperate python3 bin.
virtualenv --system-site-packages -p python3 tf3n4
# go to your env (it's in my home directory)
source ~/tf3n4/bin/activate
Now you can check for both pythons by which python2 and which python3, this will be in your env path but not on the local machine python. For example: I got this /home/USERNAME/tf3n4/bin/python2 and /home/USERNAME/tf3n4/bin/python3.
#Now, install tensorflow for python 2:
python2 -m pip install --upgrade tensorflow-gpu==1.4
# install tensorflow for python 3:
python3 -m pip install --upgrade tensorflow-gpu==1.4
Once, you are done, you can run any python just by mentioning it:
python2 or python3 before running any code on terminal
If you have already installed tensorflow 1.2, CUDA 8.0 and CuDNN 5.1 for python2.7. Then you can:
yum install python3-pip
(now you have python3 and pip3, however the python version may not be 3.5)
python3 -m pip install --upgrade tensorflow-gpu==1.2
(make sure the installed version is exactly same as that of python2)
I made it after these two steps.

How to install Keras in Python 3.6?

I'm having trouble installing the Keras library for Python 3.6. Whenever I try to install Keras, it is throwing an error and when I searched on the internet, Keras had been released for up to Python 3.5. Does anyone have a solution for this?
Follow this method if you have Anaconda and Python version 3.6.
First, create a new conda environment,
conda create -n keras python=3.5
Now activate it,
source activate keras
and install Keras,
conda install keras
Test if it works,
$ python
>>>import keras
You will get the following message if it was successful:
Using TensorFlow backend.
Click here to see Mike Müller's answer
I used sudo pip install keras to download.
I have both python 2.7 and 3.6 installed on my Mac. I used pip -V to check my python version of installation. Probably you used invalid version of python to download.
Screenshot of the install being done on my computer:
Follow the below steps , Tensorflow dosnt support py3.7 as of now , so 3.6 is better , I recommend using environment , (venv , conda(preferred) ),
For conda
conda create -n keras python=3.6
source activate keras
conda install tensorflow keras
#for faster installation
pip install keras
For virtualenv
virtualenv -p python3 keras
source keras/bin/activate
pip install keras tensorflow numpy
Try the following at a command prompt:
pip install --upgrade tensorflow
pip install --upgrade keras
Also, refer the following link for more detail:
https://www.tensorflow.org/install/pip

Resources