# "no module named cvb" bei "import cvb"

**URL:** <https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016>\
**Category:** Programming Questions\
**Tags:** python\
**Created:** [January 13, 2020, 10:54am UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016 "2020-01-13T10:54:04Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![raphy](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@raphy](https://forum.commonvisionblox.com/u/raphy)\
**Post date:** [January 13, 2020, 10:54am UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/1 "2020-01-13T10:54:04Z")

</div>

Wenn ich den Code aus C:\CVB\Tutorial\Polimago\CvbPy\classification.py geladen und wollte es ausfürhen. Dann kommt die Fehlermeldung:  
ModuleNotFoundError: No module named ‘cvb’

---

<div class="post-metadata">

**Author:** ![Phil](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/phil/32/544_2.png) [@Phil](https://forum.commonvisionblox.com/u/Phil)\
**Post date:** [January 13, 2020, 12:49pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/2 "2020-01-13T12:49:41Z")

</div>

Hi,  
did you install the python wheely for CvB?  
Check these two tutorials in case you have not:  
[https://forum.commonvisionblox.com/t/getting-started-with-cvbpy/241](https://forum.commonvisionblox.com/t/getting-started-with-cvbpy/241)

[https://forum.commonvisionblox.com/t/python-setup-guide-with-anaconda-by-christopher/580](https://forum.commonvisionblox.com/t/python-setup-guide-with-anaconda-by-christopher/580)

Please note that the pip installation works not only for conda but also for regular python. No need to use conda.

---

<div class="post-metadata">

**Author:** ![c.hartmann](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/c.hartmann/32/247_2.png) [@c.hartmann](https://forum.commonvisionblox.com/u/c.hartmann)\
**Post date:** [January 13, 2020, 1:43pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/3 "2020-01-13T13:43:15Z")

</div>

@raphy  
errr i have to update my tutorial … installing/downloading the wrapper (separatly) is no longer required.

---

<div class="post-metadata">

**Author:** ![Phil](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/phil/32/544_2.png) [@Phil](https://forum.commonvisionblox.com/u/Phil)\
**Post date:** [January 13, 2020, 2:07pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/4 "2020-01-13T14:07:53Z")

</div>

But the wheely still needs to be installed via pip to be able to load the module in python.

---

<div class="post-metadata">

**Author:** ![c.hartmann](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/c.hartmann/32/247_2.png) [@c.hartmann](https://forum.commonvisionblox.com/u/c.hartmann)\
**Post date:** [January 13, 2020, 2:09pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/5 "2020-01-13T14:09:22Z")

</div>

Yes. Step 3 in my tutorial is no longer required. Somehow i can’t edit the topic.

---

<div class="post-metadata">

**Author:** ![aftab](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aftab](https://forum.commonvisionblox.com/u/aftab)\
**Post date:** [February 10, 2021, 2:55pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/6 "2021-02-10T14:55:36Z")

</div>

Hey Everyone,

I got stuck in a very wired situation. I know this is problem with pythonpath and required some linux expertise but I would be thankful if anyone could help me.

So, I am trying to perform image acquisition on Nvidia agx on startup. Normally, If ran the python script from terminal it works fine, you can see the system path that cvb is located and the image acquisition is working perfectly:

```auto
import sys
print(str(sys.path))

```

```auto
['/home/agx/Documents/CVBDATA', '/home/agx/catkin_ws/devel/lib/python2.7/dist-packages', '/opt/ros/melodic/lib/python2.7/dist-packages', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/agx/.local/lib/python3.6/site-packages', '/home/agx/.local/lib/python3.6/site-packages/cvb', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.6/dist-packages', '/home/agx/.local/lib/python3.6/site-packages/cvb']

```

As you can see, cvb is located in the system path, similar is also for python3.6.

However, when I tried to run this python script from bash terminal on system boot going through systemd service and all the long process) I am getting the error, this is the piece of command that I am using to invoke the python script:

```auto
nohup python3 /usr/local/bin/final.py &

```

Error:

```auto
Traceback (most recent call last):
Feb 10 11:26:11 agx lidarCameraData_acquisition.sh[18925]: File "/usr/local/bin/final.py", line 7, in <module>
Feb 10 11:26:11 agx lidarCameraData_acquisition.sh[18925]: import cvb
Feb 10 11:26:11 agx lidarCameraData_acquisition.sh[18925]: ModuleNotFoundError: No module named 'cvb'

```

This is the system path for above (I logged it during the script execution), you can see the cvb is there but still it complains, you can see the above error logs:

```auto
['/home/agx/Documents/CVBDATA', '/home/agx/catkin_ws/devel/lib/python2.7/dist-packages', '/opt/ros/melodic/lib/python2.7/dist-packages', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/agx/.local/lib/python3.6/site-packages', '/home/agx/.local/lib/python3.6/site-packages/cvb', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.6/dist-packages', '/home/agx/.local/lib/python3.6/site-packages/cvb']

```

Even I tried with -m option but no success. Nevertheless, I am getting the following errors

```auto
/usr/bin/python3: No module named /usr/local/bin/final

/usr/bin/python3: Error while finding module specification for '/usr/local/bin/final.py' (ModuleNotFoundError: No module named '/usr/local/bin/final

```

Any help would be appreciated,

Regards,  
Aftab

---

<div class="post-metadata">

**Author:** ![aftab](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aftab](https://forum.commonvisionblox.com/u/aftab)\
**Post date:** [February 10, 2021, 3:06pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/7 "2021-02-10T15:06:51Z")

</div>

Hey, I was able to find the culprit, the CVB is installed for local user agx and not for root the cvb (root is running the process so it make sense that it should in the path).

I became root and tryied to run:

```auto
python3 -c 'import cvb'

```

and was getting the same error.

Now I want to ask a small question, how can I change the current installation that cvb is visible to all users on the system.

Regards,  
Aftab

---

<div class="post-metadata">

**Author:** ![c.hartmann](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/c.hartmann/32/247_2.png) [@c.hartmann](https://forum.commonvisionblox.com/u/c.hartmann)\
**Post date:** [February 10, 2021, 3:21pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/8 "2021-02-10T15:21:43Z")

</div>

Hi @aftab,

1. The installation of CVB is always available for all users. See /opt/cvb/. The required env vars are exposed to each user (but not root).
2. What you actually want is to install the python package as root (i.e. **sudo** python3 -m pip install \<.whl\>). Then it should be available to all users (mind the python path again). You may have to uninstall the whl first.

---

<div class="post-metadata">

**Author:** ![c.hartmann](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/c.hartmann/32/247_2.png) [@c.hartmann](https://forum.commonvisionblox.com/u/c.hartmann)\
**Post date:** [February 10, 2021, 3:22pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/9 "2021-02-10T15:22:35Z")

</div>

Is “root” a proper user?

---

<div class="post-metadata">

**Author:** ![aftab](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aftab](https://forum.commonvisionblox.com/u/aftab)\
**Post date:** [February 10, 2021, 3:40pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/10 "2021-02-10T15:40:49Z")

</div>

Hey,

Thank you @c.hartmann .

Yes, the root is a proper user.

I tried to add ` /home/agx/.local/lib/python3.6/site-packages` to the path using

```auto
import sys
sys.path.append(......)

```

But no I am getting this error now **CVB Environment variable not set**.

Regards,  
Aftab

---

<div class="post-metadata">

**Author:** ![c.hartmann](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/c.hartmann/32/247_2.png) [@c.hartmann](https://forum.commonvisionblox.com/u/c.hartmann)\
**Post date:** [February 10, 2021, 4:54pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/11 "2021-02-10T16:54:11Z")

</div>

Hi @aftab,

this is what i feared :-), but it’s not hard to fix.

As a normal user type: `env | grep -i cvb`. Those are the missing env vars.

Should print a list like this:

```auto
CVB=/opt/cvb
GENICAM_GENTL64_PATH=/opt/cvb/drivers/genicam
CVGENICAM_REGISTRY=/var/opt/cvb/Registry
GENICAM_CACHE_V3_1=/var/opt/cvb/genicam
CVBDATA=/var/opt/cvb
CVBCONFIG=/etc/opt/cvb

```

Essentially the root user must have these as well (either via export before calling python or some other way).

---

<div class="post-metadata">

**Author:** ![aftab](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aftab](https://forum.commonvisionblox.com/u/aftab)\
**Post date:** [February 11, 2021, 12:02pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/12 "2021-02-11T12:02:07Z")

</div>

Hey @c.hartmann,

Thank you so much. I tried to add the env and export it that you have mentioned to the bashrc of the root but I am still getting the same erro **CVB Environment variable not set**.

Any idea why its happening and what would you recommend?? either to remove cvb and install with sudo. Normally if I become a root and try to run in the terminal I am not getting this error.

Regards,  
Aftab

---

<div class="post-metadata">

**Author:** ![c.hartmann](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/c.hartmann/32/247_2.png) [@c.hartmann](https://forum.commonvisionblox.com/u/c.hartmann)\
**Post date:** [February 11, 2021, 12:14pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/13 "2021-02-11T12:14:07Z")

</div>

No the cvb enviroment variable not set affect the cvb installation, not the installation of the cvb python module.

---

<div class="post-metadata">

**Author:** ![c.hartmann](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/c.hartmann/32/247_2.png) [@c.hartmann](https://forum.commonvisionblox.com/u/c.hartmann)\
**Post date:** [February 11, 2021, 12:14pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/14 "2021-02-11T12:14:57Z")

</div>

if you login as “root” and type “env | grep -i cvb” what is your output.

---

<div class="post-metadata">

**Author:** ![aftab](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aftab](https://forum.commonvisionblox.com/u/aftab)\
**Post date:** [February 11, 2021, 12:59pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/15 "2021-02-11T12:59:45Z")

</div>

Hey @c.hartmann

I get the following output:

```
CVB=/opt/cvb
GENICAM_GENTL64_PATH=/opt/cvb/drivers/genicam
CVGENICAM_REGISTRY=/var/opt/cvb/Registry
GENICAM_CACHE_V3_1=/var/opt/cvb/genicam
CVBDATA=/var/opt/cvb
CVBCONFIG=/etc/opt/cvb

```

I think I have to give up nohup. Without nohup it is working but I have to source the /root/.bashrc.

---

<div class="post-metadata">

**Author:** ![s-woe](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/s-woe/32/572_2.png) [@s-woe](https://forum.commonvisionblox.com/u/s-woe)\
**Post date:** [February 11, 2021, 1:46pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/16 "2021-02-11T13:46:52Z")

</div>

Hi @aftab ,

Are you using virtual environments?  
You may try to start from uninstalling CVB via the “uninstall\_cvb.sh” from the zipped installer folder. Also remove cvb wheel by executing `python3 -m pip uninstall cvb`.  
Verify, that there is no such folder or file starting with “cvb” inside the directories containing “site-packages” or “dist-packages”, listed when executing `python3 -m site`! If this is the case, delete everything reminding you of cvb.

Then start off from scratch and execute all the steps with the same user:

1. Install CVB via the provided script (install\_cvb.sh).
2. Verify, that afterwards the variables @c.hartmann mentioned are set, if not, do so.
3. Go to `$CVB/python`
4. Execute (without sudo) `python3 -m pip install cvb*.whl`
5. Look into the folders (either conaining “site-package” or “dist-packages” listed when executing `python3 -m site`
6. If you cannot find any folder or file with “cvb” in the name go to X)
7. Check `python3 -c "import cvb"`

X) Please collect some setup information:

- platform, architecture, OS version
- CVB release
- python release
- a short introduction into your task

Send that information to [this adress](mailto:de.support@stemmer-imaging.com) with a short reference to this thread.

---

<div class="post-metadata">

**Author:** ![aftab](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@aftab](https://forum.commonvisionblox.com/u/aftab)\
**Post date:** [February 11, 2021, 1:48pm UTC](https://forum.commonvisionblox.com/t/no-module-named-cvb-bei-import-cvb/1016/17 "2021-02-11T13:48:57Z")

</div>

Hey @s-woe,

Thank you so much for your time. I will follow your instruction and get back to you.

Regards,  
affi
