AttributeError: 'module' object has no attribute 'sift' - linux

I want to use sift() in python &openCV
here is my environment:
python:2.7.6
os:ubuntu 14.04
opencv:2.4.9
After several hours hard-work, now i seem to successfully install opencv,because i can do as below:
import cv2
print cv2.version ---- 2.4.9
now my problem is that when i want to call cv2.sift(),it says AttributeError: 'module' object has no attribute 'sift'
If i download opencv_contrib from github and use cmake -DOPENCV_EXTRA_MODULES_PATH=/modules , the compiling will fail , it says:
Module opencv_xfeatures2d disabled because opencv_shape dependency can't be resolved!
someone else even says the opencv_contrib can only work with opencv3
then how can i solve this problem? I need your help~

Related

Why I can't use pytoch on spyder?

I am using Windows 10 OS, Python Version - 3.8
Installed Method - conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
It was successfully installed, when trying to run torch.cuda.is_available() throws up an error as -
AttributeError: partially initialized module 'torch' has no attribute 'cuda' (most likely due to a circular import)
I faced this error other importing such as -torch.nn as nn-
I checked the package list (!pip list ) it is present
Why I can't use pytoch on spyder ? How to tackle this problem ?
I think you have a file named torch.py in your working directory
Please rename it to something else

'SalesforceBulk' object has no attribute 'post_bulk_batch'

I'm trying to run a bulk job in salesforce. After creating job and prepared csv_iterator through my data, when i ran this
batch = bulk.post_bulk_batch(job, csv_iterator)
I'm getting the error stating
AttributeError: 'SalesforceBulk' object has no attribute 'post_bulk_batch'
I've installed salesforce_bulk in python2 and 3 as well. Tried in both versions, but same error.
Why is this happens. How to rectify this issue? Thanks in advance.
UPDATE:
I have installed the version salesforce-bulk==1.1.0
Now it is working in python2 but in python3 this is what happening
from salesforce_bulk import SalesforceBulk
ImportError: cannot import name 'SalesforceBulk'
Is there no support for python 3 to do salesforce bulk job process?
Found it! In python3 install version salesforce-bulk == 2.1.0 and change the method name post_bulk_batch to post_batch
That's it do the trick!

What is causing AttributeError: 'list' object has no attribute 'read' when tying to read in a pdf with Tabula?

I am attempting to use Tabula to pull table information from a pdf and convert it to a pandas dataframe. I have been following the steps in this tutorial:
https://aegis4048.github.io/parse-pdf-files-while-retaining-structure-with-tabula-py
When I try to load the remote PDF into my jupyter notebook with the following code (taken directly from the tutorial):
import tabula
df2 = tabula.read_pdf("https://github.com/tabulapdf/tabula-java/raw/master/src/test/resources/technology/tabula/arabic.pdf")
I get the error:
AttributeError: 'list' object has no attribute 'read'
I have tried to read in pdfs saved locally to my machine and I get the same error. I believe I have successfully installed Java and configured the environment variable correctly, and I have the most recent version of Tabula.
Link to screenshot from my jupyter notebook:
https://www.dropbox.com/s/y44mfzuclihfdau/S_O_Capture_1.PNG?dl=0
Thanks.
Make sure you installed the right tabula package!
If you ran pip3 install tabula, then you installed an imposter!
Run pip3 uninstall tabula to remove it, then run:
pip3 install tabula-py
to install the correct package.

OpenCV2 createBackgroundSubtractorMOG Attribute not found

I am using cv2 version 4.0.0 and python version 3.7.2.
I am trying to subtract Background using this method cv2.createBackgroundSubtractorMOG2() and its working well.
But when I use cv2.createBackgroundSubtractorMOG() its not working its showing me
AttributeError: module 'cv2.cv2' has no attribute
'createBackgroundSubtractorMOG '.
I also tried cv2.BackgroundSubtractorMOG() but i got same error
AttributeError: module 'cv2.cv2' has no attribute
'BackgroundSubtractorMOG'.
and another subtraction method cv2.createBackgroundSubtractorGMG() also not working.
I also refer other stackoverflow answers but I didn't get solution.
MOG2 containts in main opencv repository. MOG and GMG are from opencv_contrib: https://github.com/opencv/opencv_contrib/tree/master/modules/bgsegm
there are two subtraction packages in opencv. BackgroundSubtractorMOG() it's at cv2.bgsegm.BackgroundSubtractorMOG(),to use you must install opencv-contrib-python

Tensorboard - pkg_resources has no attribute 'declare_namespace'

I am trying to run tensorboard but I am getting the following import error;
AttributeError: module 'pkg_resources' has no attribute 'declare_namespace'
I have tried reinstalling setuptools and distribute. This is for Python3.5.
This stacktrace is going into the Protobuf codebase so this doesn't look like a bug in TensorFlow. It looks like something is wrong with the setuptools on your system. Maybe try reinstalling it? You can also try installing TensorFlow inside a virtualenv.
See also: https://github.com/tensorflow/tensorflow/issues/6863

Resources