OpenCV installation on Anaconda Windows ImportError - python-2.7

I try to install OpenCV but it doesn't work, I get import error:
from conda.cli.main import main
ImportError: No module named conda.cli.main

Related

ImportError: No module named cv2 on macox

I have used homebrew to install OpenCV, but I cannot use it, when I import OpenCV in Python, I meet this error:
ImportError: No module named cv2; op
system:macos10.12.6
opencv 3.3.0_2
python 2.7.13

ImportError: No module named data_io

l'm under python2.7 l can't import data_io l got this error :
ImportError: No module named data_io
Here is my code
import data_io
reload(data_io)
data = data_io.read_as_df(basename)
Have you run the command?
pip install dataIO
If so are you sure it is install in the right directory? Please provide more details on your pathenv.

Error while importing LXML

I was importing "from docx import Document".
This gave an error
File "", line 1, in File
"/usr/local/lib/python2.7/site-packages/docx.py", line 17, in
from lxml import etree ImportError: /usr/local/lib/python2.7/site-packages/lxml-3.7.0-py2.7-linux-i686.egg/lxml/etree.so:
undefined symbol: gcry_check_version
Same error I am getting while trying to install lxml.
Python Version: 2.7, OS: CentOS release 5.8
Libcrypt Issue
Try:
LD_PRELOAD=/usr/lib/libgcrypt.so
export LD_PRELOAD
This should fix it

Python/pyserial cx_freeze Compilation error: no module named tools

I am trying to compile a python code with cx_freeze in Windows 7, python 2.7, but it keeps giving me trouble because of pyserial. I tried to import the pyserial tools module in many different ways but I keep getting compilation errors:
import serial
import serial.tools
from serial.tools import list_ports
#I also tried:
#import serial.tools.list_ports
#from serial import tools
#import serial.tools.list_ports
#from serial import tools
The error message varies between:
ImportError: No module named tools
and
ImportError: No module named tools.list_ports
Any ideas on how to solve this issue? Thanks.

Error importing theano "cannot import name gof"

I am current getting the error
ImportError: cannot import name gof
when importing theano.
>>> import theano
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import theano
File "C:\Python27\lib\site-packages\theano\__init__.py", line 63, in <module>
from theano.compile import (
File "C:\Python27\lib\site-packages\theano\compile\__init__.py", line 9, in <module>
from theano.compile.function_module import *
File "C:\Python27\lib\site-packages\theano\compile\function_module.py", line 16, in <module>
from theano import gof
ImportError: cannot import name gof
I am using python 2.7.10 (). Theano is installed using pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git.
Hope to get you suggestion to solve this problem
Most of the time, when I see this error, it is caused by those 2 errors:
1) A syntax error in Theano. Update Theano and make sure to have no local modifcation. I nerver saw this error in the master of Theano, but just in case.
2) When there is multiple version of Theano that are installed.
In both case, remove all version of Theano. Do it multiple time to be sure there is none left. Then install again.
From memory, this always solved the problem when it wasn't a syntax error during development (but not in the master version of Theano that you use)
This ImportError can be caused because Theano is unable to compile the gof module itself. If this is the case, you will see an error message that looks like "Exception: Compilation Failed (return status=1): C:\Long\Path\...\mod.cpp:1: sorry, unimplemented: 64-bit mode not compiled in".
Fixing With Conda
If you are installing theano into a conda environment, make sure that you have a C compiler available to that environment.
The command
conda install m2w64-toolchain
will provide a C compiler to your environment that's isolated from the rest of the machine.
After the m2w64-toolchain package is installed, import theano should work
Fixing Manually
If you are installing Theano yourself, two points from these threads may help:
Install the bleeding edge version of Theano
Install libpython from http://www.lfd.uci.edu/%7Egohlke/pythonlibs/
I assume you're using Windows 7 or later.
If you have installed Python Anaconda, then open Windows Powershell or Command Prompt and type conda install mingw libpython before typing pip install theano
Alternatively, if you don't have Anaconda, download those packages from
anaconda.org/anaconda/mingw/files
anaconda.org/anaconda/libpython/files
github.com/Theano/Theano
Then open Command Prompt, navigate to each folder and type python setup.py install
Now run Python and import theano
Possible errors:
If you get the RuntimeError: "To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement" then
Go to Control Panel > System > Advanced system settings and select "Environment Variables".
In the "System variables" section, make a new variable name MKL_THREADING_LAYER and set its value to GPU
If you get other kinds of errors, then try the following:
Make an empty file called .theanorc (a file extension without a file name) in your home folder C:\Users\<username>. If you get the error "You must type a file name" then see stackoverflow.com/q/5004633
Open .theanorc and write this:
[global]
cxx=C:\<path to Anaconda>\Anaconda3\MinGW\bin\g++.exe
Run Python again and import theano. If it works, then you can probably delete .theanorc
In my case, the fix was to install a python build that's callable as a shared library:
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 2.7.15