I just got done writing a pretty good rock paper scissors game and now when I try to import it and run the cell I'm getting this:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-8d3be5084430> in <module>
----> 1 import RPSgame.py
ModuleNotFoundError: No module named 'RPSgame.py'; 'RPSgame' is not a package
What is causing this and how can I fix it? I'm running Jupyter Notebook through Anaconda Navigator
It might be related to how you are importing the .py file
This link might help: How to import other Python files?
You shall try this:
import .RPSgame
Related
I´m trying to run some code using Jupyter and I can´t find a way of installing gym.
This is the code:
!pip install gym==0.18
import gym
After all the "Requirement already satisfied"s (since I had already installed it) it says:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [2], in <cell line: 2>()
1 get_ipython().system('pip install gym')
----> 2 import gym
ModuleNotFoundError: No module named 'gym'
The same happens if I don´t specify a version, and use only "gym".
I tried installing it using Terminal several ways, however, this shouldn´t be so complicated, right?
Please help.
Thanks in advance.
Unable to solve the error.
All the code is taken from the website, but it's not working.
This working environment is jupyter notebook because I tried to work at IDLE in desktop, but it was not worked.
I've tried to install scraping in my computer and succussed.
But still the error is not deleted.
Error messages:
ModuleNotFoundError Traceback (most recent call last)
Input In [5], in <cell line: 5>()
2 get_ipython().run_line_magic('autoreload', '2')
4 from datetime import datetime
----> 5 from scraping import Scraping
6 from complete import Complete
7 from train import Tree_updown, Tree_updown_k
ModuleNotFoundError: No module named 'scraiping'
Code that is generating the error:
%load_ext autoreload
%autoreload 2
from datetime import datetime
from scraping import Scraping
from complete import Complete
from train import Tree_updown, Tree_updown_k
The error says, No module named 'scraiping' but in your code you correctly imported scraping. So I suppose you just entered a typo while copying the error.
To fix it you just have to install the package. Type this in your terminal:
pip install scraping
I developp on colab and i save my code to create my own module qrl.py on drive but in my qrl.y i use !pip install deplacy and import numpy.
if i try to import the module i have the error following
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-58-62dca1f58066> in <module>()
----> 1 import grl
ModuleNotFoundError: No module named 'grl'
---------------------------------------------------------------------------
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.
---------------------------------------------------------------------------
Trying copying the file to /content/ and build your module there. It's not able to access qrl.py (or grl) file.
On MacOs
Jupyter Notebook
I'm having issues trying to implement a pandas module, I did pip list and it says that it is installed, so I'm not sure why I get
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-84d930aeb84e> in <module>
----> 1 from pandas_datareader import data as wb
ModuleNotFoundError: No module named 'pandas_datareader'
is there something else I need? Thanks.
I'm not sure why it's not working, I tried on VScode as well.
I am having some difficulty trying to get the linear_algebra module working on Jupyter Notebook in Python. I am trying:
import linear_algebra
But I get the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-30-7080be6cdc0f> in <module>()
----> 1 import linear_algebra
ImportError: No module named 'linear_algebra'
I don't get what I am doing wrong
Thank you in advanced for help
The 'linear_algebra' is not a library so you can't simply import it as such. It is a file that has the functions (eg. dot) so you have to make sure your main code file and the linear_algebra.py is at the same directory. I hope this helps.