Installing Docker + tensorflow on Windows 10 - windows

I tried to install tensorflow and docker as followed link https://www.tensorflow.org/install/docker
I downloaded tensorflow image from the tensowflow Hub into the docker and then I tried to test tensorflow python script.
Then I got error message below.
I think it's related with GPU but I just downloaded tensorflow/tensorflow:last and I don't need GPU version.
I thought if I used docker + tensorflow I wouldn't get any error.
Is there anybody who can tell me what's wrong with this..
2020-02-15 08:24:32.759681: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory
2020-02-15 08:24:32.759786: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory
2020-02-15 08:24:32.759798: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.

As https://www.tensorflow.org/install/docker says, "nvidia-container-runtime is only available for Linux". As for now, there's no way to provide GPU to docker containers if you're using Windows as a host system.

Related

Tensorflow in Docker on MacOs cannot load libraries with the tensorflow/tensorflow:latest image

Following the Getting Started guide for running Tensorflow in a docker container yields an error very quickly. Working through the instructions here, I pulled the tensorflow/tensorflow:latest image and then tried running:
docker run -it --rm tensorflow/tensorflow:latest python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
It's billed as a cpu-only image (under section https://www.tensorflow.org/install/docker#examples_using_cpu-only_images), which I believe I need because I'm running on a Mac, and don't have an Nvidia graphics card. However, the following errors occur:
~/> docker run -it --rm tensorflow/tensorflow:latest python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
2020-01-12 18:53:17.848471: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory
2020-01-12 18:53:17.848763: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory
2020-01-12 18:53:17.848843: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
2020-01-12 18:53:18.288367: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2020-01-12 18:53:18.288461: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
2020-01-12 18:53:18.288516: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (996a2dd2ab59): /proc/driver/nvidia/version does not exist
2020-01-12 18:53:18.289117: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-01-12 18:53:18.295734: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2592000000 Hz
2020-01-12 18:53:18.296844: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55c37f5f81f0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-01-12 18:53:18.296881: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
tf.Tensor(-203.31216, shape=(), dtype=float32)
Are the instructions misleading (saying latest is a cpu-only image) or am I missing something? I see references to cuda in the output so it would seem this isn't a cpu-only image? Should I be using a different image?
Here are my specs:
macOs Mojave - 10.14.6
Docker Desktop - 2.1.0.6
docker - 19.03.5
I had this same issue not long ago, but I discovered that it actually prints the correct result, and those logs might be warnings.
The result of print(tf.reduce_sum(tf.random.normal([1000, 1000]))) is actually tf.Tensor(-203.31216, shape=(), dtype=float32), which is in the last line of what was printed out.
if you can run your code in a jupyter notebook, then you should use the jupyter/tensorflow-notebook image.
Set it up this way:
docker pull jupyter/tensorflow-notebook
docker run -p 8888:8888 jupyter/tensorflow-notebook
After running the container, a link would be displayed on the terminal that you can use to access the notebook. Copy the link and paste in your browser, and start writing your code. It worked well for me without any of those "Warnings" printed out.
If the tensorflow container runs your code correctly with those errors still printed out, please let me know. But for now I am using the jupyter notebook container and I am not getting any errors or warnings.
If i find a way of clearing those warnings, I will let you know here.
I met this problem too, and I was trying to run on a PC. Because the nvidia-docker doesn't support Windows, I also have to use the cpu-only image.
As Odohi David said, you can run your code in a jupyter notebook. You may run it with the official image like this:
docker run -it -p 8888:8888 tensorflow/tensorflow:latest-py3-jupyter
Then open localhost:8888 in your browser. You will need a token to access the notebook and you can find it in the terminal. For example:
[I 13:57:13.801 NotebookApp] http://8c6f388f31c0:8888/?token=44ec1f209c1777c4c1b28b38b9842f297e170cbacf24b291
In this case, the token is 44ec1f209c1777c4c1b28b38b9842f297e170cbacf24b291.
After that, you can access to the official tensorflow-tutorials, and write your code on the notebook.

