I installed python3 in my macOS through brew, I installed opencv and numpy, when I import cv2 and numpy I have this error
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
Traceback (most recent call last):
File "001.py", line 2, in <module>
import cv2
File "/usr/local/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module>
bootstrap()
File "/usr/local/lib/python3.7/site-packages/cv2/__init__.py", line 79, in bootstrap
import cv2
ImportError: numpy.core.multiarray failed to import
I fix the problem in this way:
I installed opencv using brew
brew install opencv
I installed opencv for python
pip install opencv-python
I removed (bad) numpy library
sudo rm -rf /usr/local/lib/python3.7/site-packages/numpy
I linked numpy library with working library
sudo ln -s /usr/local/Cellar/numpy/1.17.1/lib/python3.7/site-packages/numpy /usr/local/lib/python3.7/site-packages/numpy
Related
Following this official TF Guide: https://www.tensorflow.org/lite/guide/python
Tried this method as well: https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/raspberry_pi
However, I am stuck with the error ImportError: No module named tflite_runtime.interpreter.
In my py file I have
import tflite_runtime.interpreter as tflite.
Hardware: Raspberry Pi Zero 2 W
https://pypi.org/project/tflite-runtime was updated recently.
I think the following just work.
$ pip3 install tflite-runtime
Solution
pip3 install tflite-runtime
followed by
sudo apt-get install libatlas-base-dev
To avoid error: Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/numpy/core/__init__.py", line 22, in <module> from . import multiarray
I just updated Astropy to version 3.1.2. Now I'm trying to run a (previously working) Python 3 script that uses it, and it's failing with the following message:
Traceback (most recent call last):
File "./body-local.py", line 3, in <module>
from astropy.time import Time
File "/home/jimc/.local/lib/python3.6/site-packages/astropy/__init__.py", line 121, in <module>
_check_numpy()
File "/home/jimc/.local/lib/python3.6/site-packages/astropy/__init__.py", line 115, in _check_numpy
raise ImportError(msg)
ImportError: Numpy version 1.13.0 or later must be installed to use Astropy
My installed Numpy version is 1.16.2.
I had a bad Numpy installation. The solution was to repeatedly uninstall Numpy, as regular user and root, until no more installations were found, then reinstall:
pip3 uninstall numpy
sudo pip3 uninstall numpy
^ Until no more remain, then:
sudo pip3 install numpy
I have installed numpy on ubuntu. it works fine on terminal but when i want to import it to my working directory its shows me this error
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'numpy'
Try this:
sudo pip install numpy
Also this
sudo pip install spyder (numpy is included)
or
sudo easy_install numpy
I am unable to execute following
from PIL import Image
it returns me following:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "...\Anaconda3\lib\site-packages\PIL\Image.py", line 56, in <
module>
from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.
Currnetly using PIL version installed on anaconda 4.2.1. How to resolve this issue?
First, you can try:
conda update --all
If it doesn't help, this solution works for many people:
conda uninstall pillow
pip install pillow
Source: https://github.com/python-pillow/Pillow/issues/2945
The below shows me trying to run my code with a response that the MagickWand shared library is not found and that imagemagick library is not installed. So I try to install, but it shows it's already installed? Any advice for next steps to trouble shoot?
python /Users/osx/Downloads/pdf_manage/main.py
Traceback (most recent call last):
File "/Users/osx/Downloads/pdf_manage/main.py", line 3, in <module>
from src.pdf_utils import PdfUtils
File "/Users/osx/Downloads/pdf_manage/src/pdf_utils.py", line 5, in <module>
from wand.image import Image as WandImage
File "/usr/local/lib/python2.7/site-packages/wand/image.py", line 20, in <module>
from .api import MagickPixelPacket, libc, libmagick, library
File "/usr/local/lib/python2.7/site-packages/wand/api.py", line 206, in <module>
'Try to install:\n ' + msg)
ImportError: MagickWand shared library not found.
You probably had not installed ImageMagick library.
Try to install:
brew install freetype imagemagick
osx:~ osx$ brew install imageMagick
Warning: imagemagick 7.0.7-26 is already installed
osx:~ osx$ brew install freetype
Warning: freetype 2.9 is already installed
UPDATE- Running the below fixed my issue:
ln -s /usr/local/Cellar/imagemagick#6/6.9.9-38/lib/libMagickWand-6.Q16.dylib /usr/local/lib/libMagickWand.dylib