I am facing some import error....But cv2 was succesfully installed in my mac....Pls provide some solution
This is my code
import cv2
img=cv2.imread("galaxy.jpg",1)
print(img)
This is output
akshitdudeja#Akshits-MacBook-Air Sec-17 % python3 script.py
Traceback (most recent call last):
File "/Users/akshitdudeja/VS Code/main_folder/UDEMY/Sec-17/script.py", line 1, in <module>
import cv2
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/__init__.py", line 180, in <module>
bootstrap()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/__init__.py", line 152, in bootstrap
native_module = importlib.import_module("cv2")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so, 0x0002): tried:
'/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so' (mach-o file, but is an incompatibl
e architecture (have 'arm64', need 'x86_64')), '/usr/lib/cv2.cpython-310-darwin.so' (no such file)
Related
After installing dependencies I typed "brownie" to make sure that everything was installed successfully but instead I got an error. (Any comments/help appreciated)Will attach the code below:
injusstice#Justices-MacBook-Pro ~ % brownie
Traceback (most recent call last):
File "/Users/injusstice/.local/bin/brownie", line 5, in <module>
from brownie._cli.__main__ import main
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/__init__.py", line 6, in <module>
from brownie.project import compile_source, run
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/project/__init__.py", line 3, in <module>
from .main import ( # NOQA 401
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/project/main.py", line 44, in <module>
from brownie.network import web3
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/network/__init__.py", line 4, in <module>
from .account import Accounts
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/network/account.py", line 37, in <module>
from .rpc import Rpc
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/network/rpc/__init__.py", line 16, in <module>
from brownie.network.state import Chain
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/network/state.py", line 23, in <module>
from .transaction import TransactionReceipt
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/brownie/network/transaction.py", line 15, in <module>
import black
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/black/__init__.py", line 13, in <module>
import regex as re
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/regex/__init__.py", line 1, in <module>
from .regex import *
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/regex/regex.py", line 419, in <module>
import regex._regex_core as _regex_core
File "/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/regex/_regex_core.py", line 21, in <module>
import regex._regex as _regex
ImportError: dlopen(/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/regex/_regex.cpython-38-darwin.so, 2): no suitable image found. Did find:
/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/regex/_regex.cpython-38-darwin.so: code signature in (/Users/injusstice/.local/pipx/venvs/eth-brownie/lib/python3.8/site-packages/regex/_regex.cpython-38-darwin.so) not valid for use in process using Library Validation: Trying to load an unsigned library
I'm trying things out on windows vs linux where I have this working in 3.8 and 3.9.5, but not on windows using anaconda
import sys
sys.path.append("../")
from datetime import time
import pandas as pd
import pandas_market_calendars as mcal
error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\pandas_market_calendars\__init__.py", line 19, in <module>
from .calendar_registry import get_calendar, get_calendar_names
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\pandas_market_calendars\calendar_registry.py", line 21, in <module>
from .exchange_calendars_mirror import *
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\pandas_market_calendars\exchange_calendars_mirror.py", line 9, in <module>
import exchange_calendars
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\__init__.py", line 16, in <module>
from .calendar_utils import (
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\calendar_utils.py", line 3, in <module>
from .always_open import AlwaysOpenCalendar
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\always_open.py", line 5, in <module>
from .exchange_calendar import ExchangeCalendar
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\exchange_calendar.py", line 27, in <module>
from .calendar_helpers import (
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\calendar_helpers.py", line 6, in <module>
NP_NAT = np.array([pd.NaT], dtype=np.int64)[0]
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NaTType
'
Posted a github bug
indeed something changed and the culprit is pandas
https://github.com/rsheftel/pandas_market_calendars/issues/137
to solve, install pandas==1.2.5 and it will work
The error is with the underlying exchange_calendars package (https://github.com/gerrymanoim/exchange_calendars). It appears that error has been fixed in that package. If you update the exchange_calendars package everything will work fine. Nothing to do in this package.
Fix: gerrymanoim/exchange_calendars#41
my python version is 3.7.2
windows version is Windows 7 Ultimate Service pack 1
pyshark version is 0.4.2.2
LXML version is 4.3.2
Issue :- "import pyshark " alone is resulting me in the following errors
Traceback (most recent call last):
File "C:/Users/ab/RJS2.py", line 1, in <module>
import pyshark
File "C:\Users\ab\PycharmProjects\RJS\venv\lib\site-packages\pyshark\__init__.py", line 13, in <module>
from pyshark.capture.live_capture import LiveCapture
File "C:\Users\ab\PycharmProjects\RJS\venv\lib\site-packages\pyshark\capture\live_capture.py", line 5, in <module>
from pyshark.capture.capture import Capture
File "C:\Users\ab\PycharmProjects\RJS\venv\lib\site-packages\pyshark\capture\capture.py", line 7, in <module>
import logbook
File "C:\Users\ab\PycharmProjects\RJS\venv\lib\site-packages\logbook\__init__.py", line 14, in <module>
from .base import (
File "C:\Users\ab\PycharmProjects\RJS\venv\lib\site-packages\logbook\base.py", line 22, in <module>
from logbook.helpers import (PY2, cached_property, integer_types, iteritems,
File "C:\Users\ab\PycharmProjects\RJS\venv\lib\site-packages\logbook\helpers.py", line 60, in <module>
from http import client as http_client
File "C:\Users\ab\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 71, in <module>
import email.parser
File "C:\Users\ab\email.py", line 1, in <module>
import smtplib
File "C:\Users\ab\AppData\Local\Programs\Python\Python37-32\lib\smtplib.py", line 47, in <module>
import email.utils
ModuleNotFoundError: No module named 'email.utils'; 'email' is not a package
Process finished with exit code 1
I installed anaconda 4.3.0 for OSX, Python 3.6. Everything with the install seemed to go fine. However when I try to start jupiter notebook I get:
Traceback (most recent call last):
File "/Users/joe/anaconda3/bin/jupyter-notebook", line 4, in <module>
import notebook.notebookapp
File "/Users/joe/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 63, in <module>
from .services.contents.manager import ContentsManager
File "/Users/joe/anaconda3/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 16, in <module>
from nbformat import sign, validate, ValidationError
File "/Users/joe/anaconda3/lib/python3.6/site-packages/nbformat/__init__.py", line 33, in <module>
from .validator import validate, ValidationError
File "/Users/joe/anaconda3/lib/python3.6/site-packages/nbformat/validator.py", line 12, in <module>
from jsonschema import ValidationError
File "/Users/joe/anaconda3/lib/python3.6/site-packages/jsonschema/__init__.py", line 18, in <module>
from jsonschema.validators import (
File "/Users/joe/anaconda3/lib/python3.6/site-packages/jsonschema/validators.py", line 8, in <module>
import requests
File "/Users/joe/anaconda3/lib/python3.6/site-packages/requests/__init__.py", line 52, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/Users/joe/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 47, in <module>
import OpenSSL.SSL
File "/Users/joe/anaconda3/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/joe/anaconda3/lib/python3.6/site-packages/OpenSSL/crypto.py", line 13, in <module>
from cryptography.hazmat.primitives.asymmetric import dsa, rsa
File "/Users/joe/anaconda3/lib/python3.6/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py", line 14, in <module>
from cryptography.hazmat.backends.interfaces import RSABackend
File "/Users/joe/anaconda3/lib/python3.6/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 1423, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
When I try to run conda I get
Traceback (most recent call last):
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 617, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 85, in _main
from ..base.context import context
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 17, in
from .._vendor.auxlib.path import expand
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/_vendor/auxlib/path.py", line 8, in
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 1423, in
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/joe/anaconda3/bin/conda", line 6, in
sys.exit(conda.cli.main())
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 167, in main
return conda_exception_handler(_main, *args)
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 633, in conda_exception_handler
print_unexpected_error_message(e)
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 543, in print_unexpected_error_message
from conda.base.context import context
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/base/context.py", line 17, in
from .._vendor.auxlib.path import expand
File "/Users/joe/anaconda3/lib/python3.6/site-packages/conda/_vendor/auxlib/path.py", line 8, in
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 1423, in
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
I did a simple remove and reinstall but the problem persists after the reinstall. I would try to run anaconda-clean but since conda does not work, I can't install it. Any advice?
I installed caffe from source code on my Mac os x, but when I type this command:
python -c "import caffe"
I got this error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/pycaffe.py", line 15, in <module>
import caffe.io
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/io.py", line 8, in <module>
from caffe.proto import caffe_pb2
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/proto/caffe_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "/Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/descriptor.py", line 46, in <module>
from google.protobuf.pyext import _message
ImportError: dlopen(/Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so, 2): Symbol not found: __ZNK6google8protobuf10TextFormat17FieldValuePrinter10PrintBytesERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Referenced from: /Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so
Expected in: flat namespace
in /Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so
Any suggestion will be appreciated:)
Thanks in advance
Make sure that the Python path is pointing to $CAFFE_HOME/Python