No available image handler could decode this transfer syntax JPEG Lossless when read DICOM and ploting using matplotlib

When i use pydicom in python3.6, there are some problem:
import pydicom
import matplotlib.pyplot as plt
import os
import pylab
filePath = "/Users/zhuangrui/Documents/Python/Dicom/dicoms/zhang_bo/0001.dcm"
dataSet_1 = pydicom.dcmread(filePath)
plt.imshow(dataSet_1.pixel_array)
plt.show()
here is the problem:
How can this problem be solved? Thank you very much!
I've faced with the same problem, after doing some research on the suggested link above. I've managed to solve it by updating to the latest pydicom module "1.2.0" and installing gdcm. You can update the pydicom with
pip install -U git+https://github.com/pydicom/pydicom.git
You can find the latest gdcm here and this link explains the installation.
I use anaconda and it's easier to install the gdcm package and solve the problem. If you use anaconda
just type inside from your environment:
conda install pydicom --channel conda-forge to get pydicom's latest and
conda install -c conda-forge gdcm
to get the gdcm. This resolves the problem. Hope these will help.
With pydicom, you need an appropriate image handler also installed to handle compressed image types.
For JPEG lossless, in theory the following should work: jpeg_ls, gdcm, or Pillow with jpeg plugin. All of these also require Numpy to be installed. See the discussion at https://github.com/pydicom/pydicom/issues/532.
There is also a pull request in progress to add more descriptive error messages for what image handlers are needed for different images.
Problem:
I was trying to read medical images with .dcm extension. But was getting an error on Windows as well as on Ubuntu. I find a solution which will work on both the machined.
The error I got on Ubuntu is: NotImplementedError: this transfer syntax JPEG 2000 Image Compression (Lossless Only), can not be read because Pillow lacks the jpeg 2000 decoder plugin
(Note for Windows I was getting a different error but I am sure it's because of the same issue i.e. Pillow does not support JPEG 2000 format)
Platforma Information:
I am using: Python 3.6, Anaconda and Ubuntu, 15 GB RAM
RAM is important:
The solution I applied is the same as Ali explained above. But I want to add this installation may take time (depending on RAM you are using). On ubuntu where I am using 15 GB RAM on Cloud platform taken less time and on Windows on a local machine having 4 GB RAM taken a lot of time.
Solution
Anaconda is necessary. Why?
Please check the official doc of pydicom (https://pydicom.github.io/pydicom/dev/getting_started.html) its mentioned "To install pydicom along with image handlers for compressed pixel data, we encourage you to use Miniconda or Anaconda" (Note for Windows I was getting a different error)
If you are using Ubuntu directly open Terminal. If you are using Windows then on Anaconda Navigator go to Environment from here start terminal. Execute the following commands on it:
pip install -U git+https://github.com/pydicom/pydicom.git
conda install pydicom --channel conda-forge
conda install -c conda-forge gdcm
Cross Check:
Now use .dcm file for which we got the Error. Try to use the following code in Python notebook
filename = 'FileName.dcm'
ds = pydicom.dcmread(filename)
plt.imshow(ds.pixel_array, cmap=plt.cm.bone)
It should print the output. Also try this code:
ds.pixel_array
This will give you the array containing values.

Python can't find BBIO.GPIO library on Raspberry

I am trying to set up an Adafruit 'RGB backlight positive LCD 20x4' using this tutorial:
https://learn.adafruit.com/character-lcd-with-raspberry-pi-or-beaglebone-black/usage
When I go to the examples directory and run 'char_lcd_rgb.py', I get an error:
'ImportError: No module named Adafruit_BBIO.GPIO'
Why am I getting an error for a Beaglebone library on a Raspberry Pi?
Should I install BBIO.GPIO on the Raspberry or is there something wrong elsewhere?
[(Pi Version 3), (Python v 2.7.9)]
Found my problem. A function in Platform.py was not finding the string 'BCM2835' assuming my platform was a Beaglebone.
A kind user suggested that I re-install Adafruit_Python_GPIO as that includes code for the 4.9 kernel.

Can not install Image acquisition package in Octave

According to the relevant wiki page (http://wiki.octave.org/Image_acquisition_package) to install the image acquisition package you enter:
pkg install -forge image-acquisition
I did that in the Octave console and I got an error message:
pkg install -forge image-acquisition
error: get_forge_pkg: could not read URL, please verify internet
connection
error: called from
get_forge_pkg at line 77 column 7
get_forge_download at line 26 column 12
pkg at line 393 column 29
Could you help me install the package? Thank you.
I got the same error on Ubuntu 19.04 after installing Octave from a snap package. The problem was that Apparmor was blocking requests to network resources. The problem was corrected by editing the Octave Apparmor profile file. The following steps fixed the problem:
Add following rules to the file: /var/lib/snapd/apparmor/profiles/snap.octave.octave. The rules should be added to the bottom of the file, just before the closing parenthesis
Add following rules:
owner #{HOME}/.bash_logout r,
owner #{HOME}/.xinputrc r,
owner #{HOME}/.pam_environment r,
owner #{HOME}/.bashrc r,
owner #{HOME}/.bash_history r,
owner #{HOME}/.profile r,
owner #{HOME}/.cache/mesa_shader_cache/index rw,
owner #{HOME}/.sudo_as_admin_successful r,
/usr/share/ca-certificates/mozilla/* r,
/etc/ssl/certs/ r,
/run/systemd/resolve/stub-resolv.conf r,
/etc/hosts r,
/etc/host.conf r,
/etc/ssl/certs/ca-certificates.crt r,
network inet stream,
network inet6 dgram,
network inet dgram,
Reload the Octave Apparmor profile using the command: sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.octave.octave
Restart Octave
Run the command pkg list -forge
I obtained this error in a network with blocked ports (only 80 and 443 allowed). After connecting to another network the error disappeared.
I'm guessing that you are using Windows. it appears that the Windows versions of Octave currently have an issue making https connections. Bug report #49869 has been created addressing this issue. It appears that the Windows version has not been compiled with proper configuration for ssl downloads, hence Octave cannot read the URL. I expect that pkg update will not work for you either.
Until that gets patched, you should be able to manually install the image acquisition package. Download the package file using the download link at the Octave Forge image-acquisition package page
Then, in Octave, navigate to the location where you saved the package file and type pkg install image-acquisition-0.2.2.tar.gz (or whatever the name is of the version you download).
Finally, since it seems you are using Windows, it is worth mentioning that the image-acquisition toolbox currently has limited (if any) functionality for non-Linux systems. According to the wiki you first linked, there are Linux library build dependencies for that package that are likely unavailable on your Windows system.There has been some recent discussion about this on the Octave help list here and here, but it is still a work in progress.

cannot execute binary file of golang bootstrap installer

I'm using the instructions in this blog post, which is intended for installing go 1.5 on the Raspberry Pi, to install golang on my Chromebook (which has ChrUbuntu not Chromium installed). The technique recommended in the blog post is to install a Golang 1.4 bootstrap compiler available here and then use that to build golang 1.5 (as you need a version of go installed to build 1.5). I tried this on the Raspberry pi and it worked, but when I ran this command from /go/src on ChrUbuntu
env GO_TEST_TIMEOUT_SCALE=10 GOROOT_BOOTSTRAP=$HOME/go-linux-arm-bootstrap ./all.bash
It gave me this output
env GO_TEST_TIMEOUT_SCALE=10 GOROOT_BOOTSTRAP=$HOME/go-linux-arm-bootstrap ./all.bash
# Building C bootstrap tool.
cmd/dist
./make.bash: line 121: /home/user/go-linux-arm/bootstrap/bin/go cannot execute binary file
Why am I getting this error message (is it because it's not compatible with ChrUbuntu) and how to do what I am trying to do. Thank you in advance.

Resources