Jupyter notebook error ModuleNotFoundError: No module named 'datascience' - python

Good evening,
I am trying to import datascience module at my Jupyter notebook, but the notebook keeps showing error called
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-10-6f3a305c96af> in <module>()
----> 1 from datascience import *
ModuleNotFoundError: No module named 'datascience'
although I have done
pip install --user datascience
Could anyone solve this problem for me?
Thank you in advance

first, check whether you have installed datascience package in to the same environment.
use pip freeze to list installed packages.
if it's installed correctly, then try this.
import datascience as dt
then you can access ant function in datascience package.
`dt.function()`

Perhaps these links can help you :
link, link 2 and link 3
First, activate your environment if you have it.
Second, check your project path.
Third, try to install your package one more time.
Fourth, use freezing to check if a module is installed.
Five, check if the import is well done.

Related

Newspaper Package error download in Python/Pip (Google Colaboratory)

I am trying to perform sentiment analysis on an article from Wikipedia. I need to use the newspaper Python package and am having difficulties implementing it into my code. I have downloaded pip from the terminal and opened the venv virtual environment, and downloaded nltk, textblob, and newspaper3k. However, when I go to run the code it says no such newspaper module exists even though I have downloaded it from the terminal multiple times? I have updated pip and reran my code, but am receiving the same error. What could I do to resolve the issue?
Thank you!
I have tried researching the issue, I opened a virtual environment and downloaded the packages inside that. Along with that I updated pip and reran the code, and tried downloading newspaper3k multiple different times with the same result. I am using Google Colaboratory to run code.
Here is the error I am receiving.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-8-71f9b211be5a> in <module>
1 from textblob import TextBlob
----> 2 from newspaper import Article
3
4 url = 'https://en.wikipedia.org/wiki/Mathematics'
5
ModuleNotFoundError: No module named 'newspaper'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-8-71f9b211be5a> in <module>
1 from textblob import TextBlob
----> 2 from newspaper import Article
3
4 url = 'https://en.wikipedia.org/wiki/Mathematics'
5
ModuleNotFoundError: No module named 'newspaper'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
But in the terminal, I have downloaded newspaper3k:
Requirement already satisfied: six in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (from feedfinder2>=0.0.4->newspaper3k) (1.15.0)
Please let me know what I could do to resolve the error I receive in Google Colaboratory - I am unclear what is causing it since I have downloaded the packages. I suspect the error might be caused with the directory I imported the modules in and the directory of the Google Colaboratory file not matching -- I created 2 virtual environments and downloaded the modules in those. I am not sure which directory my google colaboratory file is in and whether or not it matters if it is in the same directory as the modules. If this is the case, how would i go about to move the Colaboratory file to the same directory?
Thank you so much!

error then import pytorch-lightning, azure notebook

i am use microsoft azure (for students) ML servise. Then i work with notebook i can not import pytorch-lightning libary.
!pip install pytorch-lightning==0.9.0
import pytorch_lightning as pl
Here i have error:
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <module>
----> 2 import pytorch_lightning as pl
ModuleNotFoundError: No module named 'pytorch_lightning'
This is unbearably weird. someone faced such a problem?
This is rather strange but could be related to that your installation is in another location, so let's:
try where is PL installed with find -name "lightning"
also, check what is the loaded package locations python -c "import sys; print(sys.path)"
I guess that the problem will be in What's the difference between dist-packages and site-packages?
I resolved this problem by installing PyTorch-lightning in the kernel instead of the machine. It all boils down to installing with %conda magic instead of !conda magic (or same thing for %pip magic instead of !pip magic).

Installed package giving "ModuleNotFoundError" when I try to import into jupyter notebook (using venv)

Sorry if this is a dupe, the similar questions I found all involved anaconda, which I am not using. I am fairly new to python and the jupyter environment.
When I try to import the 'uproot' package to my jupyter notebook or jupyter lab, I get the error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-dafb83b77728> in <module>
2 import matplotlib.pylab as plt
3 import pandas as pd
----> 4 import uproot
5 import os
ModuleNotFoundError: No module named 'uproot'
I include the full ouput to note that there doesn't seem to be an issue with matplotlib, pandas (or numpy).
Further info:
I am using a venv
I invoked this with python3 -m venv .my-venv
I activate this, and then run jupyter
all packages installed at once with pip install numpy pandas matplotlib uproot
Launching jupyter:
! which python correctly shows my venv kernel (same for pip).
! pip install uproot runs and shows the package is installed.
I tested the python3 interpreter in CLI (inside the venv) and when I enter import uproot it does not throw any errors.
Uproot is a package that allows me to read the format of data files I'm using directly into a pandas data-frame, so without it I am at a complete dead end.
I'm totally stuck as to why this is not working in jupyter, and would greatly appreciate any input in what could be wrong or how to further troubleshoot.
Cheers,
Paul
Closing this as I discovered something in my terminal environment causing the specified issue. However I have a (probably related) issue which I have created another question for here.

"No module named 'stem'" in Python3 on macOS

Apologies for the noob question.
I am trying to run a script which uses the stem module. However, whenever I run it, I get the warning "ModuleNotFoundError: No module named 'stem'"
Even when I use Python3 in terminal this issues occurs from simply trying:
In [1]: import stem
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-e9a7ebd02e09> in <module>()
----> 1 import stem
ModuleNotFoundError: No module named 'stem'
Why is this happening?
I am using macOS 10.12.6. I have also imported stem through terminal.
Run It to solve the issue:
pip3 install stemming
Try below code
pip3 install stem
I had similar issue using python3.8,
stem package was installed, had Ubuntu 20.04 system, but still kept on getting the "No module named 'stem'" error.
until I ran into stem documentation then figured I should run:
sudo apt-get install python3-stem

Importgraph lab hello world error

After installing GraphLab in my PC which is running Ubuntu 14.04, I have just encountered the following error in my first hello world program:
import graphlab
The Error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-784beace7f26> in <module>()
----> 1 import graphlab
ImportError: No module named graphlab
What is the reason for this and how the error could be solved?
The usual reason for this type of error is that your package is installed somewhere other than on the default path that Python is searching. Check
print sys.path
to see whether the location of your graphlab module is present. I'm guessing that it isn't, in which case you will need to append it:
sys.path.append('path/to/graphlab')
If that works you can then add that location to your PYTHONPATH for future use.
Did you install graphlab on your computer or did you install the graphlab python module? You might need to install the graphlab module if you only installed it on your computer.
Looks like this link here has the information that you need to install graphlab with pip.

Categories