I am in the process of setting up my m1 pro max laptop. I have downloaded python, and I am installing all the required libs through pip. I am having problems installing open 3d lib.
When I run this:
import sys
print(sys.version)
import platform
print(platform.platform())
import numpy as np
import open3d as o3d
print("Load a ply point cloud, print it, and render it")
pcd = o3d.io.read_point_cloud("data/bun315.ply")
print(pcd)
print(np.asarray(pcd.points))
o3d.visualization.draw_geometries([pcd])
I get this error:
3.9.1 (v3.9.1:1e5d33e9b9, Dec 7 2020, 12:44:01)
[Clang 12.0.0 (clang-1200.0.32.27)]
macOS-12.5.1-arm64-arm-64bit
Traceback (most recent call last):
File "/Users/abdelnasser/Desktop/point clouds/bunny/hello.py", line 8, in <module>
import open3d as o3d
File "/Users/abdelnasser/Library/Python/3.9/lib/python/site-packages/open3d/__init__.py", line 97, in <module>
from open3d.cpu.pybind import (camera, data, geometry, io, pipelines,
ImportError: dlopen(/Users/abdelnasser/Library/Python/3.9/lib/python/site-packages/open3d/cpu/pybind.cpython-39-darwin.so, 0x0002): Library not loaded: '/opt/homebrew/opt/libomp/lib/libomp.dylib'
Referenced from: '/Users/abdelnasser/Library/Python/3.9/lib/python/site-packages/open3d/cpu/pybind.cpython-39-darwin.so'
Reason: tried: '/opt/homebrew/opt/libomp/lib/libomp.dylib' (no such file), '/usr/lib/libomp.dylib' (no such file)
I have searched up the error but nothing has worked. Not sure why its trying homebrew, I downloaded it to see try some things but ended up removing it from my laptop.
When trying to install the open 3d lib I have had no issues with intel and m2 air laptop, but for some reason its not working on this laptop.
brew install libomp solves the problem.
Related
I am new to python, I was trying to import some libraries.
import sys
import cv2
import face_recognition
import pickle
But, I get this error in VS Code. When I run the same thing on PyCharm CE, It doesn't even recognize the module cv2. I know, I have installed opencv-python, but the issue still persists.
Traceback (most recent call last):
File "/Users/vedantamohapatra/Downloads/Face Detection/embedding.py", line 3, in <module>
import face_recognition
File "/opt/homebrew/lib/python3.9/site-packages/face_recognition/__init__.py", line 7, in <module>
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "/opt/homebrew/lib/python3.9/site-packages/face_recognition/api.py", line 4, in <module>
import dlib
File "/opt/homebrew/lib/python3.9/site-packages/dlib/__init__.py", line 19, in <module>
from _dlib_pybind11 import *
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/_dlib_pybind11.cpython-39-darwin.so, 0x0002): tried: '/opt/homebrew/lib/python3.9/site-packages/_dlib_pybind11.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_dlib_pybind11.cpython-39-darwin.so' (no such file), '/usr/lib/_dlib_pybind11.cpython-39-darwin.so' (no such file)
I tried searching for this error but didn't find any working solution. Is this something which can't be solved now due to the architecture? As I got a (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) error in there too. I am using M1 Mac Monterey 12.1.
On a side node, If this issue is unresolved, can anyone please point out any alternative for this, like would Google Colab be fine?
I am not sure if this would work for your system too but this is what worked for me. I had PyCharm installed so I used its default Python Package installer located at the bottom left of the window and then added the required packages. This method not only solved the issue of the code not running in PyCharm but my code ran in the terminal too.
I think this might be due to conflicting Python versions installed in the Mac and the Terminal Package installer is installing it in different directory that which is used by the compiler during execution. This might be due to improper transition from Python 2 to Python 3 in Mac I feel.
If I find a more general fix to this I will update the answer.
I have installed matplotlib-1.5.0.win-amd64-py2.7 from sourcefourge.net after downloading and installing numpy using commandprompt by using pip: pip install numpy. But when I write the following code it Gives me error. Help me out.
Code:
from matplotlib.pylab import *
pylab.plot([1,2,3,4],[1,2,3,4])
pylab.show()
It gives me following error message:
Traceback (most recent call last):
File "C:\Python27\Lib\idlelib\1.py", line 1, in <module>
from matplotlib.pylab import *
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 124, in <module>
from matplotlib.rcsetup import (defaultParams,
File "C:\Python27\lib\site-packages\matplotlib\rcsetup.py", line 25, in <module>
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
File "C:\Python27\lib\site-packages\matplotlib\fontconfig_pattern.py", line 25, in <module>
from pyparsing import Literal, ZeroOrMore, \
ImportError: No module named pyparsing
There is an easy and complete guide on the Matplotlib Website.
Try and follow this one.
refer to this answer of mine
https://stackoverflow.com/a/38618044/5334188
install numpy
pip install numpy
If you face installation issues for numpy, get the pre-built windows installers from http://www.lfd.uci.edu/~gohlke/pythonlibs/ for your python version (python version is different from windows version).
numpy 32-bit: numpy-1.11.1+mkl-cp27-cp27m-win32.whl
numpy 64-bit: numpy-1.11.1+mkl-cp27-cp27m-win_amd64.whl
Later you require VC++ 9.0, then please get it from below link Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
Then install matplotlib using
pip install matplotlib
If you face errors, please download below from http://www.lfd.uci.edu/~gohlke/pythonlibs/, which will do the rest.
32-bit: matplotlib-1.5.3-cp27-cp27m-win32.whl
64-bit: matplotlib-1.5.3-cp27-cp27m-win_amd64.whl
works like charm
I'm using Kivy on Mac OS X. I installed opencv under Kivy's virtualenv. But then when I tried
import cv2
it gave me this Import Error:
Traceback (most recent call last):
File "", line 1, in
ImportError: dlopen(/Applications/Kivy.app/Contents/Resources/venv/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: lib/libopencv_reg.3.1.dylib
Referenced from: /Applications/Kivy.app/Contents/Resources/venv/lib/python2.7/site-packages/cv2.so
Reason: image not found
But if I move to: cd /path/to/opencv/build
then run python and import cv2, it works fine.
It looks like Python couldn't find the library files from the build/lib directory.
Everything looked fine during the cmake bulding and installation process. What am I missing here?
Thank you!!
I am attempting to import scipy.optimize using Python 3.3.1 on Windows 8. I am using scipy-0.12.0. When I attempt to import, Python returns the following error:
>>> import scipy.optimize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python33\lib\site-packages\scipy\optimize\__init__.py", line 146, in
<module>
from .optimize import *
File "C:\Python33\lib\site-packages\scipy\optimize\optimize.py", line 34, in <
module>
from .linesearch import \
File "C:\Python33\lib\site-packages\scipy\optimize\linesearch.py", line 16, in
<module>
from scipy.optimize import minpack2
ImportError: DLL load failed: The specified module could not be found.
I believe this is an operating system error because importing scipy.optimize succeeds when using the same version of Python and scipy on a Windows 7 machine.
I would greatly appreciate any assistance.
Thanks.
It may be a problem with using an incompatible version of Numpy. We solved this problem on a computer at work by using a Numpy-MKL build from Christoph Gohlke's website. This solved our problems on Windows 8 computers, because the builds for Scipy from his website require the Numpy MKL build.
I really encourage you to Install SciPy and NumPy with one these packages:
Python(x,y)
Anaconda
Enthought
Other wise you will end up with all the strange error because these packages mainly based on C libraries that they need to be compiled and usually standard Windows installation doesn't have the right compiler.
When I try to import the slycot module in spyder (version 2.2), I get the following error:
RuntimeError: module compiled against API version 7 but this version of numpy is 6
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/slycot/__init__.py",
line 4, in <module>
from slycot.analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, ab09ad
File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/slycot/analysis.py",
line 21, in <module>
from slycot import _wrapper
ImportError: numpy.core.multiarray failed to import
Now, when I import slycot in the python shell through my terminal, there are no problems at all. I think the reason why there are no problems through the terminal, is that I recently installed numpy 1.7.1. Spyder on the other hand still uses numpy 1.6.2.,hence the error.
I tried to change the numpy version in spyder, but so far that didn't work.
When I change the numpy(6) folder in my spyder lib with the recently installed numpy(7), I get the following error (in spyder):
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python intepreter from there.
What is the best way to solve this error?
Thanks in advance.
(Spyder dev here) At the moment it's not possible for the user to install anything inside the app. I guess you moved your slycot module from another interpreter to our App (because of the numpy error you mention).
The right way to use different modules not present in the app, is to change the path of your interpreter in:
Tools > Preferences > Console > Advanced settings > Python executable
If you installed slycot using your system Python, you have to select
/usr/bin/python