I've already installed python3 on my computer.
when I started a new Jupyter notebook I selected python 3
but now on the notebook, it is saying it isn't there
when I run this:
print(python_version())
i get this error:
NameError Traceback (most recent call last)
in
----> 1 print(python_version())
NameError: name 'python_version' is not defined
python_version() function is from platform module; So you have to import it first:
import platform
print(platform.python_version())
Another way to check python version is sys module:
import sys
print(sys.version)
Related
I installed pattern3 in the cmd with: pip install pattern3
and it was successful I also installed in the jupyter notebook and still it was successful.
However, when I try to import it with import patterns I get this error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_2116/1948699844.py in <module>
----> 1 import patterns
ModuleNotFoundError: No module named 'patterns'
I think you have made a typo. The import statement for the pattern3 module would be import pattern3, not import patterns.
If you have installed the pattern3 module correctly, you should be able to import it by using the new statement.
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?
I'm regularly importing Matplotlib Numpy PySide2 in Atom. They unexpectedly cannot be import for an unknown reason and then appear to be again re-importable, again unexplained.
When trying to import matplotlib with the following command
import matplotlib.pyplot as plt
This scripts runs without problems when I run in a Jupyter notebook or through the Terminal. But When trying to run on Hydrogen in Atom, I get the following error message:
File "<ipython-input-3-3dc8365ef973>", line 6
ModuleNotFoundError: No module named 'matplotlib.backends'; 'matplotlib' is not a package
^
SyntaxError: invalid syntax
I get the same error with Pyside2 when trying to run the line
from PySide2.QtWidgets import QApplication, QLabel
I get the error message
ModuleNotFoundError: No module named 'PySide2.QtWidgets'; 'PySide2' is not a package
Here is the path of python (after having typed which python in the Terminal): /anaconda3/bin/python
I checked that the matplotlib is installed by running the command conda list in the Terminal and got (among all the other packages) those lines:
matplotlib 2.1.2 py36h6d6146d_0
matplotlib 2.2.2 <pip>
PySide2 5.9.0a1.dev1525348214
I tried to run the following command in the Terminal but didn't solve the problem
sudo apt-get install python3-matplotlib
sudo pip3 install matplotlib
I had a similar issue with numpy when trying to import import numpy. Although import numpy was not a problem an hour ago, I get now the following error message (it seems it wants to connect to a previously used script in which numpy was used, to open numpy itself):
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-592c151f282b> in <module>()
1 # from numpy import genfromtxt as gft
----> 2 import numpy
~/Downloads/numpy.py in <module>()
----> 1 from numpy import genfromtxt
2 my_data = genfromtxt('/Users/mymac/Documents/PyQt/image_viewer/csv_file_generator/eggs.csv',
3 delimiter=',',
4 dtype=None,
5 encoding=None)
ImportError: cannot import name 'genfromtxt'
I had the same issue when tryin to import opencv2: I got the following error message:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
ImportError: numpy.core.multiarray failed to import---------------------------
------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-8f6675581547> in <module>()
5 from PySide2.QtCore import *
6 from PySide2.QtGui import *
----> 7 import cv2
8 import numpy
9 import csv
ImportError: numpy.core.multiarray failed to import
I visited the following site which didn't help me (or I didn't understand how to implement exactly the steps to fix the problem)
ImportError: No module named matplotlib.pyplot
Importing matplotlib.pyplot in atom editor
matplotlib Error: No module named matplotlib even though it is installed
I'm running on/with
python 3.6.5
macOS 10.13.4
Atom 1.27.0 x64
Hydrogen 2.4.1
I'm trying to import zipline.transforms, but the output message says No module named transforms. I'm using python2.7 and downloaded zipline via conda.
from zipline.transforms import batch_transforms
ImportErrorTraceback (most recent call last)
<ipython-input-55-253f85965feb> in <module>()
----> 1 from zipline.transforms import batch_transform
ImportError: No module named transforms
First, is your IDE (pycharm or sublime) included Anaconda in the path? Second, please check where you zipline module was installed, usually .../lib/python2.7/site-packages/zipline, does it include a module called "transforms"? maybe it's an old module, not in the updated zipline anymore.
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.