i have tried several times to import matplotlib and remove reinstall all of the possible combinations
i am using conda as package management system, and pip points to conda
trying to run following programm:
import matplotlib.pyplot as plt
or just:
import matplotlib
creates following result:
Traceback (most recent call last):
File "C:/Users/Name/IdeaProjects/zzArchiv/Robot project/RobotProject/DeepLearning/approaches/hvasstutorial/anothermain.py", line 22, in <module>
import matplotlib.pyplot as plt
File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 127, in <module>
from . import cbook
File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 2640, in <module>
class _StringFuncParser(object):
File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 2652, in _StringFuncParser
_funcs['quadratic'] = _FuncInfo(np.square,
AttributeError: module 'numpy' has no attribute 'square'
i googled a lot and searched left and right, but couldn't get any working solutions (most tell to remove and reinstall numpy/matplotlib which i did several times) please help, if you have any clues
thanks
Related
To speed up certain resource-intensive Python functions, I'm using Cython. However, after using cython, I've seen that importing the matplotlib.pyplot module takes more than 2-3 minutes, whereas importing just "matplotlib" is instant. I'm guessing Cython messed up some matplotlib.pyplot operations. After importing matplotlib.pyplot if I hit ctrl+c I receive an error as
>>> import matplotlib.pyplot
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/raghvender/.local/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2230, in <module>
switch_backend(rcParams["backend"])
File "/home/raghvender/.local/lib/python3.8/site-packages/matplotlib/__init__.py", line 672, in __getitem__
plt.switch_backend(rcsetup._auto_backend_sentinel)
File "/home/raghvender/.local/lib/python3.8/site-packages/matplotlib/pyplot.py", line 225, in switch_backend
current_framework = cbook._get_running_interactive_framework()
File "/home/raghvender/.local/lib/python3.8/site-packages/matplotlib/cbook/__init__.py", line 89, in _get_running_interactive_framework
if not _c_internal_utils.display_is_valid():
KeyboardInterrupt
To me it appears that it is stuck in some cbook module. I tried removing cython module, reinstalling matplotlib but none of them worked. I'd appreciate it if someone could tell me where these two packages are interfering.
PS : I need Cython to perform some heavy calculation.
I have a simple python program which I am running on a Mac machine.
import numpy as np
def main():
print("np arr test")
arr = np.array([1.0, 2.0, 3.0])
print(arr)
if __name__ == "__main__":
main()
I've verified that the numpy library was correct installed through pip
pip3 list | grep numpy
msgpack-numpy 0.4.4.3
numpy 1.16.2
numpydoc 0.8.0
I get the following error when I run the program
Traceback (most recent call last):
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/core/__init__.py", line 24, in <module>
from . import multiarray
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/core/multiarray.py", line 14, in <module>
from . import overrides
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Volumes/workplace/RPAsosDevelopmentWS/src/RPAsosDevelopmentPy/src/rp_asos_development_py/adhoc_dev/float_nan_test.py", line 1, in <module>
import numpy as np
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/Volumes/brazil-pkg-cache/packages/Python-numpy/Python-numpy-1.x.140450.0/AL2012/DEV.STD.PTHREAD/build/lib/python3.6/site-packages/numpy/core/__init__.py", line 50, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.6 from "/usr/local/bin/python3.6"
* The NumPy version is: "1.18.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
Process finished with exit code 1
Can you please help me figure out what I am missing? Appreciate your response!
NOTE : Based on the stack overflow post I updated the numpy through the following command
pip3 install numpy --upgrade
pip3 list | grep numpy
msgpack-numpy 0.4.4.3
numpy 1.21.2
numpydoc 0.8.0
WARNING: You are using pip version 21.2.1; however, version 21.2.4 is available.
However I still see the error message
Try to uninstall numpy and install it again.
I'm trying to run the tool vispr in able to visualize the results of the mageck-vispr run.
I have installed everything as explained on the website within a conda environment.
Unfortunately, when running the command
vispr server results/GSC.vispr.yaml
it throws an error
Traceback (most recent call last):
File "/fs/home/yeroslaviz/miniconda3/bin/vispr", line 6, in <module>
from vispr.cli import main
File "/fs/home/yeroslaviz/miniconda3/lib/python3.7/site-packages/vispr/__init__.py", line 12, in <module>
from vispr.results import Screens, Screen
File "/fs/home/yeroslaviz/miniconda3/lib/python3.7/site-packages/vispr/results/__init__.py", line 15, in <module>
from vispr.results import rna
File "/fs/home/yeroslaviz/miniconda3/lib/python3.7/site-packages/vispr/results/rna.py", line 14, in <module>
from pandas.io.common import EmptyDataError
ImportError: cannot import name 'EmptyDataError' from 'pandas.io.common' (/fs/home/yeroslaviz/miniconda3/lib/python3.7/site-packages/pandas/io/common.py)
From what I could find online, this exception might happens, when trying to read an empty file, but all the entries listed in the called GSC.vispr.yaml file exists and are not empty.
I would appreciate it, if someone can help me narrow down the problem or offer a solution.
thanks
I am not sure if the solution I have found is the right one, but all I did is to comment out line 14 in rna.py
import pandas as pd
# from pandas.io.common import EmptyDataError
import numpy as np
Now vispr is working.
This is my error traceback:
Traceback (most recent call last):
File "D:\My projects\aaa.py", line 1, in <module>
import matplotlib.pyplot as plt
File "C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\matplotlib\__init__.py", line 138, in <module>
from . import cbook, rcsetup
File "C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\matplotlib\rcsetup.py", line 28, in <module>
from cycler import Cycler, cycler as ccycler
File "C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\cycler.py", line 46, in <module>
import six
File "D:\My projects\six.py", line 2, in <module>
import matplotlib.pyplot as plt
File "C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\matplotlib\pyplot.py", line 30, in <module>
from cycler import cycler
ImportError: cannot import name 'cycler' from 'cycler' (C:\Users\SHREYANSH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\cycler.py)
I tried it after reinstalling matplotlib but nothing works please help.
Ouch! I found out what was happening. I was naming my sample work as one, two, three, etc. and I also had a file "six.py". Make sure you don't have a file named six.py in your path.
In my case it was a privilege problem, I have uninstall cycler and matplotlib by:
sudo pip uninstall cycler matplotlib
and than install them again with:
pip3 install matplotlib
and it works fine, I hope that could help.
Try to install 'cycler' then install 'matplotlib'
pip install cycler
pip install matplotlib
I can successfully get the cv2 version from command line:
>>> import cv2
>>> cv2.__version__
'3.4.4'
But not when I run a script with that code in the Python 3.7.1 Shell (see image here)
import cv2
print (cv2.__version__)
Traceback (most recent call last):
File "B:\Users\Ravi\Desktop\Opencv2\cv2.py", line 1, in <module>
import cv2
File "B:\Users\Ravi\Desktop\Opencv2\cv2.py", line 2, in <module>
print (cv2.__version__)
AttributeError: module 'cv2' has no attribute '__version__'
How can I solve this problem? Not only the version but none of cv2 code works.