This question already has answers here:
Python csv import fails
(2 answers)
Closed 1 year ago.
i don't know why i get this error even i installed correctly the libraries:
Traceback (most recent call last):
File "D:/Doc/Diagnostic-Technology/Browser.py", line 4, in <module>
import scipy.stats as stat
File "D:\Doc\Diagnostic-Technology\scipy\__init__.py", line 61, in <module>
from numpy import show_config as show_numpy_config
ImportError: cannot import name 'show_config'
packages wich i imported :
import pandas as pd
import numpy as np
import scipy.stats as stat
import math as math
help please!
I have the same problem and solved it this way
find any file named as "numpy.py" in your script directory and change it into another name.
delete any file named as "numpy.pyc" or any other file generated while compiling your code.
Related
This question already has answers here:
No module named 'matplotlib.pyplot'; 'matplotlib' is not a package
(5 answers)
Why I receive ModuleNotFoundError, while it is installed and on the sys.path?
(1 answer)
Closed 1 year ago.
Can somebody help me with this problem?
Python recognises matplotlib from the command line:
import matplotlib
matplotlib.__version__
'3.4.3'
But not from a script
This is my script (to keep it simple):
import matplotlib.pylab as plt
import numpy as np
These are the errors:
Traceback (most recent call last):
File "C:/Program Files/Python39/Scripts/matplotlib.py", line 1, in <module>
import matplotlib.pylab as plt
File "C:\Program Files/Python39/Scripts\matplotlib.py", line 1, in <module>
import matplotlib.pylab as plt
ModuleNotFoundError: No module named 'matplotlib.pylab';
'matplotlib' is not a package
Try Reinstalling the package or downgrading it to a more stable version like 2.02
This question already has answers here:
Why can't I import from a module alias?
(4 answers)
Closed 2 years ago.
Let's suppose I import the pathlib module with an alias :
import pathlib as plib
Then plib is now pointing to the pathlib module :
>>> plib
<module 'pathlib' from '/usr/lib/python3.8/pathlib.py'>
Now can someone tell me why importing something from this aliased module doesn't work?
>>> from plib import Path
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'plib'
The loading process of The module is not based on the alias, it searches the python installation or project directory by the given name after import statement.
I am sorry for asking this question again, but I could not find any answer to my problem that helped me. I don't have much experience with python. I use python version 3.6.8 on Windows and I have already installed matplotlib, numpy and scipy. The 'pylab.py' file is also contained in the matplotlib folder. Edit: Using matplotlib.pyplot also doesn't work.
Edit: After some more trials I got the error that the module 'six.names" could not be found. The six package has been installed.
import pylab
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pylab
ModuleNotFoundError: No module named 'pylab'
import matplotlib.pyplot
Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
import matplotlib.pyplot
File "C:\...\Python36-32\lib\matplotlib\pyplot.py", line 30, in <module>
from cycler import cycler
File "C:\...\Python36-32\lib\cycler\cycler.py", line 48, in <module>
from six.moves import zip, reduce
ModuleNotFoundError: No module named 'six.moves'
Per https://matplotlib.org/faq/usage_faq.html#matplotlib-pyplot-and-pylab-how-are-they-related, pylab is not recommended; you should use pyplot instead.
The correct way to import either is
import matplotlib.pyplot # use this
import matplotlib.pylab # only if you cannot avoid it
(pyplot and pylab are not standalone modules, but submodules of matplotlib.)
This question already has answers here:
Installing scipy in Python 3.5 on 32-bit Windows 7 Machine
(4 answers)
Closed 7 years ago.
I ran this command from scipy.integrate import odeint but I get the errors below. I am new to python. I have installed scipy and numpy but I don't have any idea what more is missing to run this. Please help.
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
from scipy.integrate import odeint
File "C:\Python34\lib\site-packages\scipy\integrate\__init__.py", line 51, in <module>
from .quadrature import *
File "C:\Python34\lib\site-packages\scipy\integrate\quadrature.py", line 6, in <module>
from scipy.special.orthogonal import p_roots
File "C:\Python34\lib\site-packages\scipy\special\__init__.py", line 601, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
you need to install the Numpy from the following link which has Numpy+MKL build linked to the IntelĀ® Math Kernel Library.
link: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
This question already has answers here:
Importing installed package from script with the same name raises "AttributeError: module has no attribute" or an ImportError or NameError
(2 answers)
Closed 6 years ago.
I have a Python script that uses requests. It worked fine for a long time. Now out of the blue I get the following error. I tried reinstalling requests but that didn't fix it. The only thing I can think of that caused the error is I have been running a Django development server, so maybe I got hacked? Please help.
code:
import requests
...
error:
Traceback (most recent call last):
File "myfile.py", line 1, in <module>
import requests
File "/Users/myuser/.virtualenvs/mysite/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>
from . import utils
File "/Users/myuser/.virtualenvs/mysite/lib/python2.7/site-packages/requests/utils.py", line 12, in <module>
import cgi
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cgi.py", line 50, in <module>
import mimetools
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mimetools.py", line 6, in <module>
import tempfile
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in <module>
from random import Random as _Random
ImportError: cannot import name Random
You have masked the built-in library module with a local file named random.py. Rename that file.
Python looks up modules to import along a path, and if you put a module in a location that's looked at before the standard library, you can end up masking a built-in like you did here.