Python Setup Guide with Anaconda (by Christopher)

setup
#1

Hi,

this is a minimalistic setup (Windows) for CVBpy with Anaconda:

  1. Download Anaconda: https://www.anaconda.com/download/
  2. Install Anaconda (installing Visual Studio Code is also nice)
  3. (Download the new CVB Wrappers, may be included in future Versions of CVB:
    Common Vision Blox Add-ons). And install them.
  4. Setup a Python 3.6 Environment in conda (+ CVBpy):
    4.a. Open “Anaconda Prompt”
    4.b. Type “conda create -n py36 python=3.6 anaconda”.
    This will setup a python 3.6 enviroment. This may take a while.
    4.c. Type “activate py36”. This “selects” the Python 3.6 Environment.
    4.d. Change the folder of the prompt to %CVB%\Lib\Python
    4.e. Type “pip install <insert name of .whl file>”.
    Now you have Python 3.6 with CVBpy installed. Congratulations!

I don’t claim it’s the best way, but it works.

2 Likes
#2

We also deliver several Python examples with the .whl.
These can be found in the folder “%CVB%Tutorial<CVB Module of Interest>\CVBpy”.

With the current Release (Beginning of November 2018), CVBpy examples are in “%CVB%Tutorial\Image Manager\CVBpy”.

#3

Hi
Just in case someone else is looking for the “%CVB%Tutorial\CVBpy” examples. These are actually located under %\Tutorial\Image Manager\ CVBpy, at least for my installation.

2 Likes
#4

Hi @GTG ,
you are entirly correct. I missed the subfolders. Fixing my tutorial.

#5

I have a little problem for installing the CVB -python wrapper. I’ve CVB version 13.01.000 (64 bit) on my windows 10 computer, and I’ve download and installed the CVB binding preview installer of 64-bit version. I followed the instruction described as above and installed Python 3.6.8 using anaconda, and the installation of the .whl file seemed to be OK in the anaconda prompt. However, when I typed “import cvb” in the Spyder console, I got an error saying "
File “D:\ProgramData\Anaconda3\lib\site-packages\cvb_init_.py”, line 26, in
import _cvb

ImportError: DLL load failed: The specified module could not be found."
Any idea about how to solve this problem? Thank you in advance!

#6

Hi,
sorry for the late answer.
We assume your environment is somehow broken.

Could you give us the printout of …

#7

What I got after typing sys.path is given below:
[‘D:\ProgramData\Anaconda3\Lib\site-packages\cvb’,
‘D:\ProgramData\Anaconda3\DLLs’,
‘D:\ProgramData\Anaconda3’,
‘D:\Documents\Python’,
‘D:\ProgramData\Anaconda3\python36.zip’,
‘D:\ProgramData\Anaconda3\lib’,
‘’,
‘D:\ProgramData\Anaconda3\lib\site-packages’,
‘D:\ProgramData\Anaconda3\lib\site-packages\win32’,
‘D:\ProgramData\Anaconda3\lib\site-packages\win32\lib’,
‘D:\ProgramData\Anaconda3\lib\site-packages\Pythonwin’,
‘D:\ProgramData\Anaconda3\lib\site-packages\IPython\extensions’,
‘C:\Users\lxu\.ipython’]

One thing I discovered using a software called “dependency walker” for “_cvb.pyd” is that there are lots of DLLs associated with Microsoft Vision Studio are missing.


The full list of missing DLL files is too long to be added directly here.
But maybe that is not needed. I can add that I’ve the following Visual Studio related programs installed:
Microsoft Visual Studio Code (User) Version 1.33.1
Microsoft Visual Studio Installer, Version 1.18.1089.1204
Microsoft Visual Studio C++ 2013 Redistributable (x64)-12.0.30501
Microsoft Visual Studio C++ 2013 Redistributable (x64)-12.0.40660
Microsoft Visual Studio C++ 2013 Redistributable (x86)-12.0.40660
Microsoft Visual Studio C++ 2017 Redistributable (x64)-14.16.27024
Microsoft Visual Studio C++ 2017 Redistributable (x86)-14.16.27024

Maybe you can suggest what additional Microsoft Visual Studio C++ Redistributables I shall install in order to make it work. Thank you in advance!

#8

Hi,

are you certain, that you are using the correct environment, i.e. py36 like above?
What i see in your case is the default environment:

Anconda default env (i.e. Python Version 3.Whatever):
‘C:\ProgramData\Anaconda3\python37.zip’,
‘C:\ProgramData\Anaconda3\DLLs’,
‘C:\ProgramData\Anaconda3\lib’,
‘C:\ProgramData\Anaconda3’,
‘C:\ProgramData\Anaconda3\lib\site-packages’,
‘C:\ProgramData\Anaconda3\lib\site-packages\win32’,
‘C:\ProgramData\Anaconda3\lib\site-packages\win32\lib’,
‘C:\ProgramData\Anaconda3\lib\site-packages\Pythonwin’,
‘C:\ProgramData\Anaconda3\lib\site-packages\IPython\extensions’,
‘C:\Users\chartmann\.ipython’

New env “py36”:
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\python36.zip’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\DLLs’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\lib’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\lib\site-packages’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\lib\site-packages\cvb’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\lib\site-packages\win32’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\lib\site-packages\win32\lib’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\lib\site-packages\Pythonwin’,
‘C:\Users\chartmann\AppData\Local\conda\conda\envs\py36\lib\site-packages\IPython\extensions’,
‘C:\Users\chartmann\.ipython’

Are you certain you started “Spyder (py36)” (i.e. Spyder in the new environment) instead of “Spyder”?

#9

Yes, I am sure about it and I am using python 3.6.8, as I installed it specifically by using “conda install python=3.6” in the anaconda prompt. If I type “python -V” in the anaconda prompt, I get "Python 3.6.8 :: Anaconda custom (64-bit) ". Whenever I started Spyder, it always print “Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]”, so it cannot be this reason which you suggested.

#10

Hi,

not quite. The step 4.b will create a fresh python environment.
For example if i type:
“conda create -n x1 python=3.6 anaconda”
“conda create -n x2 python=3.6 anaconda”
“conda create -n x3 python=3.6 anaconda”
Then i will get 3 totally separate python 3.6 environments (plus your initial Python env, which might also be 3.6).

Another way to determine this: Type “conda info --envs” in any anaconda prompt
base * C:\ProgramData\Anaconda3
py36 C:\Users\chartmann\AppData\Local\conda\conda\envs\py36
I.e. if your current environment seems to be “base”.

#11

Yes, you are right that python 3.6 is my base environment.
If I run “conda info --envs” , I have the list as below:
base * D:\ProgramData\Anaconda3
pyconda D:\ProgramData\Anaconda3\envs\pyconda

“pyconda” is what I set for python 3.5 because I have packages which can only run with python 3.5 there.

#12

I finally solved the problem by adding cvb to windows environment path, as I find that except all false alarms of missing windows API by the outdated “Dependency Walker” program it also reported about the missing of “CVCIMG.DLL”, “CVCDRIVER.DLL”, “CVCUTILITIES.DLL” and “CVGENAPI.DLL” files which are obviously in the main directory of CVB program.

#13

Hello,

this is odd, they should have been loadable after cvb installation.
Yeah, dependency walker always had issues system libs.

#14

Dependency walker has been out of maintenance for years and unfortunately does not do a very good job with the system DLLs lately (basically those stored in the WinSxS folder are always marked as missing even though the DLL loader will have no problem finding them).