I have installed pycurl via pip on OS X 10.9. When I run python file with import pycurl python tells me next error:
ImportError:
dlopen(/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pycurl.so,
2): Symbol not found: _PyFile_AsFile Referenced from:
/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pycurl.so
Expected in: flat namespace in
/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pycurl.so
UPD: python3 installed via brew
Related
I'm trying to use OpenCV with Python but I'm continuously getting errors while importing. I'm using Anaconda virtual env and ZSH on Mac M1.
I have tried installing it using
conda install -c anaconda opencv
and pip3 install opencv-python
but I'm getting this error:
from .cv2 import * ImportError: dlopen(/Users/username/Library/Python/3.8/lib/python/site-packages/cv2/cv2.cpython-38-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/ffmpeg/lib/libavcodec.58.dylib Referenced from: /Users/username/Library/Python/3.8/lib/python/site-packages/cv2/cv2.cpython-38-darwin.so Reason: tried: '/opt/homebrew/opt/ffmpeg/lib/libavcodec.58.dylib' (no such file), '/usr/local/lib/libavcodec.58.dylib' (no such file), '/usr/lib/libavcodec.58.dylib' (no such file)
First you should make sure that ffmpeg is installed.
for me the issue was that the ffmpeg which I had installed by brew was named like ffmpeg#4 in opt/homebrew/opt/ so it couldn't find it.
I renamed the folder to ffmpeg and the issue was fixed.
I am trying to use a python package wptools. When I do I get this error:
import pycurl
ImportError: dlopen(/Users/c/.virtualenvs/j/lib/python3.8/site-packages/pycurl.cpython-38-darwin.so, 2): Library not loaded: #rpath/libssl.1.1.dylib
Referenced from: /Users/c/.virtualenvs/j/lib/python3.8/site-packages/pycurl.cpython-38-darwin.so
Reason: image not found
I have tried all kinds of things, such installing with brew install openssl. What is weird is when I open a terminal on my mac, which uses python 3.7.6, it works. But when I try it in a virtual env, which is 3.8.10, it does not work. Any ideas?
I have installed r2py via pip on a Mac OS.
python3 -m pip install rpy2
If I try to call it I get an error
import os
os.environ['R_HOME'] = '/Library/Frameworks/R.framework/Resources/bin/R'
from rpy2.robjects.packages import importr
OSError: cannot load library '/Library/Frameworks/R.framework/Resources/bin/R/lib/libR.dylib': dlopen(/Library/Frameworks/R.framework/Resources/bin/R/lib/libR.dylib, 2): no suitable image found. Did find:
/Library/Frameworks/R.framework/Resources/bin/R/lib/libR.dylib: stat() failed with errno=20
I am trying to import the module dnspython in a python 3.6 script using import dnspython.
pip3 freeze shows that the package is installed but I keep getting the error ModuleNotFoundError: No module named 'dnspython'
I have tried:
pip3 install dnspython
uninstalling and reinstalling with pip3
pip3 install git+https://github.com/rthalley/dnspython
Cloning the package from github and installing with sudo python setup.py install
pip3 install dnspython3 and using import dnspython3 in the script
Copying the dns folder of the cloned package in the site-packages folder
I am aware of this post for python 2.7 but none of the solutions worked.
The problem was import dnspython. Changing it into import dns worked fine.
Some test code:
import dns
result = dns.resolver.query('google.com', 'A')
for ipval in result:
print('IP', ipval.to_text())
# Output: IP {your ip}
It worked for me (Python 3.8.5):
pip install dnspython3
code:
import dns
from dns import resolver
result = resolver.resolve('google.com')
for ipval in result:
print('IP', ipval.to_text())
Python 3.5.1 |Anaconda 4.0.0 (x86_64)on OS X 10.11.3
>>> from sklearn import pipeline, model_selection
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'model_selection'
tried to:
upgrade six, sk-learn,
sudo pip uninstall python-dateutil
sudo pip install python-dateutil==2.2
pip2 install six -U
pip install --ignore-installed six
pip install --ignore-installed ipython
even reinstall the anaconda...
Did NOT fixed.
Thanks for help
_________Updata________
I have checked that my six version is the newest one (version = "1.10.0")
import sklearn
sklearn.version
'0.17.1'
I found that there is no folder name "model_selection" in sklearn folder. But there is this folder in https://github.com/scikit-learn/scikit-learn/tree/3078d7d611329c46777d4004a1185a3626558efe/sklearn.
After install the dev version by
$ pip install git+git://github.com/scikit-learn/scikit-learn.git
Successfully installed scikit-learn-0.18.dev0
And then run a script which runs successfully in 0.17.1, it shows error:
from .pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
ImportError: dlopen(/Users/Username/anaconda3/lib/python3.5/site-packages/sklearn/metrics/pairwise_fast.cpython-35m-darwin.so, 2): Library not loaded: libmkl_intel_lp64.dylib
Referenced from: /Users/Username/anaconda3/lib/python3.5/site-packages/sklearn/metrics/pairwise_fast.cpython-35m-darwin.so
Reason: image not found
What version of scikit-learn are you using? It looks like the latest, when I install for Python 3.5, is 0.17.1. Checking in the console:
import sklearn
sklearn.__version__
'0.17.1'
According to the documentation for this version that "model_selection" package doesn't exist. It does exist in the dev version. This should be why it is complaining.