Cannot find reference 'ximgproc' in '__init__.py - opencv

i want to use cv2.ximgproc module.
this is add-on module at Opencv
but there is a problem to load module.
I tried pip install opencv-contrib-python but it doesn't work.
to be precise its already installed but can't not find cv2.ximgproc module.
import cv2
...
cv2.ximgproc.thinning( ... )
that's my import section.
So, I tried paste source file from OpenCV github
but there is only C++ source..
( sometimes .py file exist. but that is not file I need. )

It is just PyCharm Error.
PyCharm represents 'Can't find'.
but I Run my code, and its works well..

Related

module 'numpy' has no attribute 'object'

I am getting below error when running mlflow app
raise AttributeError("module {!r} has no attribute " AttributeError:
module 'numpy' has no attribute 'object'
Can someone help me with this
Since version 1.24 of numpy, np.object is deprecated, and needs to be replaced with object (cf. numpy release notes).
You either need to update this in your code, or another package you're using needs to be updated (not possible to answer without more information).
One (dirty) workaround for now would be to fix your numpy version to the last version still supporting np.object with pip install numpy==1.23.4
This error sometime occurs when an older version of numpy is been imported by other package, which does not have the 'object' attribute on it.
You can try the following:
Solution 1: pip install --upgrade numpy
Solution 2: Re-install numpy
pip uninstall numpy
pip install numpy
Solution 3 (if you are using conda package manager): conda update numpy
Last but not least, in case if you are running multiple version of python on your machine, you have to check which version of python your MLflow is using.
You can check that by running which pythonin command line and then make sure that the required version of numpy is installed.
The Python "AttributeError module 'numpy' has no attribute 'object'" occurs when we have a local file named numpy.py and try to import it from the numpy module. To solve the error, make sure to rename any local files named numpy.py.
Another way: Check that the file you are running was named numpy.py. If you have this problem check to make sure you don't have a file in the directory called numpy.py.
In most cases, rename your project local file numpy.py and delete numpy.pyc if it exists, then your project file script will run without an attribute error.
Easy way to check is to move the file with the import statement to a different directory and try running it.
Please check whether you have installed a newer pip updated numpy version.
Also check the similar SO for more information.

No Module Named PyQt5 and Pyside2 Error While Trying to open rqt

I've been trying to use the ROS(Robot Operating System) using this page:
Tutorial page
In the link it makes you use turtle sim it seemed to work fine with me without any errors.
In the 4th step(install rqt),i get this error:
`INPUT: RQT
OUTPUT: ImportError for 'pyqt': No module named 'PyQt5'
ModuleNotFoundError: No module named 'PyQt5'
ModuleNotFoundError: No module named 'PySide2'`
There was more lines of error but it seemed irrelevant to me because it only says file names.
I'm using python version 3.8.3 and qt version 5.12.12.
I downloaded the qt manually in their website.Didn't use:
pip install PyQt5
And i don't exactly remember now but someone said something about local files of pyhton but i had none of them:
screenshot of C:\Users\Boran\AppData\Local\Programs
It supposed to be Pyhton files in here.
Also there is no problem about python it works fine and i used talker and listener(pyhton coded applications of ROS.) and they worked fine.
I solved the problem by installing graphviz.It appears that to run rqt i had to install graphviz.

Anaconda - Manually adding a built package

I have build OpenCV (using cmake) and I can see the libs, include and bin files copied to my conda desired env. However, using conda list doesn't list the OpenCV. Is there a way to overcome this?
conda list will only show pip install or conda install installed packages.
To verify if OpenCV works, type below to check the version.
import cv2
print cv2.__version__
Hope this answer your question.

how to solve import error no module name cv in python?

i am running the python code but every time is showing
line 13,in
import cv2.cv as cv2
importerror: No module named cv
how to slove this problem,
i am using rPi 2 opencv-3.1.0 with python 2.7
If you have compiled opencv from source, link cv2.so from compiled directory to your python system directory (generally it is /usr/local/lib/python2.7/dist-packages/)
If not helpful, setup venv in your project directory and link cv2.so and cv.py from python system directory to your project directory.

Kivy Garden fails with error

I have downloaded the prepackaged Kivy zip file onto a Windows 8.1 machine and installed Kivy-Garden using pip (after running kivy.bat). However, I have been unable to successfully use Kivy-Garden. I have attempted the following commands:
garden install graph
garden list
However, neither of them work. They both result in the following error:
Traceback (most recent call last):
File "c:\kivy\Python27\Scripts\garden", line 5, in <module>
pkg_resources.run_script('Kivy-Garden==0.1.1', 'garden')
File "C:\Python27\lib\site-packages\pkg_resources.py", line 483, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 1335, in run_script
raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'garden'
Does this indicate a bad installation? How might I fix it?
Kivy for windows comes in a bundle with all the prerequisites to run, since some are hard to install in windows, so it's not using you installed python.
You should go to your kivy installation folder, inside you'll find the python folder, inside is the python descriptor used for kivy, you can run that python exe, or use pip or easy install (i don't remember if both), like an extra advice i could saw to use PyCharm to program, it's easy to install the python modules and code, i have it myself with SqlAlchemy instaled from the PyCharm Gui (previous config here Configure PyCharm and Kivy).
In the other hand you can configure kivy to run with your installed python (instructions here Kivy with an installed Python in Windows) i haven't tried myself since i use the same python included in kivy with no problems
I never figured out why pip wouldn't work, but I found a workaround.
Just download the package from pypi and run setup.py:
https://pypi.python.org/pypi/kivy-garden/0.1.1
The only workaround I've found that works is to manually install flowers into the kivy garden folder. Ceremcem has a great explanation of it here: filebrowser error in windows for kivy
Also I found I had to explicitly use pip2 for pip to work.

Resources