# Cannot create tracker

**URL:** <https://forum.opencv.org/t/cannot-create-tracker/738>\
**Category:** Python\
**Created:** [January 8, 2021, 1:56pm UTC](https://forum.opencv.org/t/cannot-create-tracker/738 "2021-01-08T13:56:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![j.eslava](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@j.eslava](https://forum.opencv.org/u/j.eslava)\
**Post date:** [January 8, 2021, 1:56pm UTC](https://forum.opencv.org/t/cannot-create-tracker/738/1 "2021-01-08T13:56:54Z")

</div>

Hello,  
I have a working code. I developed it on my Win10 computer then ported it to a Ubuntu machine. Everything works on my computer but I cannot create any of the trackers on the Ubuntu computer. When I execute

> tracker = cv2.TrackerBoosting\_create()

I see this error message:

> Traceback (most recent call last):  
> File “\<stdin\>”, line 1, in \<module\>  
> AttributeError: module ‘cv2.cv2’ has no attribute ‘Tracker\_create’

My computer:  
Win10, Python3.8.5, Opencv4.0.1, Opencv-contrib-python4.4.0.46

Other computer:  
Ubuntu16.04, Python3.6.9, Opencv-contrib-python 4.5.1.48

I have no idea about why I cannot create the tracker on the Ubuntu machine.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [January 8, 2021, 3:15pm UTC](https://forum.opencv.org/t/cannot-create-tracker/738/2 "2021-01-08T15:15:02Z")

</div>

> [@j.eslava](#):
>
> Opencv4.0.1, Opencv-contrib-python4.4.0.46

how did you install any of that ?

if it was via pip, make sure to install **only** opencv-contrib-python (NOT opencv-python) else the latter will “shadow” the former, and you cannot use the contrib extra functionality

---

<div class="post-metadata">

**Author:** ![j.eslava](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@j.eslava](https://forum.opencv.org/u/j.eslava)\
**Post date:** [January 8, 2021, 3:35pm UTC](https://forum.opencv.org/t/cannot-create-tracker/738/3 "2021-01-08T15:35:10Z")

</div>

I installed them with pip3. I work in a python3 virtual environment. I uninstalled both opencv and opencv contrib and installed again opencv-contrib-python with pip3. now

> print(cv2.\__version_\_)

shows 4.5.1. But when I run

> pip3 show opencv

I see this warning:

> WARNING: Package(s) not found: opencv

I believe there is something wrong with my virtual environment but I see the correct opencv version when I print it in my python script. This confuses me. I have Opencv-contrib-python4.4.0.46 on my windows machine. But I have this problem on the Ubuntu machine. Everything works on the Windows machine.

**EDIT:** On my win10 computer I created a new conda environment and installed the latest opencv-contrib-python with pip. I see the same error message when I try to create the tracker in the new environment. There is no problem with opencv-contrib-python ver. 4.4.0.46.

---

<div class="post-metadata">

**Author:** ![ieliz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ieliz/32/86_2.png) [@ieliz](https://forum.opencv.org/u/ieliz)\
**Post date:** [January 11, 2021, 8:07am UTC](https://forum.opencv.org/t/cannot-create-tracker/738/4 "2021-01-11T08:07:45Z")

</div>

Hi! I think your problems with the latest version of the opencv-contrib-python can be related to changes in tracking API:

> **[opencv/opencv\_contrib](https://github.com/opencv/opencv_contrib/compare/37315babf9984a5b6aa981644a20dd8df1a5ff02...b91a781cbc1285d441aa682926d93d8c23678b0b)**
>
> re/37315babf9984a5b6aa981644a20dd8df1a5ff02...b91a781cbc1285d441aa682926d93d8c23678b0b

I tried to use Win10, Python 3.8.5, opencv-contrib-python==4.4.0.46, and all works fine.  
Please, use the 4.4.0.46 version for now and keep watching for changes in tracking API:

> <https://github.com/opencv/opencv/issues/18481>
>
> Tracking API
> Author: Ilya Elizarov
> Link: #18481
> Status: Draft
> Platforms: All
> Complexity: N/A
> Introduction and Rationale
> The main goal of this proposal is the renewal of the tracking...

and changes of opencv-python:

> **[skvark/opencv-python](https://github.com/skvark/opencv-python)**
>
> Automated CI toolchain to produce precompiled opencv-python, opencv-python-headless, opencv-contrib-python and opencv-contrib-python-headless packages.

🙂  
Also, the **pip show open-contrib-python** command should work, instead of **pip3 show opencv**.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [January 11, 2021, 10:39am UTC](https://forum.opencv.org/t/cannot-create-tracker/738/5 "2021-01-11T10:39:12Z")

</div>

indeed, latest changes to the tracking api seem a bit messy.

while

```
        TrackerCSRT
        TrackerGOTURN
        TrackerKCF
        TrackerMIL

```

behave as expected (they were moved into the main opencv repo), we now have:

```
        legacy_MultiTracker
        legacy_Tracker
            legacy_TrackerBoosting
            legacy_TrackerCSRT
            legacy_TrackerKCF
            legacy_TrackerMIL
            legacy_TrackerMOSSE
            legacy_TrackerMedianFlow
            legacy_TrackerTLD

```

(from `>>>help(cv2)`)

when using latest 4.5.1, please try:

```
tracker = cv2.legacy.TrackerBoosting_create()
```

---

<div class="post-metadata">

**Author:** ![ieliz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/ieliz/32/86_2.png) [@ieliz](https://forum.opencv.org/u/ieliz)\
**Post date:** [January 11, 2021, 10:58am UTC](https://forum.opencv.org/t/cannot-create-tracker/738/6 "2021-01-11T10:58:22Z")

</div>

Working for me with Win10, opencv-contrib-python last version and Python 3.8.5.
