Can't run Tensorflow-federated on GPU - tensorflow-federated

I am trying to run my python code which uses tensorflow-federated on a GPU. To set up my environment, I use venv. First, I install tensorflow-gpu, and my python code then can recognize the GPU, I use tf.test.gpu_device_name(). However, as soon as I install tensorflow-fedenerated, my python stops seeing any GPU and starts using CPUs!!
I am using Ubuntu 16.04.6 LTS. I tried a plenty of combinations of different versions of the packages:
python = 3.6, 3.7
cuda = 10.0, 10.1
tensorflow-gpu = 1.13.1, 1.15, 2.1.0, 2.0.0-alpha0
tensorflow-fedenerated = 0.2.0, 0.12.0, 0.13.0

It's hard to say exactly what the problem is here, but I do have a suspicion.
TFF declares TensorFlow 2.1 as a required package; this may mean that your TF-gpu installation is being removed during the TFF installation setup.
Can you please try the following order:
Open a fresh venv
Install TFF
Uninstall TF
Install TF GPU 2.1.0

Related

Pydrake has issue with python 3 point 9

Is Python3.9 supported?
I got this error with Python3.9:
File "/home/drake/drake/drake-build/install/lib/python3.6/site-packages/pydrake/common/__init__.py", line 8, in <module> from ._module_py import * ModuleNotFoundError: No module named 'pydrake.common._module_py'
There is no "python3.9" folder in .../install/lib.
I am running Ubuntu 18, and I am building Drake from source with latest github commit in master.
EDIT: Can someone explain how exactly Drake sets up pydrake?
It seems it detects the default Python installation somewhere automatically. I tried with a new installation, the default python was 3.8, and I also install:
apt install -y python3.10
Then I followed Drake python setup instructions.
git clone https://github.com/RobotLocomotion/drake.git
mkdir drake-build
cd drake-build
cmake ../drake
make -j
Pydrake only became available in 3.8. How to make it available for 3.10?
The current version of Pydrake (1.11.0) is officially supported on Ubuntu 20.04 with Python 3.8 and Ubuntu 22.04 with Python 3.10 when building from source. However, we recommend that most users use a binary release, and don't try to rebuild Drake from scratch themselves.
There are precompiled wheels at https://pypi.org/project/drake/ aka pip install drake; helpful installation details are at https://drake.mit.edu/pip.html. The wheels when run on Ubuntu support Python versions 3.8, 3.9, 3.10, or 3.11.
For example:
python3 -m venv env
env/bin/pip install --upgrade pip
env/bin/pip install drake
source env/bin/activate
For additional details, see https://drake.mit.edu/installation.html for full instructions and supported versions.
The last version of Pydrake to support Ubuntu 18.04 was v1.1.0 (released in March of 2022). If you need a newer version of Pydrake, you'll need to use a newer version of Ubuntu.

EasyOCR disables Cuda GPU when installed

Hello after installing EasyOCR via pip install easyocr via Anaconda Prompt (base) I receive this error.
OpenCV(4.5.4)
D:\a\opencv-python\opencv-python\opencv\modules\core\include\opencv2/core/private.cuda.hpp:106: error: (-216:No CUDA support) The library is compiled without CUDA
support in function 'throw_no_cuda'
Before installing easyocr, cuda is active and working with my GPU, but is disabled after installing EasyOCR.
I complied my build via Cmake using opencv4.5.4 and opencv-contrib4.5.4 with Cuda 11.3.1 and Cudnn 8.4.0 as well as uprading tot he most recent numpy 1.22.3.
It seems that after installing eascyOCR is changes my opencv build from whatever I am using to "opencv-python-headless-4.5.4.60" and that is I believe where the issues is at.
This is the version of easyocr installed.
Downloading opencv_python_headless-4.5.4.60-cp39-cp39-win_amd64.whl (35.0 MB)
Successfully installed easyocr-1.4.2 opencv-python-headless-4.5.4.60 python-bidi-0.4.2
Any idea or help on how I can get easyocr working with Cuda and my GPU?
Solved,
Have to install EasyOCR first
Then build OPENCV

