How to Import linear_algebra Python Jupyter Notebook - python

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.

Related

Python/Jupyter Notebook Not finding modules...?

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

Databricks job cannot find python library imported in the cluster

I am trying to run a cron job on my notebook and I get an "no module found" error. When I look at the job logs this is the full error:
ModuleNotFoundError Traceback (most recent call last)
<command-2307930105977041> in <module>
1 from __future__ import print_function
2 import sys
----> 3 import pymysql
ModuleNotFoundError: No module named 'pymysql'
This library has been installed to my cluster that I am running the job from and the notebook that uses this library runs and does not show a ModuleNotFoundError. I ran the import pymysql in it's own cell and it does not throw me back an error, only when I run a job on that notebook do I get an error.
What can be the cause for this?

Issue implementing pandas_datareader module

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.

ModuleNotFoundError in Python - Colab

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.

Not able to import Localization library in python 3.7

I am trying to import Localization library in python 3.7 in Jupyter notebooks but everytime it shows this error:
ModuleNotFoundError
Traceback (most recent call last)
<ipython-input-6-ca0ae5a2ecfb> in <module>()
2 from skimage.measure import regionprops
3 import matplotlib.patches as patches
----> 4 import localization
~\Anaconda3\lib\site-packages\localization\__init__.py in <module>()
----> 1 from geoProject import *
ModuleNotFoundError: No module named 'geoProject'
I have no project named 'geoProject' either.
It is not your fault. geoProject seems to be another file in that project.
https://github.com/kamalshadi/Localization/blob/master/localization/geoProject.py
It is not being imported correctly inside the localization module at the __init__.py file

Categories

Resources