I am trying to implement a simple multi-layer network in colab using python. To do so, I ran the following code.
Code
from pymnet import *
mnet = MultilayerNetwork(aspects=1)
mnet.add_node(1)
mnet.add_layer('a')
mnet[1,'a'].deg()
However, I keep getting the following error.
Error
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-74cefa95e553> in <module>()
----> 1 from pymnet import *
2 mnet = MultilayerNetwork(aspects=1)
3 mnet.add_node(1)
4 mnet.add_layer('a')
5
ModuleNotFoundError: No module named 'pymnet'
Any suggestions with regard to how I could overcome this error will be much appreciated.
The error means that pymnet module is not in Colaboratory. You can download it from pymnet source, then either use it from your drive folder or use the other tricks suggested here, to upload it to your colab space. Some examples for other libraries provided by colab can help too.
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 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
I am fairly new to Python. I am trying to run the below code and getting Module not found error. I tried checking seaborn version and it was the latest. After multiple tries I placed my file in a different path and it started working fine. Could someone help me understand this behavior.
My Anaconda path: C:\Users\Kumar>
Placed the file in same path and it did not run.
Placed the file in Downloads and ran again from Jupyter and it worked fine. Please help in understanding what is the difference and how can I resolve these errors in future
My Code:
corr = df.corr()
plt.figure(figsize=(14,14))
plt.figure(figsize=(14,14))
sns.heatmap(corr,cmap= 'coolwarm')
AttributeError Traceback (most recent call last)
<ipython-input-15-522f105baca0> in <module>
2 plt.figure(figsize=(14,14))
3 plt.figure(figsize=(14,14))
----> 4 sns.heatmap(corr,cmap= 'coolwarm')
AttributeError: module 'seaborn' has no attribute 'heatmap'
possibly you need to install additional modules:
statsmodels
fastcluster
It works for me
see https://seaborn.pydata.org/installing.html
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.