no module named cv2 on exporting anaconda path - python

I have ubuntu 14.04 in which I installed OpenCV3 it works fine
then I installed anaconda(python). To make it work it said that I have to edit ~/.bashrc and export the anaconda path to it.
I changed to python 2.7.8 and it gives an error: no module named cv2 error.. and if I comment that line in .bashrc then python gets changed to 2.7.6 and the error disappears. What should I do ?
This is the error when I include the line in bashrc
Traceback (most recent call last):
File "test.py", line 7, in <module>
import cv2
ImportError: /home/aman/anaconda/bin/../lib/libm.so.6: version `GLIBC_2.15' `not found (required by /usr/lib/x86_64-linux-gnu/libxvidcore.so.4)

Try running conda remove system. This will remove the libm.so.6 file from Anaconda. See https://github.com/ContinuumIO/anaconda-issues/issues/182

Related

Import CV2: DLL load failed: The specified module could not be found while successful pip installation

I was working with Python 3.7 and OpenCV 4.2 in Pycharm IDE (Windows10). The system environment variables were changed by one of my co-workers by accident (we don't know what happened exactly). Then I found that my code did not work with this error!:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
Then I used this command:
pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip install opencv-python
All of them executed successfully, but when I write import cv2 the above error is appeared. By the way, the system knows command Python, it shows the right path to the python.exe. Moreover, commands like import numpy works correctly! How can I fix this problem?
I found the answer! There was an extra cv2.py file in site-packages/cv2 path. So, I removed it and the code worked

Anaconda Navigator does not open

I have installed Anaconda (which failed a few times) and removed it again. Then installed Miniconda and after several rounds succeeded. In Terminal 'condo list'gives a result.
However, I cannot open the Anaconda Navigator.
I would like to start using Spyder. Spyder is not found in Terminal.
I checked other questions on Stack Overflow about this but nothing seems to work.
(base) 192:~ lsluyser$ sudo anaconda-navigator
Password:
Traceback (most recent call last):
File "/anaconda3/lib/python3.7/site-packages/qtpy/__init__.py", line 199, in <module>
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/bin/anaconda-navigator", line 7, in <module>
from anaconda_navigator.app.main import main
File "/anaconda3/lib/python3.7/site-packages/anaconda_navigator/app/main.py", line 22, in <module>
from anaconda_navigator.utils.conda import is_conda_available
File "/anaconda3/lib/python3.7/site-packages/anaconda_navigator/utils/__init__.py", line 15, in <module>
from qtpy.QtGui import QIcon
File "/anaconda3/lib/python3.7/site-packages/qtpy/__init__.py", line 205, in <module>
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
I use a Mac Ox 10.9 and Python 3.7.
Thanks in advance for your help.
I too suffered the same multiple installation sequence as you mentioned on a Windows 10 machine.
Finally I removed a file named ".condarc" left over due to the incorrect uninstall.
The next installation of anaconda was successful in launching anaconda-navigator
but on a Mac with Homebrew installed I faced no such issues.Tip:"."Dot files are hidden on a Mac
I encountered a similar problem, I have Windows 7 installed as my OS.
Simple solution:
Uninstall Anaconda
Reinstall downloading the latest version
Before
opening the GUI, open the Conda Prompt & update all packages:
conda update --all
Now Open the GUI.
It worked for me.

CV2: Import Error in Python OpenCV

I have Anaconda installed in my system and I recently installed OpenCV 3.0.0 using the instructions given on this page. But when I open python and type import cv2, it throws me the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/ashutosh/anaconda2/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/lib/python2.7/site-packages/cv2.so)
I dont't know why am I getting this error. I also put the PYTHONPATH in the bashrc file, sourced it but nothing happened.
sudo apt-get install libgcc
This dependency caused the error.

Mac reinstall Python

I tried to use the Coursera course downloader from here and it worked for few courses but not all. They have recommended to use Python3.X. So I uninstalled Anaconda (version 2) from my Mac and installed Python3.5.1 from Python's website but still the course downloaders did not work as it was using default Python 2.7.
So I deleted Python from /usr/local/lib and now nothing is working. When I do which python it shows ``usr/local/bin/pythonand bothpythonandpython3` runs.
But when I do pip install coursera it throws error as follows:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
And when I do sudo easy_install pip, I get the following error.
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
try Homebrew http://brew.sh/
brew install python3
curl bootstrap.pypa.io/get-pip.py | python3
Your Mac should have Python 2 and Python 3 installed by default. in the terminal "python" will launch Python2, "python3" will launch Python3. With Anaconda you could have just kept the Python 2 version and created an environment for Python 3, http://conda.pydata.org/docs/using/envs.html#managing-environments.
This is the solution you will most likely need, No module named pkg_resources. Setuptools is causing the issue and you will need to wget ez_setup.py. Reinstalling Anaconda will save you a lot of time and pain.

Pylucene 4.9.0 Ubuntu 14.04 Installation ImportError

I've been trying to install Pylucene on my Mac for a little over a week, and have given up on that in favor of trying to install it with Ubuntu through a virtual machine. I thought the installation process had gone well, so I fired up Python in the terminal and tried to import lucene and received the following ImportError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/parallels/anaconda/lib/python2.7/site-packages/lucene/__init__.py", line 7, in <module>
import _lucene
ImportError: libverify.so: cannot open shared object file: No such file or directory
So, it looks like there is a module _lucene that does not exist. But I thought this would have been part of what I had just installed? Any insight here would be appreciated.
I had to add extra paths to my LD_LIBRARY_PATH environment variable to get things working. The test here in the conda build script actually shows those variables.
export LD_LIBRARY_PATH=$PREFIX/lib:$PREFIX/jre/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/jre/lib/amd64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/jre/lib/amd64/server:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/lib/python2.7/site-packages:$LD_LIBRARY_PATH
$PREFIX here is the path to the anaconda folder. I currently install miniconda at /usr/conda on my systems.

Categories