sift = cv2.xfeatures2d.SIFT_create() not working even though have contrib installed

So I am trying to use:
sift = cv2.xfeatures2d.SIFT_create()
and it is coming up with this error:
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1207: error: (-213:The function/feature is not implemented)
This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake
option and rebuild the library in function 'cv::xfeatures2d::SIFT::create'
I am using Python 3.5.0 and opencv(3.4.3) and I am just using idle. This occured after I tried to install TensorFlow and I have tried looking around and have installed opencv-contrib-python but I am still getting the same error. Thank you in advance and I apologise if I have not included enough info
I had the same problem. It seems that SIRF and SURF are no longer available in opencv > 3.4.2.16. I chose an older opencv-python and opencv-contrib-python versions and solved this problem. Here is the history version about opencv-python, and I use the following code :
pip install opencv-python==3.4.2.16
pip install opencv-contrib-python==3.4.2.16
Edit
For Anaconda User just this instead of pip
conda install -c menpo opencv
this will install cv2 3.4.1 and everything you need to run SIFT
Since SIFT patent expired, SIFT has been moved to the main repo.
To use SIFT in Opencv, You should use cv2.SIFT_create() instead of cv2.xfeatures2d.SIFT_create() now. (xfeatures2d only exists in the contrib package, but sift is part of the main package now.)
Below link will be helpful.
https://github.com/opencv/opencv/issues/16736
Edit: The opencv-contrib-python-nonfree was removed from pypi.
On Linux/ MacOS, I've found a better solution! To access nonfree detectors use:
pip install opencv-contrib-python-nonfree
It may be due to a mismatch of opencv version and opencv-contrib version.
If you installed opencv from the source using CMake, and the source version is different from the version of opencv-contrib-python, uninstall the current opencv-contrib-python and do pip install opencv-contrib-python==<version of the source>.X or an another compatible version.
One version setup that I have running is opencv source (3.2), opencv-python (3.4.0.14) and opencv-contrib-python (3.4.2.17)

DataStax Enterprise 4.5 on RHEL / CentOS 7 won't fully install cqlsh

When trying to install DataStax Enterprise from the yum repository, cqlsh won't actually install because it depends on python 2.6 while RHEL/CentOS now ships with python 2.7 and removed 2.6.
It seems it should also be able to accept python 2.7, as far as I know, it is compatible. I just used the CentOS 7 system python 2.7 to install pip and then pip install cqlsh and it all seems to be good.
Hm... yes, that's tricky. The target path for site files is in the package, so one would need different packages for different versions of python (I believe). I filed a ticket, we will look into this.

Is OpenCV supported on Python 3 yet?

I already have part of a program running in Python 3 but I need OpenCV (or SimpleCV), for a robotic vehicle, but I haven't found any install commands that seem to work, other than for Python 2.7.
If it is compatible could you please include instructions (/links to) for installation of the module?
I am using Ubuntu 14.
Maybe a little late to answer, but it's actually supported on OpenCV version 3 (in alpha state nowadays). I have successfully managed to install it, on MacOS, but I guess it would be similar on Ubuntu.
Now you have separated options for python2 and python3 when using Cmake. So you'll have to set those to make it work. That's all I needed to set:
BUILD_opencv_python3
PYTHON3_LIBRARY
PYTHON3_INCLUDE_DIR
PYTHON3_INCLUDE_DIR2
PYTHON3_NUMPY_INCLUDE_DIRS
...
Here you can find more detailed description: Link
Luigolas is correct that OpenCV 3.0 supports Python 3.x bindings. It was in release candidate status since April and the production version was released on 4 June 2015. Unfortunately for some reason the downloadable installation program on the OpenCV site does not contain a Python 3.x-compatible cv2.pyd file.
OP asked about Ubuntu but for those requiring a Windows installer, use Christoph Gohlke's site, which maintains Windows binaries for many Python packages, including OpenCV 3.0 with Python 3.x bindings. Visit:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
To install, just download the 64-bit or 32-bit .whl file appropriate for your system, then run pip install [filename]. Then the instruction import cv2 should work in your Python 3.x interpreter.

Resources