0

I need the Facebook chat module to send Facebook messages using Python. In order to do it, I am using Jupyter in my notebook. Below is the code used.


 ImportError                               Traceback (most recent call last)
 <ipython-input-6-3ab37e38fb81> in <module>()
  ----> 1 import fbchat

 ImportError: No module named fbchat
 File "<ipython-input-7-8dba1f7bdc0c>", line 1
     -m pip install fbchat
     ^
 SyntaxError: invalid syntax

It says pip not recognized. I have also added an image that shows the error.

julianfperez
  • 1,726
  • 5
  • 38
  • 69
vedl
  • 1
  • I don't think that's how you use pip *inside* jupyter. You may want to use conda instead - depending on your set up. Have a look at https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/ and https://stackoverflow.com/questions/39007571/running-jupyter-with-multiple-python-and-ipython-paths. – doctorlove May 19 '18 at 07:30

3 Answers3

0

If

python -m pip install fbchat

is not working, try

pip install fbchat

If this also couldn't fetch fbchat, use the source to build on your machine as following:-

git clone git://github.com/carpedm20/fbchat.git
cd fbchat
python setup.py install

use admin or sudo permissions if required

nandal
  • 2,544
  • 1
  • 18
  • 23
0

Don't use -m

Just use this on ur terminal pip2 install fbchat

or pip3 install fbchat

Tanay Agrawal
  • 392
  • 1
  • 9
0

Use a ! to execute pip within the notebook:

If you are trying to use pip from within a Jupyter Notebook use an !:

! pip install fbchat
Dodge
  • 3,219
  • 3
  • 19
  • 38