Import error when using scipy.io module - python

I'm involved in a raspberry pi project and I use python language. I installed scipy, numpy, matplotlib and other libraries correctly. But when I type
from scipy.io import wavfile
it gives error as "ImportError: No module named scipy.io"
I tried to re-install them, but when i type the sudo cord, it says already the new version of scipy is installed. I'm stucked in this point and please help me... Thank you

I would take a guess and say your Python doesnt know where you isntalled scipy.io. add the scipy path to PYTHONPATH.

Related

matplotlib.pyplot giving error 'ImportError: No module named Tkinter' on python 2.7

I'm using a remote machine for computation and data analysis. I don't have sudo access in this machine, for data analysis purposes I want to use python libraries such as vtk etc since pip is not installed in this machine, I set up a 'virtual-environment' and install VTK there,
I used the method explained here (https://stackoverflow.com/a/13958308/10755782). Then I could install vtk in the virtual environment using pip.
But now the problem is that I can't import matplotlib.pyplot, it is giving me the error
ImportError: No module named Tkinter.
This error is strange because matplotlib.pyplot works in this particular system outside my virtual-environment. There are a few workarounds to start using matplotlib.pyplot without tkinter such as this (https://stackoverflow.com/a/49988926/10755782), but this is not helpfull in my case as this machine is remote-accessed and I need 'tkinter' to view the graphs on my screen.
I tried installing 'tkinter' inside my virtual-env, but I could not ( since we can't install 'tkinter' with pip and I don't have sudo access).
As I could not find any immediate solution to this problem anywhere I tried to fix this myself and I did the following,
inside my virtual environment, the version of matplotlib was 2.2.4 and outside it was 1.2.0 ( which is working fine). So I downgraded the version of matplotlib inside my virtual environment to 1.2.0
pip install 'matplotlib==1.2.0' --force-reinstall
now I have the same version of matplotlib inside and outside the virtual env. But now, when I try import matplotlilb.pyplot as plt I'm getting the error
ImportError: /b/home/ipcms/rcheenik/Python_virt-env/python2.7/my_new_env/lib/python2.7/site-
packages/matplotlib/_cntr.so: undefined symbol: _intel_fast_memset
Is there any way to fix this ^^ error? any of these following will be able to help me.
without OR is there any way to install tkinter without sudo ? or inside the 'virtual-environment' ?
OR is there any alternatives to matplotlib.pyplot which works without 'tkinter' and still display graphs remotely? ( not favourable, as I have to rewrite the entire code )
Thanks in advance for the help.
I found this answer to a similar question however, which I believe would solve your issue.
https://stackoverflow.com/a/49988926/8775307
It imports matplotlib.pyplot without tkinter. I don't know if all the features are actually included though, so you'll have to test and let us know :).
You could always write to the administrator and request Tkinter - it's a widely used and useful package, so they might be willing to include it.

why doesn't python 3.6.1 recognize numpy or pil or skimage after they have been successfully installed

I am getting these errors trying to run a python3 program in itelliJ IDEA on a mac.
import numpy as np
ModuleNotFoundError: No module named 'numpy'
from PIL import Image, ImageChops
ModuleNotFoundError: No module named 'PIL'
from skimage.feature import match_template # requires numpy, scipy, and six
ModuleNotFoundError: No module named 'skimage'
All of these modules have been successfully installed using pip3. I have confirmed the installs using IDLE. Clearly, it seems, there is more to it than simply installing, but I don't know what it is.
I cannot find anything that addresses concerns on python.org. They, in fact, refer me to Stackoverflow. The closest I found here dealt with numpy and python2.7 on mac. There are no responses to that one.
Look in the Preferences for the Project Interpreter setting, and make sure it's pointing to the right python version.
Secondly, since you're already using and IDE use PyCharm. It's IntelliJ's python specific IDE, and it'll have better documentation on python specific technical problems.

ImportError for NumPy/SciPy

I am trying to run some code that requires importing NumPy and SciPy (I'm using Python 3.4), but I keep getting the following message (my OS is Windows):
import numpy as np # used for linear algebra
ImportError: No module named 'numpy'
I have already downloaded NumPy but I don't know how to set it up correctly. Is there any way to fix this? I've been having this error for a while already.
Update: I found the solution. Apparently I had already downloaded both Anaconda (a distribution of Python) and Python, so I deleted both of them and installed back Anaconda, rebooted the computer and now everything works perfectly (can use NumPy and SciPy).

VTK installation Python : Canopy

I have installed VTK on Canopy but when I try to run a VTK Python program, it throws me Error:
import vtkpython
ImportError: No module named 'vtkpython
Can Someone tell me Why I am getting this error.
To use VTK's python wrapper, import vtk, not "vtkpython".
Better yet, use tvtk or Mayavi's mlab interface rather than using the "raw" vtk library directly.
Otherwise, using VTK is going to feel very "unpythonic".

python: ImportError: No module named patheffects

When i try to run a python script in which i do an import statement matplotlib.patheffects, i get an error message saying there is no module called patheffects.
the statement is
import matplotlib.patheffects
Kindly help me to figure out the reason for this error and how to make the code run without this glitch.
import matplotlib.patheffects works perfectly well for me. Please make sure you have matplotlib installed. The most current version is 1.0.1. You can download from here.
Matplotlib depends on numpy, so make sure you have it installed before installing matplotlib.
Also check out the tips on installing matplotlib.

Categories

Resources