0

I would like to install the package : newsapi in Python

I run the command

pip3 install newsapi-python

The package was succefully installed. But I import him in Anaconda :

from newsapi import NewsApiClient
>> ModuleNotFoundError: No module named 'newsapi'

I would like to know how to solve this kind of problem. I think that is linked to some path, but I am not sure

3 Answers3

0

If you're installing packages with anaconda, you'll want to use conda install newsapi-python instead of pip. Pip is the default package manager for python.

Josh Bacon
  • 395
  • 3
  • 14
  • However this package does not exist in conda : Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - newsapi-python – user10651723 Nov 16 '18 at 15:00
  • [This](https://stackoverflow.com/questions/41060382/using-pip-to-install-packages-to-anaconda-environment) link is probably what you're looking for then. – Josh Bacon Nov 16 '18 at 15:04
0

You have the package, your Anaconda interpreter just doesn't know where it is. The easiest way to fix this is to just reinstall using the --user flag. By default, Anaconda will pull in your user packages.

Try pip3 install newsapi-python --user, and then see if you can import it.

Matt Messersmith
  • 12,939
  • 6
  • 51
  • 52
0

This worked for me

python3 -m pip install newsapi-python 
toyota Supra
  • 3,181
  • 4
  • 15
  • 19
Satish
  • 1